Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: cocur/slugify
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.3
Choose a base ref
...
head repository: cocur/slugify
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Loading
Showing with 23,775 additions and 1,583 deletions.
  1. +32 −0 .appveyor.yml
  2. +0 −6 .coveralls.yml
  3. 0 .editorconfig
  4. +7 −0 .gitattributes
  5. +63 −0 .github/workflows/unit.yml
  6. +4 −10 .gitignore
  7. +25 −0 .php-cs-fixer.php
  8. +159 −39 .scrutinizer.yml
  9. +0 −32 .travis.yml
  10. +74 −0 CODE_OF_CONDUCT.md
  11. +2 −2 LICENSE
  12. +510 −171 README.md
  13. +30 −0 Resources/rules/arabic.json
  14. +79 −0 Resources/rules/armenian.json
  15. +10 −0 Resources/rules/austrian.json
  16. +16 −0 Resources/rules/azerbaijani.json
  17. +65 −0 Resources/rules/bulgarian.json
  18. +121 −0 Resources/rules/burmese.json
  19. +6,937 −0 Resources/rules/chinese.json
  20. +12 −0 Resources/rules/croatian.json
  21. +1,700 −0 Resources/rules/custom-fonts.json
  22. +20 −0 Resources/rules/czech.json
  23. +10 −0 Resources/rules/danish.json
  24. +186 −0 Resources/rules/default.json
  25. +14 −0 Resources/rules/esperanto.json
  26. +14 −0 Resources/rules/estonian.json
  27. +6 −0 Resources/rules/finnish.json
  28. +34 −0 Resources/rules/french.json
  29. +35 −0 Resources/rules/georgian.json
  30. +10 −0 Resources/rules/german.json
  31. +111 −0 Resources/rules/greek.json
  32. +55 −0 Resources/rules/gujarati.json
  33. +66 −0 Resources/rules/hindi.json
  34. +20 −0 Resources/rules/hungarian.json
  35. +13 −0 Resources/rules/italian.json
  36. +593 −0 Resources/rules/korean.json
  37. +18 −0 Resources/rules/latvian.json
  38. +20 −0 Resources/rules/lithuanian.json
  39. +64 −0 Resources/rules/macedonian.json
  40. +8 −0 Resources/rules/norwegian.json
  41. +34 −0 Resources/rules/persian.json
  42. +20 −0 Resources/rules/polish.json
  43. +187 −0 Resources/rules/portuguese-brazil.json
  44. +16 −0 Resources/rules/romanian.json
  45. +68 −0 Resources/rules/russian.json
  46. +72 −0 Resources/rules/serbian.json
  47. +36 −0 Resources/rules/slovak.json
  48. +8 −0 Resources/rules/swedish.json
  49. +14 −0 Resources/rules/turkish.json
  50. +18 −0 Resources/rules/turkmen.json
  51. +10 −0 Resources/rules/ukrainian.json
  52. +92 −0 Resources/rules/vietnamese.json
  53. +52 −0 Resources/rules/yiddish.json
  54. +58 −0 bin/generate-default.php
  55. +44 −29 composer.json
  56. +2 −0 dev-tools/.gitignore
  57. +6 −0 dev-tools/analyse.sh
  58. +11 −0 dev-tools/composer.json
  59. +0 −11 humbug.json.dist
  60. +12 −7 phpunit.xml.dist
  61. +0 −20 sami.php
  62. +1 −1 src/Bridge/Laravel/SlugifyFacade.php
  63. +4 −4 src/Bridge/Laravel/SlugifyServiceProvider.php
  64. +6 −6 src/Bridge/Latte/SlugifyHelper.php
  65. +37 −0 src/Bridge/League/SlugifyServiceProvider.php
  66. +4 −4 src/Bridge/Nette/SlugifyExtension.php
  67. +1 −1 src/Bridge/Plum/SlugifyConverter.php
  68. +0 −57 src/Bridge/Silex/SlugifyServiceProvider.php
  69. +4 −12 src/Bridge/Symfony/CocurSlugifyBundle.php
  70. +19 −5 src/Bridge/Symfony/CocurSlugifyExtension.php
  71. +46 −0 src/Bridge/Symfony/Configuration.php
  72. +20 −14 src/Bridge/Twig/SlugifyExtension.php
  73. +12 −12 src/Bridge/ZF2/Module.php
  74. +5 −6 src/Bridge/ZF2/SlugifyService.php
  75. +5 −3 src/Bridge/ZF2/SlugifyViewHelper.php
  76. +2 −1 src/Bridge/ZF2/SlugifyViewHelperFactory.php
  77. +10,966 −0 src/RuleProvider/DefaultRuleProvider.php
  78. +47 −0 src/RuleProvider/FileRuleProvider.php
  79. +29 −0 src/RuleProvider/RuleProviderInterface.php
  80. +106 −800 src/Slugify.php
  81. +5 −3 src/SlugifyInterface.php
  82. +8 −9 tests/Bridge/Laravel/SlugifyProviderTest.php
  83. +8 −8 tests/Bridge/Latte/SlugifyHelperTest.php
  84. +95 −0 tests/Bridge/League/SlugifyServiceProviderTest.php
  85. +12 −12 tests/Bridge/Nette/SlugifyExtensionTest.php
  86. +10 −11 tests/Bridge/Plum/SlugifyConverterTest.php
  87. +0 −59 tests/Bridge/Silex/SlugifySilexProviderTest.php
  88. +8 −19 tests/Bridge/Symfony/CocurSlugifyBundleTest.php
  89. +36 −31 tests/Bridge/Symfony/CocurSlugifyExtensionTest.php
  90. +74 −0 tests/Bridge/Symfony/ConfigurationTest.php
  91. +12 −23 tests/Bridge/Twig/SlugifyExtensionTest.php
  92. +12 −11 tests/Bridge/ZF2/ModuleTest.php
  93. +18 −17 tests/Bridge/ZF2/SlugifyServiceTest.php
  94. +7 −6 tests/Bridge/ZF2/SlugifyViewHelperFactoryTest.php
  95. +8 −7 tests/Bridge/ZF2/SlugifyViewHelperTest.php
  96. +44 −0 tests/RuleProvider/FileRuleProviderTest.php
  97. +201 −114 tests/SlugifyTest.php
32 changes: 32 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
build: false
platform: x86
clone_folder: C:\projects\cocur\slugify

cache:
- '%APPDATA%\Composer'
- '%LOCALAPPDATA%\Composer'
- C:\tools\composer.phar -> .appveyor.yml
- C:\tools\php -> .appveyor.yml

init:
- SET PATH=C:\tools\php;%PATH%
- SET COMPOSER_BINARY=C:\tools\composer.phar

install:
- ps: Set-Service wuauserv -StartupType Manual
- IF NOT EXIST C:\tools\php (choco install --yes --allow-empty-checksums php --params '/InstallDir:C:\tools\php')
- cd C:\tools\php
- copy php.ini-production php.ini /Y
- echo date.timezone="UTC" >> php.ini
- echo extension_dir=ext >> php.ini
- echo extension=php_openssl.dll >> php.ini
- echo extension=php_mbstring.dll >> php.ini
- echo extension=php_curl.dll >> php.ini
- echo memory_limit=3G >> php.ini
- IF NOT EXIST C:\tools\composer.phar (cd C:\tools && appveyor DownloadFile https://getcomposer.org/composer.phar)
- cd %APPVEYOR_BUILD_FOLDER%
- php C:\tools\composer.phar update --no-interaction --no-progress --optimize-autoloader --prefer-stable

test_script:
- cd %APPVEYOR_BUILD_FOLDER%
- php vendor\bin\simple-phpunit
6 changes: 0 additions & 6 deletions .coveralls.yml

This file was deleted.

Empty file modified .editorconfig
100755 → 100644
Empty file.
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/bin/ export-ignore
/dev-tools/ export-ignore
/Resources/ export-ignore
/tests/ export-ignore
/.* export-ignore
/CODE_OF_CONDUCT.md export-ignore
/phpunit.xml.dist export-ignore
63 changes: 63 additions & 0 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: PHPUnit

on: [push, pull_request]

jobs:
tests:
name: Unit tests

strategy:
matrix:
include:
- php: "8.0"
os: macos-13
- php: "8.0"
mode: high-deps
os: ubuntu-20.04
- php: "8.1"
os: ubuntu-20.04
- php: "8.1"
mode: low-deps
os: ubuntu-20.04
- php: "8.2"
os: ubuntu-20.04
- php: "8.2"
os: ubuntu-20.04
mode: low-deps
- php: "8.3"
mode: experimental
os: ubuntu-20.04
- php: "8.4"
mode: experimental
os: ubuntu-20.04
fail-fast: false

runs-on: "${{ matrix.os }}"

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 2

- name: Configure for PHP >= 8.2
if: "matrix.php >= '8.2'"
run: |
composer config platform.php 8.1.99
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: "none"
ini-values: date.timezone=Europe/Paris,memory_limit=-1,default_socket_timeout=10,session.gc_probability=0,apc.enable_cli=1,zend.assertions=1
php-version: "${{ matrix.php }}"
extensions: "${{ env.extensions }}"
tools: flex

- name: Install dependencies
run: |
composer update --no-progress --ansi
- name: Run tests
run: |
vendor/bin/simple-phpunit --verbose --coverage-clover=coverage.clover
14 changes: 4 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
*.sublime-project
*.sublime-workspace
.idea
/nbproject/private/
/build/
/cache/
vendor
report
/vendor/
composer.lock
phpunit.xml
humbuglog.txt
.php-cs-fixer.cache
.phpunit.result.cache
/phpunit.xml
25 changes: 25 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
declare(strict_types=1);

$finder = PhpCsFixer\Finder::create()
->files()
->in(__DIR__ . '/bin')
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests')
->append([__FILE__])
->notName('DefaultRuleProvider.php')
;

$config = new PhpCsFixer\Config();
$config
->setFinder($finder)
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'no_empty_phpdoc' => true,
'php_unit_fqcn_annotation' => true,
'php_unit_test_annotation' => true,
'phpdoc_trim' => true,
]);

return $config;
198 changes: 159 additions & 39 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,162 @@
tools:
external_code_coverage: true
php_sim: true
php_pdepend: true
php_analyzer: true

filter:
excluded_paths:
- 'vendor/*'
- 'tests/*'
before_commands:
- 'composer --prefer-source --dev install'
- 'cp phpunit.xml.dist phpunit.xml'
tools:
php_mess_detector:
config:
naming_rules: { boolean_method_name: true }
controversial_rules: { camel_case_class_name: true, camel_case_property_name: true, camel_case_method_name: true, camel_case_parameter_name: true, camel_case_variable_name: true }
php_analyzer:
config:
parameter_reference_check: { enabled: false }
checkstyle: { enabled: true, no_trailing_whitespace: true, naming: { enabled: true, local_variable: '^[a-z][a-zA-Z0-9]*$', abstract_class_name: ^Abstract|Factory$, utility_class_name: 'Utils?$', constant_name: '^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$', property_name: '^[a-z][a-zA-Z0-9]*$', method_name: '^(?:[a-z]|__)[a-zA-Z0-9]*$', parameter_name: '^[a-z][a-zA-Z0-9]*$', interface_name: '^[A-Z][a-zA-Z0-9]*Interface$', type_name: '^[A-Z][a-zA-Z0-9]*$', exception_name: '^[A-Z][a-zA-Z0-9]*Exception$', isser_method_name: '^(?:is|has|should|may|supports)' } }
unreachable_code: { enabled: true }
check_access_control: { enabled: false }
typo_checks: { enabled: true }
check_variables: { enabled: true }
suspicious_code: { enabled: false, overriding_parameter: false, overriding_closure_use: false, parameter_closure_use_conflict: false, parameter_multiple_times: false, non_existent_class_in_instanceof_check: false, non_existent_class_in_catch_clause: false, assignment_of_null_return: false, non_commented_switch_fallthrough: false, non_commented_empty_catch_block: false, overriding_private_members: false, use_statement_alias_conflict: false, precedence_in_condition_assignment: false }
dead_assignments: { enabled: true }
verify_php_doc_comments: { enabled: true, parameters: true, return: true, suggest_more_specific_types: true, ask_for_return_if_not_inferrable: true, ask_for_param_type_annotation: true }
loops_must_use_braces: { enabled: true }
check_usage_context: { enabled: true, method_call_on_non_object: { enabled: true, ignore_null_pointer: true }, foreach: { value_as_reference: true, traversable: true }, missing_argument: true, argument_type_checks: lenient }
simplify_boolean_return: { enabled: true }
phpunit_checks: { enabled: true }
reflection_checks: { enabled: false }
precedence_checks: { enabled: true, assignment_in_condition: true, comparison_of_bit_result: true }
basic_semantic_checks: { enabled: true }
doc_comment_fixes: { enabled: true }
reflection_fixes: { enabled: false }
use_statement_fixes: { enabled: true, remove_unused: true, preserve_multiple: false, order_alphabetically: false }
php_code_sniffer:
config:
standard: PSR2
sensiolabs_security_checker: true
php_code_coverage:
config_path: phpunit.xml.dist
php_cpd: true
php_loc: true
php_pdepend: true
- 'examples/*'

checks:
php:
verify_property_names: true
verify_argument_usable_as_reference: true
verify_access_scope_valid: true
variable_existence: true
useless_calls: true
use_statement_alias_conflict: true
use_self_instead_of_fqcn: true
uppercase_constants: true
unused_variables: true
unused_properties: true
unused_parameters: true
unused_methods: true
unreachable_code: true
too_many_arguments: true
symfony_request_injection: true
switch_fallthrough_commented: true
sql_injection_vulnerabilities: true
spacing_of_function_arguments: true
spacing_around_non_conditional_operators: true
spacing_around_conditional_operators: true
space_after_cast: true
single_namespace_per_use: true
simplify_boolean_return: true
side_effects_or_types: true
security_vulnerabilities: true
scope_indentation:
spaces_per_level: '4'
return_doc_comments: true
return_doc_comment_if_not_inferrable: true
require_scope_for_properties: true
require_scope_for_methods: true
require_php_tag_first: true
require_braces_around_control_structures: true
remove_trailing_whitespace: true
remove_php_closing_tag: true
remove_extra_empty_lines: true
psr2_switch_declaration: true
psr2_control_structure_declaration: true
psr2_class_declaration: true
property_assignments: true
properties_in_camelcaps: true
prefer_while_loop_over_for_loop: true
prefer_unix_line_ending: true
prefer_sapi_constant: true
precedence_mistakes: true
precedence_in_conditions: true
phpunit_assertions: true
php5_style_constructor: true
parameters_in_camelcaps: true
parameter_non_unique: true
parameter_doc_comments: true
param_doc_comment_if_not_inferrable: true
overriding_private_members: true
optional_parameters_at_the_end: true
one_class_per_file: true
non_commented_empty_catch_block: true
no_unnecessary_if: true
no_unnecessary_function_call_in_for_loop: true
no_unnecessary_final_modifier: true
no_underscore_prefix_in_properties: true
no_underscore_prefix_in_methods: true
no_trait_type_hints: true
no_trailing_whitespace: true
no_space_inside_cast_operator: true
no_space_between_concatenation_operator: true
no_space_before_semicolon: true
no_space_around_object_operator: true
no_space_after_cast: true
no_short_open_tag: true
no_property_on_interface: true
no_non_implemented_abstract_methods: true
code_rating: true
duplication: true
deprecated_code_usage: true
closure_use_not_conflicting: true
closure_use_modifiable: true
avoid_useless_overridden_methods: true
avoid_conflicting_incrementers: true
assignment_of_null_return: true
no_goto: true
no_global_keyword: true
no_exit: true
no_eval: true
no_error_suppression: true
no_empty_statements: true
no_elseif_statements: true
no_duplicate_arguments: true
no_debug_code: true
no_commented_out_code: true
newline_at_end_of_file: true
naming_conventions:
local_variable: '^[a-z][a-zA-Z0-9]*$'
abstract_class_name: ^Abstract|Factory$
utility_class_name: 'Utils?$'
constant_name: '^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$'
property_name: '^[a-z][a-zA-Z0-9]*$'
method_name: '^(?:[a-z]|__)[a-zA-Z0-9]*$'
parameter_name: '^[a-z][a-zA-Z0-9]*$'
interface_name: '^[A-Z][a-zA-Z0-9]*Interface$'
type_name: '^[A-Z][a-zA-Z0-9]*$'
exception_name: '^[A-Z][a-zA-Z0-9]*Exception$'
isser_method_name: '^(?:is|has|should|may|supports|filter)'
more_specific_types_in_doc_comments: true
missing_arguments: true
method_calls_on_non_object: true
lowercase_php_keywords: true
lowercase_basic_constants: true
instanceof_class_exists: true
function_in_camel_caps: true
function_body_start_on_new_line: true
foreach_usable_as_reference: true
foreach_traversable: true
fix_use_statements:
remove_unused: true
preserve_multiple: false
preserve_blanklines: false
order_alphabetically: true
fix_php_opening_tag: true
fix_linefeed: true
fix_line_ending: true
fix_identation_4spaces: true
fix_doc_comments: true
ensure_lower_case_builtin_functions: true
encourage_single_quotes: true
encourage_shallow_comparison: true
encourage_postdec_operator: true
deadlock_detection_in_loops: true
classes_in_camel_caps: true
catch_class_exists: true
blank_line_after_namespace_declaration: true
avoid_usage_of_logical_operators: true
avoid_unnecessary_concatenation: true
avoid_todo_comments: true
avoid_tab_indentation: true
avoid_superglobals: true
avoid_perl_style_comments: true
avoid_fixme_comments: true
avoid_length_functions_in_loops: true
avoid_multiple_statements_on_same_line: true
avoid_entity_manager_injection: true
avoid_duplicate_types: true
avoid_corrupting_byteorder_marks: true
avoid_closing_tag: true
avoid_aliased_php_functions: true
align_assignments: true
argument_type_checks: true
no_mixed_inline_html: true
no_long_variable_names:
maximum: '20'
32 changes: 0 additions & 32 deletions .travis.yml

This file was deleted.

Loading