Actualización

This commit is contained in:
Xes
2025-04-10 12:24:57 +02:00
parent 8969cc929d
commit 45420b6f0d
39760 changed files with 4303286 additions and 0 deletions

40
vendor/cocur/slugify/.appveyor.yml vendored Normal file
View File

@@ -0,0 +1,40 @@
build: false
shallow_clone: true
platform: x86
clone_folder: c:\projects\cocur\slugify
cache:
- '%LOCALAPPDATA%\Composer\files'
init:
- SET PATH=C:\Program Files\OpenSSL;c:\tools\php;%PATH%
environment:
matrix:
- COMPOSER_FLAGS: ""
install:
- cinst -y OpenSSL.Light
- cinst -y 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_fileinfo.dll >> php.ini
- echo memory_limit=1G >> php.ini
- cd c:\projects\cocur\slugify
- php -r "readfile('http://getcomposer.org/installer');" | php
- php composer.phar update %COMPOSER_FLAGS% --no-interaction --no-progress
test_script:
- cd c:\projects\cocur\slugify
- vendor\bin\phpunit.bat --verbose
notifications:
- provider: Webhook
url: https://webhooks.gitter.im/e/aaf55568e4629e650616
on_build_success: false
on_build_failure: true
on_build_status_changed: true

13
vendor/cocur/slugify/.editorconfig vendored Normal file
View File

@@ -0,0 +1,13 @@
root = true
[*]
indent_style = space
indent_size = 4
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.yml]
indent_style = space
indent_size = 2

11
vendor/cocur/slugify/.gitignore vendored Normal file
View File

@@ -0,0 +1,11 @@
*.sublime-project
*.sublime-workspace
.idea
/nbproject/private/
/build/
/cache/
vendor
report
composer.lock
phpunit.xml
humbuglog.txt

162
vendor/cocur/slugify/.scrutinizer.yml vendored Normal file
View File

@@ -0,0 +1,162 @@
tools:
external_code_coverage: true
php_sim: true
php_pdepend: true
php_analyzer: true
filter:
excluded_paths:
- 'tests/*'
- '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'

47
vendor/cocur/slugify/.travis.yml vendored Normal file
View File

@@ -0,0 +1,47 @@
language: php
sudo: false
matrix:
include:
- php: 5.5.9
- php: 5.5
- php: 5.5
env: COMPOSER_FLAGS='--prefer-lowest --prefer-stable'
- php: 5.6
- php: 5.6
env: COMPOSER_FLAGS='--prefer-lowest --prefer-stable'
- php: 7.0
- php: 7.0
env: COMPOSER_FLAGS='--prefer-lowest --prefer-stable'
- php: 7.1
- php: 7.1
env: COMPOSER_FLAGS='--prefer-lowest --prefer-stable'
- php: hhvm
- php: nightly
allow_failures:
- php: nightly
fast_finish: true
cache:
directories:
- $HOME/.composer/cache
before_install:
- travis_retry composer self-update && composer --version
install:
- travis_retry composer update $COMPOSER_FLAGS --prefer-source -n
script: vendor/bin/phpunit --verbose --coverage-clover=coverage.clover
after_script:
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi;'
notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/fc8ccb3e96abeb0fdc95
on_success: change
on_failure: always
on_start: never

9
vendor/cocur/slugify/LICENSE vendored Normal file
View File

@@ -0,0 +1,9 @@
The MIT License (MIT)
Copyright (c) 2012 Florian Eckerstorfer
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

686
vendor/cocur/slugify/README.md vendored Normal file
View File

@@ -0,0 +1,686 @@
cocur/slugify
=============
> Converts a string into a slug.
[![Build Status](https://img.shields.io/travis/cocur/slugify.svg?style=flat)](https://travis-ci.org/cocur/slugify)
[![Windows Build status](https://ci.appveyor.com/api/projects/status/9yv498ff61byp742?svg=true)](https://ci.appveyor.com/project/florianeckerstorfer/slugify)
[![Scrutinizer Quality Score](https://img.shields.io/scrutinizer/g/cocur/slugify.svg?style=flat)](https://scrutinizer-ci.com/g/cocur/slugify/)
[![Code Coverage](https://scrutinizer-ci.com/g/cocur/slugify/badges/coverage.png?b=master&style=flat-square)](https://scrutinizer-ci.com/g/cocur/slugify/?branch=master)
[![Latest Release](https://img.shields.io/packagist/v/cocur/slugify.svg)](https://packagist.org/packages/cocur/slugify)
[![MIT License](https://img.shields.io/packagist/l/cocur/slugify.svg)](http://opensource.org/licenses/MIT)
[![Total Downloads](https://img.shields.io/packagist/dt/cocur/slugify.svg)](https://packagist.org/packages/cocur/slugify)
Developed by [Florian Eckerstorfer](https://florian.ec) in Vienna, Europe with the help of
[many great contributors](https://github.com/cocur/slugify/graphs/contributors).
Features
--------
- Removes all special characters from a string.
- Provides custom replacements for Arabic, Austrian, Azerbaijani, Bulgarian, Burmese, Croatian, Czech, Esperanto, Estonian, Finnish, French, Georgian, German, Greek, Hindi, Italien, Latvian, Lithuanian, Norwegian, Polish, Romanian, Russian, Serbian, Spanish, Swedish, Turkish, Ukrainian and Vietnamese special characters. Instead of
removing these characters, Slugify approximates them (e.g., `ae` replaces `ä`).
- No external dependencies.
- PSR-4 compatible.
- Compatible with PHP >= 5.5.9, PHP 7 and [HHVM](http://hhvm.com).
- Integrations for [Symfony (2 and 3)](http://symfony.com), [Silex (1 and 2)](http://silex.sensiolabs.org), [Laravel](http://laravel.com),
[Twig (1 and 2)](http://twig.sensiolabs.org), [Zend Framework 2](http://framework.zend.com/), [Nette Framework](http://nette.org/),
[Latte](http://latte.nette.org/) and [Plum](https://github.com/plumphp/plum).
Installation
------------
You can install Slugify through [Composer](https://getcomposer.org):
```shell
$ composer require cocur/slugify
```
Usage
-----
Generate a slug:
```php
use Cocur\Slugify\Slugify;
$slugify = new Slugify();
echo $slugify->slugify('Hello World!'); // hello-world
```
You can also change the separator used by `Slugify`:
```php
echo $slugify->slugify('Hello World!', '_'); // hello_world
```
The library also contains `Cocur\Slugify\SlugifyInterface`. Use this interface whenever you need to type hint an
instance of `Slugify`.
To add additional transliteration rules you can use the `addRule()` method.
```php
$slugify->addRule('i', 'ey');
echo $slugify->slugify('Hi'); // hey
```
### Rulesets
Many of the transliterations rules used in Slugify are specific to a language. These rules are therefore categorized
using rulesets. Rules for the most popular are activated by default in a specific order. You can change which rulesets
are activated and the order in which they are activated. The order is important when there are conflicting rules in
different languages. For example, in German `ä` is transliterated with `ae`, in Turkish the correct transliteration is
`a`. By default the German transliteration is used since German is used more often on the internet. If you want to use
prefer the Turkish transliteration you have to possibilities. You can activate it after creating the constructor:
```php
$slugify = new Slugify();
$slugify->slugify('ä'); // -> "ae"
$slugify->activateRuleset('turkish');
$slugify->slugify('ä'); // -> "a"
```
An alternative way would be to pass the rulesets and their order to the constructor.
```php
$slugify = new Slugify(['rulesets' => ['default', 'turkish']]);
$slugify->slugify('ä'); // -> "a"
```
You can find a list of the available rulesets in `Resources/rules`.
### More options
The constructor takes an options array, you have already seen the `rulesets` options above. You can also change the
regular expression that is used to replace characters with the separator.
```php
$slugify = new Slugify(['regexp' => '/([^A-Za-z0-9]|-)+/']);
```
*(The regular expression used in the example above is the default one.)*
By default Slugify will convert the slug to lowercase. If you want to preserve the case of the string you can set the
`lowercase` option to false.
```php
$slugify = new Slugify(['lowercase' => false]);
$slugify->slugify('Hello World'); // -> "Hello-World"
```
By default Slugify will use dashes as separators. If you want to use a different default separator, you can set the
`separator` option.
```php
$slugify = new Slugify(['separator' => '_']);
$slugify->slugify('Hello World'); // -> "hello_world"
```
### Changing options on the fly
You can overwrite any of the above options on the fly by passing an options array as second argument to the `slugify()`
method. For example:
```php
$slugify = new Slugify();
$slugify->slugify('Hello World', ['lowercase' => false]); // -> "Hello-World"
```
You can also modify the separator this way:
```php
$slugify = new Slugify();
$slugify->slugify('Hello World', ['separator' => '_']); // -> "hello_world"
```
You can even activate a custom ruleset without touching the default rules:
```php
$slugify = new Slugify();
$slugify->slugify('für', ['ruleset' => 'turkish']); // -> "fur"
$slugify->slugify('für'); // -> "fuer"
```
### Contributing
Feel free to ask for new rules for languages that is not already here.
All you need to do is:
1. Provide transliteration rules for your language, in any form, e.g. `'ї' => 'ji'`
2. Provide some examples of texts transliterated with this rules e.g. `'Україна' => 'Ukrajina'`
### Further information
- [API docs](http://cocur.co/slugify/api/master/)
Integrations
------------
### Symfony
Slugify contains a Symfony bundle and service definition that allow you to use it as a service in your Symfony
application. The code resides in the `Cocur\Slugify\Bridge\Symfony` namespace and you only need to add the bundle class
to your `AppKernel.php`:
```php
# app/AppKernel.php
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new Cocur\Slugify\Bridge\Symfony\CocurSlugifyBundle(),
);
// ...
}
// ...
}
```
You can now use the `cocur_slugify` service everywhere in your application, for example, in your controller:
```php
$slug = $this->get('cocur_slugify')->slugify('Hello World!');
```
The bundle also provides an alias `slugify` for the `cocur_slugify` service:
```php
$slug = $this->get('slugify')->slugify('Hello World!');
```
You can set the following configuration settings in `app/config.yml` to adjust the slugify service:
```yaml
cocur_slugify:
lowercase: <boolean>
separator: <string>
regexp: <string>
rulesets: { }
```
### Twig
If you use the Symfony framework with Twig you can use the Twig filter `slugify` in your templates after you have setup
Symfony integrations (see above).
```twig
{{ 'Hällo Wörld'|slugify }}
```
If you use Twig outside of the Symfony framework you first need to add the extension to your environment:
```php
use Cocur\Slugify\Bridge\Twig\SlugifyExtension;
use Cocur\Slugify\Slugify;
$twig = new Twig_Environment($loader);
$twig->addExtension(new SlugifyExtension(Slugify::create()));
```
To use the Twig filter with [TwigBridge](https://github.com/rcrowe/TwigBridge) for Laravel, you'll need to add the
Slugify extension using a closure:
```php
// laravel/app/config/packages/rcrowe/twigbridge/config.php
'extensions' => array(
//...
function () {
return new \Cocur\Slugify\Bridge\Twig\SlugifyExtension(\Cocur\Slugify\Slugify::create());
},
),
```
You can find more information about registering extensions in the
[Twig documentation](http://twig.sensiolabs.org/doc/advanced.html#creating-an-extension).
### Silex
Slugify also provides a service provider to integrate into Silex.
```php
// For Silex version 1
$app->register(new Cocur\Slugify\Bridge\Silex\SlugifyServiceProvider());
```
```php
// For Silex version 2
$app->register(new Cocur\Slugify\Bridge\Silex2\SlugifyServiceProvider());
```
You can use the `slugify` method in your controllers:
```php
$app->get('/', function () {
return $app['slugify']->slugify('welcome to the homepage');
});
```
And if you use Silex in combination with Twig register the `SlugifyServiceProvider` after the `Silex\Provider\TwigServiceProvider` to add the Twig extension to your environment and use the `slugify` filter in your templates.
```twig
{{ 'welcome to the homepage'|slugify }}
```
### Mustache.php
We don't need an additional integration to use Slugify in [Mustache.php](https://github.com/bobthecow/mustache.php).
If you want to use Slugify in Mustache, just add a helper:
```php
use Cocur\Slugify\Slugify;
$mustache = new Mustache_Engine(array(
// ...
'helpers' => array('slugify' => function($string, $separator = null) {
return Slugify::create()->slugify($string, $separator);
}),
));
```
### Laravel
Slugify also provides a service provider to integrate into Laravel (versions 4.1 and later).
In your Laravel project's `app/config/app.php` file, add the service provider into the "providers" array:
```php
'providers' => array(
"Cocur\Slugify\Bridge\Laravel\SlugifyServiceProvider",
)
```
And add the facade into the "aliases" array:
```php
'aliases' => array(
"Slugify" => "Cocur\Slugify\Bridge\Laravel\SlugifyFacade",
)
```
You can then use the `Slugify::slugify()` method in your controllers:
```php
$url = Slugify::slugify('welcome to the homepage');
```
### Zend Framework 2
Slugify can be easely used in Zend Framework 2 applications. Included bridge provides a service and a view helper
already registered for you.
Just enable the module in your configuration like this.
```php
return array(
//...
'modules' => array(
'Application',
'ZfcBase',
'Cocur\Slugify\Bridge\ZF2' // <- Add this line
//...
)
//...
);
```
After that you can retrieve the `Cocur\Slugify\Slugify` service (or the `slugify` alias) and generate a slug.
```php
/** @var \Zend\ServiceManager\ServiceManager $sm */
$slugify = $sm->get('Cocur\Slugify\Slugify');
$slug = $slugify->slugify('Hällo Wörld');
$anotherSlug = $slugify->slugify('Hällo Wörld', '_');
```
In your view templates use the `slugify` helper to generate slugs.
```php
<?php echo $this->slugify('Hällo Wörld') ?>
<?php echo $this->slugify('Hällo Wörld', '_') ?>
```
The service (which is also used in the view helper) can be customized by defining this configuration key.
```php
return array(
'cocur_slugify' => array(
'reg_exp' => '/([^a-zA-Z0-9]|-)+/'
)
);
```
### Nette Framework
Slugify contains a Nette extension that allows you to use it as a service in your Nette application. You only need to
register it in your `config.neon`:
```yml
# app/config/config.neon
extensions:
slugify: Cocur\Slugify\Bridge\Nette\SlugifyExtension
```
You can now use the `Cocur\Slugify\SlugifyInterface` service everywhere in your application, for example in your
presenter:
```php
class MyPresenter extends \Nette\Application\UI\Presenter
{
/** @var \Cocur\Slugify\SlugifyInterface @inject */
public $slugify;
public function renderDefault()
{
$this->template->hello = $this->slugify->slugify('Hällo Wörld');
}
}
```
### Latte
If you use the Nette Framework with it's native Latte templating engine, you can use the Latte filter `slugify` in your
templates after you have setup Nette extension (see above).
```smarty
{$hello|slugify}
```
If you use Latte outside of the Nette Framework you first need to add the filter to your engine:
```php
use Cocur\Slugify\Bridge\Latte\SlugifyHelper;
use Cocur\Slugify\Slugify;
use Latte;
$latte = new Latte\Engine();
$latte->addFilter('slugify', array(new SlugifyHelper(Slugify::create()), 'slugify'));
```
### Slim 3
Slugify does not need a specific bridge to work with [Slim 3](http://www.slimframework.com), just add the following configuration:
```php
$container['view'] = function ($c) {
$settings = $c->get('settings');
$view = new \Slim\Views\Twig($settings['view']['template_path'], $settings['view']['twig']);
$view->addExtension(new Slim\Views\TwigExtension($c->get('router'), $c->get('request')->getUri()));
$view->addExtension(new Cocur\Slugify\Bridge\Twig\SlugifyExtension(Cocur\Slugify\Slugify::create()));
return $view;
};
```
In a template you can use it like this:
```twig
<a href="/blog/{{ post.title|slugify }}">{{ post.title|raw }}</a></h5>
```
### League
Slugify provides a service provider for use with `league/container`:
```php
use Cocur\Slugify;
use League\Container;
/* @var Container\ContainerInterface $container */
$container->addServiceProvider(new Slugify\Bridge\League\SlugifyServiceProvider());
/* @var Slugify\Slugify $slugify */
$slugify = $container->get(Slugify\SlugifyInterface::class);
```
You can configure it by sharing the required options:
```php
use Cocur\Slugify;
use League\Container;
/* @var Container\ContainerInterface $container */
$container->share('config.slugify.options', [
'lowercase' => false,
'rulesets' => [
'default',
'german',
],
]);
$container->addServiceProvider(new Slugify\Bridge\League\SlugifyServiceProvider());
/* @var Slugify\Slugify $slugify */
$slugify = $container->get(Slugify\SlugifyInterface::class);
```
You can configure which rule provider to use by sharing it:
```php
use Cocur\Slugify;
use League\Container;
/* @var Container\ContainerInterface $container */
$container->share(Slugify\RuleProvider\RuleProviderInterface::class, function () {
return new Slugify\RuleProvider\FileRuleProvider(__DIR__ . '/../../rules');
]);
$container->addServiceProvider(new Slugify\Bridge\League\SlugifyServiceProvider());
/* @var Slugify\Slugify $slugify */
$slugify = $container->get(Slugify\SlugifyInterface::class);
```
Change Log
----------
### Version 2.5 (23 March 2017)
- [#150](https://github.com/cocur/slugify/pull/150) Add Romanian rules (by [gabiudrescu](https://github.com/gabiudrescu))
- [#154](https://github.com/cocur/slugify/pull/154) Add French rules (by [SuN-80](https://github.com/SuN-80))
- [#159](https://github.com/cocur/slugify/pull/159) Add Estonian rules (by [erkimiilberg](https://github.com/erkimiilberg))
- [#162](https://github.com/cocur/slugify/pull/162) Add support for Twig 2 (by [JakeFr](https://github.com/JakeFr))
### Version 2.4 (9 February 2017)
- [#133](https://github.com/cocur/slugify/pull/133) Allow to modify options without creating a new object (by [leofeyer](https://github.com/leofeyer))
- [#135](https://github.com/cocur/slugify/pull/135) Add support for Danish (by [izehose](https://github.com/izehose))
- [#140](https://github.com/cocur/slugify/pull/140) Update Hindi support (by [arunlodhi](https://github.com/arunlodhi))
- [#146](https://github.com/cocur/slugify/pull/146) Add support for Italien (by [gianiaz](https://github.com/gianiaz))
- [#151](https://github.com/cocur/slugify/pull/151) Add support for Serbian (by [cvetan](https://github.com/cvetan))
- [#155](https://github.com/cocur/slugify/pull/155) Update support for Lithuanian (by [s4uliu5](https://github.com/s4uliu5))
### Version 2.3 (9 August 2016)
- [#124](https://github.com/cocur/slugify/issues/124) Fix support for Bulgarian
- [#125](https://github.com/cocur/slugify/pull/125) Update Silex 2 provider (by [JakeFr](https://github.com/JakeFr))
- [#129](https://github.com/cocur/slugify/pull/129) Add support for Croatian (by [napravicukod](https://github.com/napravicukod))
### Version 2.2 (10 July 2016)
- [#102](https://github.com/cocur/slugify/pull/102) Add transliterations for Azerbaijani (by [seferov](https://github.com/seferov))
- [#109](https://github.com/cocur/slugify/pull/109) Made integer values into strings (by [JonathanMH](https://github.com/JonathanMH))
- [#114](https://github.com/cocur/slugify/pull/114) Provide SlugifyServiceProvider for league/container (by [localheinz](https://github.com/localheinz))
- [#120](https://github.com/cocur/slugify/issues/120) Add compatibility with Silex 2 (by [shamotj](https://github.com/shamotj))
### Version 2.1.1 (8 April 2016)
- Do not activate Swedish rules by default (fixes broken v2.1 release)
### Version 2.1.0 (8 April 2016)
- [#104](https://github.com/cocur/slugify/pull/104) Add Symfony configuration (by [estahn](https://github.com/estahn))
- [#107](https://github.com/cocur/slugify/issues/107) Fix Swedish rules
### Version 2.0.0 (24 February 2016)
- [#78](https://github.com/cocur/slugify/pull/78) Use multibyte-safe case convention (by [Koc](https://github.com/Koc))
- [#81](https://github.com/cocur/slugify/pull/81) Move rules into JSON files (by [florianeckerstorfer](https://github.com/florianeckerstorfer))
- [#84](https://github.com/cocur/slugify/pull/84) Add tests for very long strings containing umlauts (by [florianeckerstorfer](https://github.com/florianeckerstorfer))
- [#88](https://github.com/cocur/slugify/pull/88) Add rules for Hindi (by [florianeckerstorfer](https://github.com/florianeckerstorfer))
- [#89](https://github.com/cocur/slugify/pull/89) Add rules for Norwegian (by [tsmes](https://github.com/tsmes))
- [#90](https://github.com/cocur/slugify/pull/90) Replace `bindShared` with `singleton` in Laravel bridge (by [sunspikes](https://github.com/sunspikes))
- [#97](https://github.com/cocur/slugify/pull/97) Set minimum PHP version to 5.5.9 (by [florianeckerstorfer](https://github.com/florianeckerstorfer))
- [#98](https://github.com/cocur/slugify/pull/98) Add rules for Bulgarian (by [RoumenDamianoff](https://github.com/RoumenDamianoff))
### Version 1.4.1 (11 February 2016)
- [#90](https://github.com/cocur/slugify/pull/90) Replace `bindShared` with `singleton` in Laravel bridge (by [sunspikes](https://github.com/sunspikes))
### Version 1.4 (29 September 2015)
- [#75](https://github.com/cocur/slugify/pull/75) Remove a duplicate array entry (by [irfanevrens](https://github.com/irfanevrens))
- [#76](https://github.com/cocur/slugify/pull/76) Add support for Georgian (by [TheGIBSON](https://github.com/TheGIBSON))
- [#77](https://github.com/cocur/slugify/pull/77) Fix Danish transliterations (by [kafoso](https://github.com/kafoso))
### Version 1.3 (2 September 2015)
- [#70](https://github.com/cocur/slugify/pull/70) Add missing superscript and subscript digits (by [BlueM](https://github.com/BlueM))
- [#71](https://github.com/cocur/slugify/pull/71) Improve Greek language support (by [kostaspt](https://github.com/kostaspt))
- [#72](https://github.com/cocur/slugify/pull/72) Improve Silex integration (by [CarsonF](https://github.com/CarsonF))
- [#73](https://github.com/cocur/slugify/pull/73) Improve Russian language support (by [akost](https://github.com/akost))
### Version 1.2 (2 July 2015)
- Add integration for [Plum](https://github.com/plumphp/plum) (by [florianeckerstorfer](https://github.com/florianeckerstorfer))
- [#64](https://github.com/cocur/slugify/pull/64) Fix Nette integration (by [lookyman](https://github.com/lookyman))
- Add option to not convert slug to lowercase (by [florianeckerstorfer](https://github.com/florianeckerstorfer) and [GDmac](https://github.com/GDmac))
### Version 1.1 (18 March 2015)
- [#54](https://github.com/cocur/slugify/pull/54) Add support for Burmese characters (by [lovetostrike](https://github.com/lovetostrike))
- [#58](https://github.com/cocur/slugify/pull/58) Add Nette and Latte integration (by [lookyman](https://github.com/lookyman))
- [#50](https://github.com/cocur/slugify/issues/50) Fix transliteration for Vietnamese character Đ (by [mac2000](https://github.com/mac2000))
### Version 1.0 (26 November 2014)
No new features or bugfixes, but it's about time to pump Slugify to v1.0.
### Version 0.11 (23 November 2014)
- [#49](https://github.com/cocur/slugify/pull/49) Add Zend Framework 2 integration (by [acelaya](https://github.com/acelaya))
### Version 0.10.3 (8 November 2014)
- [#48](https://github.com/cocur/slugify/pull/48) Add support for Vietnamese (by [mac2000](https://github.com/mac2000))
### Version 0.10.2 (18 October 2014)
- [#44](https://github.com/cocur/slugify/pull/44) Change visibility of properties to `protected` (by [acelaya](https://github.com/acelaya))
- [#45](https://github.com/cocur/slugify/pull/45) Configure regular expression used to replace characters (by [acelaya](https://github.com/acelaya))
- Fix type hinting (by [florianeckerstorfer](https://github.com/florianeckerstorfer))
- Remove duplicate rule (by [florianeckerstorfer](https://github.com/florianeckerstorfer))
### Version 0.10.1 (1 September 2014)
- [#39](https://github.com/cocur/slugify/pull/39) Add support for rulesets (by [florianeckerstorfer](https://github.com/florianeckerstorfer))
### Version 0.10.0 (26 August 2014)
- [#32](https://github.com/cocur/slugify/pull/32) Added Laraval bridge (by [cviebrock](https://github.com/cviebrock))
- [#35](https://github.com/cocur/slugify/pull/35) Fixed transliteration for `Ď` (by [michalskop](https://github.com/michalskop))
### Version 0.9 (29 May 2014)
- [#28](https://github.com/cocur/slugify/pull/28) Add Symfony2 service alias and make Twig extension private (by [Kevin Bond](https://github.com/kbond))
### Version 0.8 (18 April 2014)
- [#27](https://github.com/cocur/slugify/pull/27) Add support for Arabic characters (by [Davide Bellini](https://github.com/billmn))
- Added some missing characters
- Improved organisation of characters in `Slugify` class
### Version 0.7 (4 April 2014)
This version introduces optional integrations into Symfony2, Silex and Twig. You can still use the library in any other framework. I decided to include these bridges because there exist integrations from other developers, but they use outdated versions of cocur/slugify. Including these small bridge classes in the library makes maintaining them a lot easier for me.
- [#23](https://github.com/cocur/slugify/pull/23) Added Symfony2 service
- [#24](https://github.com/cocur/slugify/pull/24) Added Twig extension
- [#25](https://github.com/cocur/slugify/pull/25) Added Silex service provider
### Version 0.6 (2 April 2014)
- [#22](https://github.com/cocur/slugify/pull/22) Added support for Esperanto characters (by [Michel Petit](https://github.com/malenkiki))
### Version 0.5 (28 March 2014)
- [#21](https://github.com/cocur/slugify/pull/21) Added support for Greek characters (by [Michel Petit](https://github.com/malenkiki))
- [#20](https://github.com/cocur/slugify/pull/20) Fixed rule for cyrillic letter D (by [Marchenko Alexandr](https://github.com/cocur/slugify/pull/20))
- Add missing `$separator` parameter to `SlugifyInterface`
### Version 0.4.1 (9 March 2014)
- [#19](https://github.com/cocur/slugify/pull/19) Adds soft sign rule (by [Marchenko Alexandr](https://github.com/mac2000))
### Version 0.4 (17 January 2014)
Nearly completely rewritten code, removes `iconv` support because the underlying library is broken. The code is now better and faster. Many thanks to [Marchenko Alexandr](http://mac-blog.org.ua).
### Version 0.3 (12 January 2014)
- [#11](https://github.com/cocur/slugify/pull/11) PSR-4 compatible (by [mac2000](https://github.com/mac2000))
- [#13](https://github.com/cocur/slugify/pull/13) Added editorconfig (by [mac2000](https://github.com/mac2000))
- [#14](https://github.com/cocur/slugify/pull/14) Return empty slug when input is empty and removed unused parameter (by [mac2000](https://github.com/mac2000))
Authors
-------
- [Florian Eckerstorfer](http://florian.ec) ([Twitter](http://twitter.com/Florian_))
- [Ivo Bathke](https://github.com/ivoba)
- [Marchenko Alexandr](http://mac-blog.org.ua)
- And many [great contributors](https://github.com/cocur/slugify/graphs/contributors)
> Slugify is a project of [Cocur](http://cocur.co). You can contact us on Twitter:
> [**@cocurco**](https://twitter.com/cocurco)
Support
-------
If you need support you can ask on [Twitter](https://twitter.com/cocurco) (well, only if your question is short) or you
can join our chat on Gitter.
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/cocur/slugify)
In case you want to support the development of Slugify you can help us with providing additional transliterations or
inform us if a transliteration is wrong. We would highly appreciate it if you can send us directly a Pull Request on
Github. If you have never contributed to a project on Github we are happy to help you. Just ask on Twitter or directly
join our Gitter.
You always can help me (Florian, the original developer and maintainer) out by
[sending me an Euro or two](https://paypal.me/florianec/2).
License
-------
The MIT License (MIT)
Copyright (c) 2012-2014 Florian Eckerstorfer
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,30 @@
{
"أ" : "a",
"ب" : "b",
"ت" : "t",
"ث" : "th",
"ج" : "g",
"ح" : "h",
"خ" : "kh",
"د" : "d",
"ذ" : "th",
"ر" : "r",
"ز" : "z",
"س" : "s",
"ش" : "sh",
"ص" : "s",
"ض" : "d",
"ط" : "t",
"ظ" : "th",
"ع" : "aa",
"غ" : "gh",
"ف" : "f",
"ق" : "k",
"ك" : "k",
"ل" : "l",
"م" : "m",
"ن" : "n",
"ه" : "h",
"و" : "o",
"ي" : "y"
}

View File

@@ -0,0 +1,9 @@
{
"Ä": "AE",
"Ö": "OE",
"Ü": "UE",
"ß": "sz",
"ä": "ae",
"ö": "oe",
"ü": "ue"
}

View File

@@ -0,0 +1,16 @@
{
"Ə": "E",
"Ç": "C",
"Ğ": "G",
"İ": "I",
"Ş": "S",
"Ö": "O",
"Ü": "U",
"ə": "e",
"ç": "c",
"ğ": "g",
"ı": "i",
"ş": "s",
"ö": "o",
"ü": "u"
}

View File

@@ -0,0 +1,65 @@
{
"А": "A",
"Б": "B",
"В": "V",
"Г": "G",
"Д": "D",
"Е": "E",
"Ж": "J",
"З": "Z",
"И": "I",
"Й": "Y",
"К": "K",
"Л": "L",
"М": "M",
"Н": "N",
"О": "O",
"П": "P",
"Р": "R",
"С": "S",
"Т": "T",
"У": "U",
"Ф": "F",
"Х": "H",
"Ц": "Ts",
"Ч": "Ch",
"Ш": "Sh",
"Щ": "Sht",
"Ъ": "A",
"Ь": "I",
"Ю": "Iu",
"Я": "Ia",
"а": "a",
"б": "b",
"в": "v",
"г": "g",
"д": "d",
"е": "e",
"ж": "j",
"з": "z",
"и": "i",
"й": "y",
"к": "k",
"л": "l",
"м": "m",
"н": "n",
"о": "o",
"п": "p",
"р": "r",
"с": "s",
"т": "t",
"у": "u",
"ф": "f",
"х": "h",
"ц": "ts",
"ч": "ch",
"ш": "sh",
"щ": "sht",
"ъ": "a",
"ь": "i",
"ю": "iu",
"я": "ia",
"ия": "ia",
"йо": "iо",
"ьо": "io"
}

View File

@@ -0,0 +1,121 @@
{
"က": "k",
"ခ": "kh",
"ဂ": "g",
"ဃ": "ga",
"င": "ng",
"စ": "s",
"ဆ": "sa",
"ဇ": "z",
"စျ" : "za",
"ည": "ny",
"ဋ": "t",
"ဌ": "ta",
"ဍ": "d",
"ဎ": "da",
"ဏ": "na",
"တ": "t",
"ထ": "ta",
"ဒ": "d",
"ဓ": "da",
"န": "n",
"ပ": "p",
"ဖ": "pa",
"ဗ": "b",
"ဘ": "ba",
"မ": "m",
"ယ": "y",
"ရ": "ya",
"လ": "l",
"": "w",
"သ": "th",
"ဟ": "h",
"ဠ": "la",
"အ": "a",
"ြ": "y",
"ျ": "ya",
"ွ": "w",
"ြွ": "yw",
"ျွ": "ywa",
"ှ": "h",
"ဧ": "e",
"၏": "-e",
"ဣ": "i",
"ဤ": "-i",
"ဉ": "u",
"ဦ": "-u",
"ဩ": "aw",
"သြော" : "aw",
"ဪ": "aw",
"၍": "ywae",
"၌": "hnaik",
"": "0",
"၁": "1",
"၂": "2",
"၃": "3",
"၄": "4",
"၅": "5",
"၆": "6",
"၇": "7",
"၈": "8",
"၉": "9",
"္": "",
"့": "",
"း": "",
"ာ": "a",
"ါ": "a",
"ေ": "e",
"ဲ": "e",
"ိ": "i",
"ီ": "i",
"ို": "o",
"ု": "u",
"ူ": "u",
"ေါင်": "aung",
"ော": "aw",
"ော်": "aw",
"ေါ": "aw",
"ေါ်": "aw",
"်": "at",
"က်": "et",
"ိုက်" : "aik",
"ောက်" : "auk",
"င်" : "in",
"ိုင်" : "aing",
"ောင်" : "aung",
"စ်" : "it",
"ည်" : "i",
"တ်" : "at",
"ိတ်" : "eik",
"ုတ်" : "ok",
"ွတ်" : "ut",
"ေတ်" : "it",
"ဒ်" : "d",
"ိုဒ်" : "ok",
"ုဒ်" : "ait",
"န်" : "an",
"ာန်" : "an",
"ိန်" : "ein",
"ုန်" : "on",
"ွန်" : "un",
"ပ်" : "at",
"ိပ်" : "eik",
"ုပ်" : "ok",
"ွပ်" : "ut",
"န်ုပ်" : "nub",
"မ်" : "an",
"ိမ်" : "ein",
"ုမ်" : "on",
"ွမ်" : "un",
"ယ်" : "e",
"ိုလ်" : "ol",
"ဉ်" : "in",
"ံ": "an",
"ိံ" : "ein",
"ုံ" : "on"
}

View File

@@ -0,0 +1,12 @@
{
"Č": "C",
"Ć": "C",
"Ž": "Z",
"Š": "S",
"Đ": "Dj",
"č": "c",
"ć": "c",
"ž": "z",
"š": "s",
"đ": "dj"
}

View File

@@ -0,0 +1,20 @@
{
"Č": "C",
"Ď": "D",
"Ě": "E",
"Ň": "N",
"Ř": "R",
"Š": "S",
"Ť": "T",
"Ů": "U",
"Ž": "Z",
"č": "c",
"ď": "d",
"ě": "e",
"ň": "n",
"ř": "r",
"š": "s",
"ť": "t",
"ů": "u",
"ž": "z"
}

View File

@@ -0,0 +1,10 @@
{
"Æ": "Ae",
"æ": "ae",
"Ø": "Oe",
"ø": "oe",
"Å": "Aa",
"å": "aa",
"É": "E",
"é": "e"
}

View File

@@ -0,0 +1,186 @@
{
"°": "0",
"¹": "1",
"²": "2",
"³": "3",
"⁴": "4",
"⁵": "5",
"⁶": "6",
"⁷": "7",
"⁸": "8",
"⁹": "9",
"₀": "0",
"₁": "1",
"₂": "2",
"₃": "3",
"₄": "4",
"₅": "5",
"₆": "6",
"₇": "7",
"₈": "8",
"₉": "9",
"æ": "ae",
"ǽ": "ae",
"À": "A",
"Á": "A",
"Â": "A",
"Ã": "A",
"Å": "AA",
"Ǻ": "A",
"Ă": "A",
"Ǎ": "A",
"Æ": "AE",
"Ǽ": "AE",
"à": "a",
"á": "a",
"â": "a",
"ã": "a",
"å": "aa",
"ǻ": "a",
"ă": "a",
"ǎ": "a",
"ª": "a",
"@": "at",
"Ĉ": "C",
"Ċ": "C",
"Ç": "C",
"ç": "c",
"ĉ": "c",
"ċ": "c",
"©": "c",
"Ð": "Dj",
"Đ": "D",
"ð": "dj",
"đ": "d",
"È": "E",
"É": "E",
"Ê": "E",
"Ë": "E",
"Ĕ": "E",
"Ė": "E",
"è": "e",
"é": "e",
"ê": "e",
"ë": "e",
"ĕ": "e",
"ė": "e",
"ƒ": "f",
"Ĝ": "G",
"Ġ": "G",
"ĝ": "g",
"ġ": "g",
"Ĥ": "H",
"Ħ": "H",
"ĥ": "h",
"ħ": "h",
"Ì": "I",
"Í": "I",
"Î": "I",
"Ï": "I",
"Ĩ": "I",
"Ĭ": "I",
"Ǐ": "I",
"Į": "I",
"IJ": "IJ",
"ì": "i",
"í": "i",
"î": "i",
"ï": "i",
"ĩ": "i",
"ĭ": "i",
"ǐ": "i",
"į": "i",
"ij": "ij",
"Ĵ": "J",
"ĵ": "j",
"Ĺ": "L",
"Ľ": "L",
"Ŀ": "L",
"ĺ": "l",
"ľ": "l",
"ŀ": "l",
"Ñ": "N",
"ñ": "n",
"ʼn": "n",
"Ò": "O",
"Ó": "O",
"Ô": "O",
"Õ": "O",
"Ō": "O",
"Ŏ": "O",
"Ǒ": "O",
"Ő": "O",
"Ơ": "O",
"Ø": "OE",
"Ǿ": "O",
"Œ": "OE",
"ò": "o",
"ó": "o",
"ô": "o",
"õ": "o",
"ō": "o",
"ŏ": "o",
"ǒ": "o",
"ő": "o",
"ơ": "o",
"ø": "oe",
"ǿ": "o",
"º": "o",
"œ": "oe",
"Ŕ": "R",
"Ŗ": "R",
"ŕ": "r",
"ŗ": "r",
"Ŝ": "S",
"Ș": "S",
"ŝ": "s",
"ș": "s",
"ſ": "s",
"Ţ": "T",
"Ț": "T",
"Ŧ": "T",
"Þ": "TH",
"ţ": "t",
"ț": "t",
"ŧ": "t",
"þ": "th",
"Ù": "U",
"Ú": "U",
"Û": "U",
"Ü": "U",
"Ũ": "U",
"Ŭ": "U",
"Ű": "U",
"Ų": "U",
"Ư": "U",
"Ǔ": "U",
"Ǖ": "U",
"Ǘ": "U",
"Ǚ": "U",
"Ǜ": "U",
"ù": "u",
"ú": "u",
"û": "u",
"ü": "u",
"ũ": "u",
"ŭ": "u",
"ű": "u",
"ų": "u",
"ư": "u",
"ǔ": "u",
"ǖ": "u",
"ǘ": "u",
"ǚ": "u",
"ǜ": "u",
"Ŵ": "W",
"ŵ": "w",
"Ý": "Y",
"Ÿ": "Y",
"Ŷ": "Y",
"ý": "y",
"ÿ": "y",
"ŷ": "y"
}

View File

@@ -0,0 +1,14 @@
{
"ĉ": "cx",
"ĝ": "gx",
"ĥ": "hx",
"ĵ": "jx",
"ŝ": "sx",
"ŭ": "ux",
"Ĉ": "CX",
"Ĝ": "GX",
"Ĥ": "HX",
"Ĵ": "JX",
"Ŝ": "SX",
"Ŭ": "UX"
}

View File

@@ -0,0 +1,14 @@
{
"Š": "S",
"Ž": "Z",
"Õ": "O",
"Ä": "A",
"Ö": "O",
"Ü": "U",
"š": "s",
"ž": "z",
"õ": "o",
"ä": "a",
"ö": "o",
"ü": "u"
}

View File

@@ -0,0 +1,6 @@
{
"Ä": "A",
"Ö": "O",
"ä": "a",
"ö": "o"
}

View File

@@ -0,0 +1,32 @@
{
"À": "A",
"Â": "A",
"Æ": "AE",
"Ç": "C",
"É": "E",
"È": "E",
"Ê": "E",
"Ë": "E",
"Ï": "I",
"Î": "I",
"Ô": "O",
"Œ": "OE",
"Ù": "U",
"Û": "U",
"Ü": "U",
"à": "a",
"â": "a",
"æ": "ae",
"ç": "c",
"é": "e",
"è": "e",
"ê": "e",
"ë": "e",
"ï": "i",
"î": "i",
"ô": "o",
"œ": "oe",
"ù": "u",
"û": "u",
"ü": "u"
}

View File

@@ -0,0 +1,35 @@
{
"ა": "a",
"ბ": "b",
"გ": "g",
"დ": "d",
"ე": "e",
"ვ": "v",
"ზ": "z",
"თ": "t",
"ი": "i",
"კ": "k",
"ლ": "l",
"მ": "m",
"ნ": "n",
"ო": "o",
"პ": "p",
"ჟ": "zh",
"რ": "r",
"ს": "s",
"ტ": "t",
"უ": "u",
"ფ": "f",
"ქ": "k",
"ღ": "gh",
"": "q",
"შ": "sh",
"ჩ": "ch",
"ც": "ts",
"ძ": "dz",
"წ": "ts",
"ჭ": "ch",
"ხ": "kh",
"ჯ": "j",
"ჰ": "h"
}

View File

@@ -0,0 +1,9 @@
{
"Ä": "AE",
"Ö": "OE",
"Ü": "UE",
"ß": "ss",
"ä": "ae",
"ö": "oe",
"ü": "ue"
}

View File

@@ -0,0 +1,111 @@
{
"ΑΥ": "AU",
"Αυ": "Au",
"ΟΥ": "OU",
"Ου": "Ou",
"ΕΥ": "EU",
"Ευ": "Eu",
"ΕΙ": "I",
"Ει": "I",
"ΟΙ": "I",
"Οι": "I",
"ΥΙ": "I",
"Υι": "I",
"ΑΎ": "AU",
"Αύ": "Au",
"ΟΎ": "OU",
"Ού": "Ou",
"ΕΎ": "EU",
"Εύ": "Eu",
"ΕΊ": "I",
"Εί": "I",
"ΟΊ": "I",
"Οί": "I",
"ΎΙ": "I",
"Ύι": "I",
"ΥΊ": "I",
"Υί": "I",
"αυ": "au",
"ου": "ou",
"ευ": "eu",
"ει": "i",
"οι": "i",
"υι": "i",
"αύ": "au",
"ού": "ou",
"εύ": "eu",
"εί": "i",
"οί": "i",
"ύι": "i",
"υί": "i",
"Α": "A",
"Β": "V",
"Γ": "G",
"Δ": "D",
"Ε": "E",
"Ζ": "Z",
"Η": "I",
"Θ": "Th",
"Ι": "I",
"Κ": "K",
"Λ": "L",
"Μ": "M",
"Ν": "N",
"Ξ": "X",
"Ο": "O",
"Π": "P",
"Ρ": "R",
"Σ": "S",
"Τ": "T",
"Υ": "I",
"Φ": "F",
"Χ": "Ch",
"Ψ": "Ps",
"Ω": "O",
"Ά": "A",
"Έ": "E",
"Ή": "I",
"Ί": "I",
"Ό": "O",
"Ύ": "I",
"Ϊ": "I",
"Ϋ": "I",
"ϒ": "I",
"α": "a",
"β": "v",
"γ": "g",
"δ": "d",
"ε": "e",
"ζ": "z",
"η": "i",
"θ": "th",
"ι": "i",
"κ": "k",
"λ": "l",
"μ": "m",
"ν": "n",
"ξ": "x",
"ο": "o",
"π": "p",
"ρ": "r",
"ς": "s",
"σ": "s",
"τ": "t",
"υ": "i",
"φ": "f",
"χ": "ch",
"ψ": "ps",
"ω": "o",
"ά": "a",
"έ": "e",
"ή": "i",
"ί": "i",
"ό": "o",
"ύ": "i",
"ϊ": "i",
"ϋ": "i",
"ΰ": "i",
"ώ": "o",
"ϐ": "v",
"ϑ": "th"
}

View File

@@ -0,0 +1,66 @@
{
"अ": "a",
"आ": "aa",
"ए": "e",
"ई": "ii",
"ऍ": "ei",
"ऎ": "ae",
"ऐ": "ai",
"इ": "i",
"ओ": "o",
"ऑ": "oi",
"ऒ": "oii",
"ऊ": "uu",
"औ": "ou",
"उ": "u",
"ब": "B",
"भ": "Bha",
"च": "Ca",
"छ": "Chha",
"ड": "Da",
"ढ": "Dha",
"फ": "Fa",
"फ़": "Fi",
"ग": "Ga",
"घ": "Gha",
"ग़": "Ghi",
"ह": "Ha",
"ज": "Ja",
"झ": "Jha",
"क": "Ka",
"ख": "Kha",
"ख़": "Khi",
"ल": "L",
"ळ": "Li",
"ऌ": "Li",
"ऴ": "Lii",
"ॡ": "Lii",
"म": "Ma",
"न": "Na",
"ङ": "Na",
"ञ": "Nia",
"ण": "Nae",
"ऩ": "Ni",
"ॐ": "oms",
"प": "Pa",
"क़": "Qi",
"र": "Ra",
"ऋ": "Ri",
"ॠ": "Ri",
"ऱ": "Ri",
"स": "Sa",
"श": "Sha",
"ष": "Shha",
"ट": "Ta",
"त": "Ta",
"ठ": "Tha",
"द": "Tha",
"थ": "Tha",
"ध": "Thha",
"ड़": "ugDha",
"ढ़": "ugDhha",
"व": "Va",
"य": "Ya",
"य़": "Yi",
"ज़": "Za"
}

View File

@@ -0,0 +1,13 @@
{
"À": "a",
"È": "e",
"Ì": "i",
"Ò": "o",
"Ù": "u",
"à": "a",
"é": "e",
"è": "e",
"ì": "i",
"ò": "o",
"ù": "u"
}

View File

@@ -0,0 +1,18 @@
{
"Ā": "A",
"Ē": "E",
"Ģ": "G",
"Ī": "I",
"Ķ": "K",
"Ļ": "L",
"Ņ": "N",
"Ū": "U",
"ā": "a",
"ē": "e",
"ģ": "g",
"ī": "i",
"ķ": "k",
"ļ": "l",
"ņ": "n",
"ū": "u"
}

View File

@@ -0,0 +1,20 @@
{
"Ą": "A",
"Č": "C",
"Ę": "E",
"Ė": "E",
"Į": "I",
"Š": "S",
"Ų": "U",
"Ū": "U",
"Ž": "Z",
"ą": "a",
"č": "c",
"ę": "e",
"ė": "e",
"į": "i",
"š": "s",
"ų": "u",
"ū": "u",
"ž": "z"
}

View File

@@ -0,0 +1,8 @@
{
"Æ": "AE",
"Ø": "OE",
"Å": "AA",
"æ": "ae",
"ø": "oe",
"å": "aa"
}

View File

@@ -0,0 +1,20 @@
{
"Ą": "A",
"Ć": "C",
"Ę": "E",
"Ł": "L",
"Ń": "N",
"Ó": "O",
"Ś": "S",
"Ź": "Z",
"Ż": "Z",
"ą": "a",
"ć": "c",
"ę": "e",
"ł": "l",
"ń": "n",
"ó": "o",
"ś": "s",
"ź": "z",
"ż": "z"
}

View File

@@ -0,0 +1,16 @@
{
"ă": "a",
"î": "i",
"â": "a",
"ş": "s",
"ș": "s",
"ţ": "t",
"ț": "t",
"Ă": "A",
"Î": "I",
"Â": "A",
"Ş": "S",
"Ș": "S",
"Ţ": "T",
"Ț": "T"
}

View File

@@ -0,0 +1,68 @@
{
"Ъ": "",
"Ь": "",
"А": "A",
"Б": "B",
"Ц": "C",
"Ч": "Ch",
"Д": "D",
"Е": "E",
"Ё": "E",
"Э": "E",
"Ф": "F",
"Г": "G",
"Х": "H",
"И": "I",
"Й": "Y",
"Я": "Ya",
"Ю": "Yu",
"К": "K",
"Л": "L",
"М": "M",
"Н": "N",
"О": "O",
"П": "P",
"Р": "R",
"С": "S",
"Ш": "Sh",
"Щ": "Shch",
"Т": "T",
"У": "U",
"В": "V",
"Ы": "Y",
"З": "Z",
"Ж": "Zh",
"ъ": "",
"ь": "",
"а": "a",
"б": "b",
"ц": "c",
"ч": "ch",
"д": "d",
"е": "e",
"ё": "e",
"э": "e",
"ф": "f",
"г": "g",
"х": "h",
"и": "i",
"й": "y",
"я": "ya",
"ю": "yu",
"к": "k",
"л": "l",
"м": "m",
"н": "n",
"о": "o",
"п": "p",
"р": "r",
"с": "s",
"ш": "sh",
"щ": "shch",
"т": "t",
"у": "u",
"в": "v",
"ы": "y",
"з": "z",
"ж": "zh"
}

View File

@@ -0,0 +1,72 @@
{
"а": "a",
"б": "b",
"в": "v",
"г": "g",
"д": "d",
"ђ": "dj",
"е": "e",
"ж": "z",
"з": "z",
"и": "i",
"ј": "j",
"к": "k",
"л": "l",
"љ": "lj",
"м": "m",
"н": "n",
"њ": "nj",
"о": "o",
"п": "p",
"р": "r",
"с": "s",
"т": "t",
"ћ": "c",
"у": "u",
"ф": "f",
"х": "h",
"ц": "c",
"ч": "c",
"џ": "dz",
"ш": "s",
"А": "A",
"Б": "B",
"В": "V",
"Г": "G",
"Д": "D",
"Ђ": "Dj",
"Е": "E",
"Ж": "Z",
"З": "Z",
"И": "I",
"Ј": "J",
"К": "K",
"Л": "L",
"Љ": "Lj",
"М": "M",
"Н": "N",
"Њ": "Nj",
"О": "O",
"П": "P",
"Р": "R",
"С": "S",
"Т": "T",
"Ћ": "C",
"У": "U",
"Ф": "F",
"Х": "H",
"Ц": "C",
"Ч": "C",
"Џ": "Dz",
"Ш": "S",
"š": "s",
"đ": "dj",
"ž": "z",
"ć": "c",
"č": "c",
"Š": "S",
"Đ": "DJ",
"Ž": "Z",
"Ć": "C",
"Č": "C"
}

View File

@@ -0,0 +1,8 @@
{
"Ä": "A",
"Å": "a",
"Ö": "O",
"ä": "a",
"å": "a",
"ö": "o"
}

View File

@@ -0,0 +1,14 @@
{
"Ç": "C",
"Ğ": "G",
"İ": "I",
"Ş": "S",
"Ö": "O",
"Ü": "U",
"ç": "c",
"ğ": "g",
"ı": "i",
"ş": "s",
"ö": "o",
"ü": "u"
}

View File

@@ -0,0 +1,10 @@
{
"Ґ": "G",
"І": "I",
"Ї": "Ji",
"Є": "Ye",
"ґ": "g",
"і": "i",
"ї": "ji",
"є": "ye"
}

View File

@@ -0,0 +1,92 @@
{
"ạ": "a",
"ả": "a",
"ầ": "a",
"ấ": "a",
"ậ": "a",
"ẩ": "a",
"ẫ": "a",
"ằ": "a",
"ắ": "a",
"ặ": "a",
"ẳ": "a",
"ẵ": "a",
"ẹ": "e",
"ẻ": "e",
"ẽ": "e",
"ề": "e",
"ế": "e",
"ệ": "e",
"ể": "e",
"ễ": "e",
"ị": "i",
"ỉ": "i",
"ọ": "o",
"ỏ": "o",
"ồ": "o",
"ố": "o",
"ộ": "o",
"ổ": "o",
"ỗ": "o",
"ờ": "o",
"ớ": "o",
"ợ": "o",
"ở": "o",
"ỡ": "o",
"ụ": "u",
"ủ": "u",
"ừ": "u",
"ứ": "u",
"ự": "u",
"ử": "u",
"ữ": "u",
"ỳ": "y",
"ỵ": "y",
"ỷ": "y",
"ỹ": "y",
"Ạ": "A",
"Ả": "A",
"Ầ": "A",
"Ấ": "A",
"Ậ": "A",
"Ẩ": "A",
"Ẫ": "A",
"Ằ": "A",
"Ắ": "A",
"Ặ": "A",
"Ẳ": "A",
"Ẵ": "A",
"Ẹ": "E",
"Ẻ": "E",
"Ẽ": "E",
"Ề": "E",
"Ế": "E",
"Ệ": "E",
"Ể": "E",
"Ễ": "E",
"Ị": "I",
"Ỉ": "I",
"Ọ": "O",
"Ỏ": "O",
"Ồ": "O",
"Ố": "O",
"Ộ": "O",
"Ổ": "O",
"Ỗ": "O",
"Ờ": "O",
"Ớ": "O",
"Ợ": "O",
"Ở": "O",
"Ỡ": "O",
"Ụ": "U",
"Ủ": "U",
"Ừ": "U",
"Ứ": "U",
"Ự": "U",
"Ử": "U",
"Ữ": "U",
"Ỳ": "Y",
"Ỵ": "Y",
"Ỷ": "Y",
"Ỹ": "Y"
}

View File

@@ -0,0 +1,58 @@
<?php
/**
* @param string $directory
*
* @return array
*/
function getRules($directory)
{
$rules = [];
$iterator = new DirectoryIterator($directory);
foreach ($iterator as $file) {
if ($file->isFile() && $file->getExtension() === 'json') {
$rules[$file->getBasename('.json')] = json_decode(file_get_contents($file->getRealPath()), true);
}
}
return $rules;
}
/**
* @param string $fileName
* @param array $rules
*
* @return bool
*/
function insertRules($fileName, array $rules = [])
{
$startTag = '/*INSERT_START*/';
$endTag = '/*INSERT_END*/';
$content = file_get_contents($fileName);
$content = preg_replace(
$regexp = sprintf('#%s(.*)%s#s', quotemeta($startTag), quotemeta($endTag)),
$startTag.var_export($rules, true).$endTag,
$content
);
return false !== file_put_contents($fileName, $content);
}
$directory = __DIR__.'/../Resources/rules';
$fileName = __DIR__.'/../src/RuleProvider/DefaultRuleProvider.php';
$rules = getRules($directory);
$result = insertRules($fileName, $rules);
$ruleCount = array_reduce($rules, function ($count, $rules) {
return $count + count($rules);
}, 0);
if ($result) {
printf("Written %d rules into '%s'.\n", $ruleCount, $fileName);
} else {
printf("Error writing rules into '%s'.\n", $fileName);
}

43
vendor/cocur/slugify/composer.json vendored Normal file
View File

@@ -0,0 +1,43 @@
{
"name": "cocur/slugify",
"type": "library",
"description": "Converts a string into a slug.",
"keywords": ["slug", "slugify"],
"license": "MIT",
"authors": [
{
"name": "Florian Eckerstorfer",
"email": "florian@eckerstorfer.co",
"homepage": "https://florian.ec"
},
{
"name": "Ivo Bathke",
"email": "ivo.bathke@gmail.com"
}
],
"require": {
"php": ">=5.5.9"
},
"require-dev": {
"laravel/framework": "~5.1",
"latte/latte": "~2.2",
"league/container": "^2.2.0",
"mikey179/vfsStream": "~1.6",
"mockery/mockery": "~0.9",
"nette/di": "~2.2",
"phpunit/phpunit": "~4.8|~5.2",
"pimple/pimple": "~1.1",
"plumphp/plum": "~0.1",
"silex/silex": "~1.3",
"symfony/config": "~2.4|~3.0",
"symfony/dependency-injection": "~2.4|~3.0",
"symfony/http-kernel": "~2.4|~3.0",
"twig/twig": "~1.26|~2.0",
"zendframework/zend-modulemanager": "~2.2",
"zendframework/zend-servicemanager": "~2.2",
"zendframework/zend-view": "~2.2"
},
"autoload": {
"psr-4": {"Cocur\\Slugify\\": "src"}
}
}

19
vendor/cocur/slugify/phpunit.xml.dist vendored Normal file
View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php" colors="true">
<testsuites>
<testsuite name="cocur/slugify Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src</directory>
</whitelist>
</filter>
<listeners>
<listener class="\Mockery\Adapter\Phpunit\TestListener" />
</listeners>
</phpunit>

View File

@@ -0,0 +1,39 @@
<?php
/**
* This file is part of cocur/slugify.
*
* (c) Florian Eckerstorfer <florian@eckerstorfer.co>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cocur\Slugify\Bridge\Laravel;
use Illuminate\Support\Facades\Facade;
/**
* SlugifyFacade
*
* @package cocur/slugify
* @subpackage bridge
* @author Florian Eckerstorfer <florian@eckerstorfer.co>
* @author Colin Viebrock
* @copyright 2012-2014 Florian Eckerstorfer
* @license http://www.opensource.org/licenses/MIT The MIT License
*/
class SlugifyFacade extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*
* @codeCoverageIgnore
*/
protected static function getFacadeAccessor()
{
return 'slugify';
}
}

View File

@@ -0,0 +1,57 @@
<?php
/**
* This file is part of cocur/slugify.
*
* (c) Florian Eckerstorfer <florian@eckerstorfer.co>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cocur\Slugify\Bridge\Laravel;
use Cocur\Slugify\Slugify;
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
/**
* SlugifyServiceProvider
*
* @package cocur/slugify
* @subpackage bridge
* @author Florian Eckerstorfer <florian@eckerstorfer.co>
* @author Colin Viebrock
* @copyright 2012-2014 Florian Eckerstorfer
* @license http://www.opensource.org/licenses/MIT The MIT License
*/
class SlugifyServiceProvider extends LaravelServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = true;
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app->singleton('slugify', function () {
return new Slugify();
});
}
/**
* Get the services provided by the provider.
*
* @return string[]
*/
public function provides()
{
return ['slugify'];
}
}

View File

@@ -0,0 +1,38 @@
<?php
namespace Cocur\Slugify\Bridge\Latte;
use Cocur\Slugify\SlugifyInterface;
/**
* SlugifyHelper
*
* @package cocur/slugify
* @subpackage bridge
* @author Lukáš Unger <looky.msc@gmail.com>
* @license http://www.opensource.org/licenses/MIT The MIT License
*/
class SlugifyHelper
{
/** @var SlugifyInterface */
private $slugify;
/**
* @codeCoverageIgnore
*/
public function __construct(SlugifyInterface $slugify)
{
$this->slugify = $slugify;
}
/**
* @param string $string
* @param string|null $separator
*
* @return string
*/
public function slugify($string, $separator = null)
{
return $this->slugify->slugify($string, $separator);
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace Cocur\Slugify\Bridge\League;
use Cocur\Slugify\RuleProvider\DefaultRuleProvider;
use Cocur\Slugify\RuleProvider\RuleProviderInterface;
use Cocur\Slugify\Slugify;
use Cocur\Slugify\SlugifyInterface;
use League\Container\ServiceProvider\AbstractServiceProvider;
class SlugifyServiceProvider extends AbstractServiceProvider
{
protected $provides = [
SlugifyInterface::class,
];
public function register()
{
$this->container->share(SlugifyInterface::class, function () {
$options = [];
if ($this->container->has('config.slugify.options')) {
$options = $this->container->get('config.slugify.options');
}
$provider = null;
if ($this->container->has(RuleProviderInterface::class)) {
/* @var RuleProviderInterface $provider */
$provider = $this->container->get(RuleProviderInterface::class);
}
return new Slugify(
$options,
$provider
);
});
}
}

View File

@@ -0,0 +1,49 @@
<?php
namespace Cocur\Slugify\Bridge\Nette;
use Nette\DI\CompilerExtension;
use Nette\DI\ServiceDefinition;
/**
* SlugifyExtension
*
* @package cocur/slugify
* @subpackage bridge
* @author Lukáš Unger <looky.msc@gmail.com>
* @license http://www.opensource.org/licenses/MIT The MIT License
*/
class SlugifyExtension extends CompilerExtension
{
public function loadConfiguration()
{
$builder = $this->getContainerBuilder();
$builder->addDefinition($this->prefix('slugify'))
->setClass('Cocur\Slugify\SlugifyInterface')
->setFactory('Cocur\Slugify\Slugify');
$builder->addDefinition($this->prefix('helper'))
->setClass('Cocur\Slugify\Bridge\Latte\SlugifyHelper')
->setAutowired(false);
}
public function beforeCompile()
{
$builder = $this->getContainerBuilder();
$self = $this;
$registerToLatte = function(ServiceDefinition $def) use ($self) {
$def->addSetup('addFilter', ['slugify', [$self->prefix('@helper'), 'slugify']]);
};
$latteFactory = $builder->getByType('Nette\Bridges\ApplicationLatte\ILatteFactory') ?: 'nette.latteFactory';
if ($builder->hasDefinition($latteFactory)) {
$registerToLatte($builder->getDefinition($latteFactory));
}
if ($builder->hasDefinition('nette.latte')) {
$registerToLatte($builder->getDefinition('nette.latte'));
}
}
}

View File

@@ -0,0 +1,50 @@
<?php
/**
* This file is part of cocur/slugify.
*
* (c) Florian Eckerstorfer <florian@eckerstorfer.co>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cocur\Slugify\Bridge\Plum;
use Plum\Plum\Converter\ConverterInterface;
use Cocur\Slugify\Slugify;
use Cocur\Slugify\SlugifyInterface;
/**
* SlugifyConverter
*
* @package Cocur\Slugify\Bridge\Plum
* @author Florian Eckerstorfer <florian@eckerstorfer.co>
* @copyright 2015 Florian Eckerstorfer
*/
class SlugifyConverter implements ConverterInterface
{
/** @var Slugify */
private $slugify;
/**
* @param SlugifyInterface|null $slugify
*/
public function __construct(SlugifyInterface $slugify = null)
{
if ($slugify === null) {
$slugify = new Slugify();
}
$this->slugify = $slugify;
}
/**
* @param string $item
*
* @return string
*/
public function convert($item)
{
return $this->slugify->slugify($item);
}
}

View File

@@ -0,0 +1,57 @@
<?php
/**
* This file is part of cocur/slugify.
*
* (c) Florian Eckerstorfer <florian@eckerstorfer.co>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cocur\Slugify\Bridge\Silex;
use Cocur\Slugify\Bridge\Twig\SlugifyExtension;
use Cocur\Slugify\Slugify;
use Silex\Application;
use Silex\ServiceProviderInterface;
/**
* SlugifyServiceProvider
*
* @package cocur/slugify
* @subpackage bridge
* @author Florian Eckerstorfer <florian@eckerstorfer.co>
* @copyright 2012-2014 Florian Eckerstorfer
* @license http://www.opensource.org/licenses/MIT The MIT License
*/
class SlugifyServiceProvider implements ServiceProviderInterface
{
/**
* {@inheritDoc}
*/
public function register(Application $app)
{
$app['slugify.options'] = [];
$app['slugify.provider'] = null;
$app['slugify'] = $app->share(function ($app) {
return new Slugify($app['slugify.options'], $app['slugify.provider']);
});
if (isset($app['twig'])) {
$app['twig'] = $app->share($app->extend('twig', function (\Twig_Environment $twig, $app) {
$twig->addExtension(new SlugifyExtension($app['slugify']));
return $twig;
}));
}
}
/**
* {@inheritDoc}
*/
public function boot(Application $app)
{
}
}

View File

@@ -0,0 +1,48 @@
<?php
/**
* This file is part of cocur/slugify.
*
* (c) Florian Eckerstorfer <florian@eckerstorfer.co>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cocur\Slugify\Bridge\Silex2;
use Cocur\Slugify\Bridge\Twig\SlugifyExtension;
use Cocur\Slugify\Slugify;
use Pimple\Container;
use Pimple\ServiceProviderInterface;
/**
* SlugifyServiceProvider
*
* @package cocur/slugify
* @subpackage bridge
* @license http://www.opensource.org/licenses/MIT The MIT License
*/
class SlugifyServiceProvider implements ServiceProviderInterface
{
/**
* {@inheritDoc}
*/
public function register(Container $container)
{
$container['slugify.options'] = [];
$container['slugify.provider'] = null;
$container['slugify'] = function ($container) {
return new Slugify($container['slugify.options'], $container['slugify.provider']);
};
if (isset($container['twig'])) {
$container->extend('twig', function (\Twig_Environment $twig, $container) {
$twig->addExtension(new SlugifyExtension($container['slugify']));
return $twig;
});
}
}
}

View File

@@ -0,0 +1,31 @@
<?php
/**
* This file is part of cocur/slugify.
*
* (c) Florian Eckerstorfer <florian@eckerstorfer.co>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cocur\Slugify\Bridge\Symfony;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* CourSlugifyBundle
*
* @package cocur/slugify
* @subpackage bridge
* @author Florian Eckerstorfer <florian@eckerstorfer.co>
* @copyright 2012-2014 Florian Eckerstorfer
* @license http://www.opensource.org/licenses/MIT The MIT License
*/
class CocurSlugifyBundle extends Bundle
{
public function getContainerExtension()
{
return new CocurSlugifyExtension();
}
}

View File

@@ -0,0 +1,57 @@
<?php
/**
* This file is part of cocur/slugify.
*
* (c) Florian Eckerstorfer <florian@eckerstorfer.co>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cocur\Slugify\Bridge\Symfony;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
/**
* CocurSlugifyExtension
*
* @package cocur/slugify
* @subpackage bridge
* @author Florian Eckerstorfer <florian@eckerstorfer.co>
* @copyright 2012-2014 Florian Eckerstorfer
* @license http://www.opensource.org/licenses/MIT The MIT License
*/
class CocurSlugifyExtension extends Extension
{
/**
* {@inheritDoc}
*
* @param mixed[] $configs
* @param ContainerBuilder $container
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
// Extract slugify arguments from config
$slugifyArguments = array_intersect_key($config, array_flip(['lowercase', 'separator', 'regexp', 'rulesets']));
$container->setDefinition('cocur_slugify', new Definition('Cocur\Slugify\Slugify', [$slugifyArguments]));
$container
->setDefinition(
'cocur_slugify.twig.slugify',
new Definition(
'Cocur\Slugify\Bridge\Twig\SlugifyExtension',
[new Reference('cocur_slugify')]
)
)
->addTag('twig.extension')
->setPublic(false);
$container->setAlias('slugify', 'cocur_slugify');
}
}

View File

@@ -0,0 +1,37 @@
<?php
/*
* This file is part of the cocur/slugify package.
*
* (c) Enrico Stahn <enrico.stahn@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cocur\Slugify\Bridge\Symfony;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
class Configuration implements ConfigurationInterface
{
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('cocur_slugify');
$rootNode
->children()
->booleanNode('lowercase')->defaultTrue()->end()
->scalarNode('separator')->defaultValue('-')->end()
->scalarNode('regexp')->end()
->arrayNode('rulesets')->prototype('scalar')->end()
->end();
return $treeBuilder;
}
}

View File

@@ -0,0 +1,69 @@
<?php
/**
* This file is part of cocur/slugify.
*
* (c) Florian Eckerstorfer <florian@eckerstorfer.co>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cocur\Slugify\Bridge\Twig;
use Cocur\Slugify\SlugifyInterface;
use Twig_SimpleFilter;
/**
* SlugifyExtension
*
* @package cocur/slugify
* @subpackage bridge
* @author Florian Eckerstorfer <florian@eckerstorfer.co>
* @copyright 2012-2015 Florian Eckerstorfer
* @license http://www.opensource.org/licenses/MIT The MIT License
*/
class SlugifyExtension extends \Twig_Extension
{
/**
* @var SlugifyInterface
*/
private $slugify;
/**
* Constructor.
*
* @param SlugifyInterface $slugify
*
* @codeCoverageIgnore
*/
public function __construct(SlugifyInterface $slugify)
{
$this->slugify = $slugify;
}
/**
* Returns the Twig functions of this extension.
*
* @return Twig_SimpleFilter[]
*/
public function getFilters()
{
return [
new Twig_SimpleFilter('slugify', [$this, 'slugifyFilter']),
];
}
/**
* Slugify filter.
*
* @param string $string
* @param string|null $separator
*
* @return string
*/
public function slugifyFilter($string, $separator = null)
{
return $this->slugify->slugify($string, $separator);
}
}

View File

@@ -0,0 +1,50 @@
<?php
namespace Cocur\Slugify\Bridge\ZF2;
use Zend\ModuleManager\Feature\ServiceProviderInterface;
use Zend\ModuleManager\Feature\ViewHelperProviderInterface;
/**
* Class Module
* @package cocur/slugify
* @subpackage bridge
* @license http://www.opensource.org/licenses/MIT The MIT License
*/
class Module implements ServiceProviderInterface, ViewHelperProviderInterface
{
const CONFIG_KEY = 'cocur_slugify';
/**
* Expected to return \Zend\ServiceManager\Config object or array to
* seed such an object.
*
* @return array<string,array<string,string>>
*/
public function getServiceConfig()
{
return [
'factories' => [
'Cocur\Slugify\Slugify' => 'Cocur\Slugify\Bridge\ZF2\SlugifyService'
],
'aliases' => [
'slugify' => 'Cocur\Slugify\Slugify'
]
];
}
/**
* Expected to return \Zend\ServiceManager\Config object or array to
* seed such an object.
*
* @return array<string,array<string,string>>|\Zend\ServiceManager\Config
*/
public function getViewHelperConfig()
{
return [
'factories' => [
'slugify' => 'Cocur\Slugify\Bridge\ZF2\SlugifyViewHelperFactory'
]
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace Cocur\Slugify\Bridge\ZF2;
use Cocur\Slugify\Slugify;
use Zend\ServiceManager\ServiceManager;
/**
* Class SlugifyService
* @package cocur/slugify
* @subpackage bridge
* @license http://www.opensource.org/licenses/MIT The MIT License
*/
class SlugifyService
{
/**
* @param ServiceManager $sm
*
* @return Slugify
*/
public function __invoke($sm)
{
$config = $sm->get('Config');
$options = isset($config[Module::CONFIG_KEY]['options']) ? $config[Module::CONFIG_KEY]['options'] : [];
$provider = isset($config[Module::CONFIG_KEY]['provider']) ? $config[Module::CONFIG_KEY]['provider'] : null;
return new Slugify($options, $provider);
}
}

View File

@@ -0,0 +1,41 @@
<?php
namespace Cocur\Slugify\Bridge\ZF2;
use Cocur\Slugify\SlugifyInterface;
use Zend\View\Helper\AbstractHelper;
/**
* Class SlugifyViewHelper
* @package cocur/slugify
* @subpackage bridge
* @license http://www.opensource.org/licenses/MIT The MIT License
*/
class SlugifyViewHelper extends AbstractHelper
{
/**
* @var SlugifyInterface
*/
protected $slugify;
/**
* @param SlugifyInterface $slugify
*
* @codeCoverageIgnore
*/
public function __construct(SlugifyInterface $slugify)
{
$this->slugify = $slugify;
}
/**
* @param string $string
* @param string|null $separator
*
* @return string
*/
public function __invoke($string, $separator = null)
{
return $this->slugify->slugify($string, $separator);
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace Cocur\Slugify\Bridge\ZF2;
use Cocur\Slugify\Slugify;
use Zend\View\HelperPluginManager;
/**
* Class SlugifyViewHelperFactory
* @package cocur/slugify
* @subpackage bridge
* @license http://www.opensource.org/licenses/MIT The MIT License
*/
class SlugifyViewHelperFactory
{
/**
* @param HelperPluginManager $vhm
*
* @return SlugifyViewHelper
*/
public function __invoke($vhm)
{
/** @var Slugify $slugify */
$slugify = $vhm->getServiceLocator()->get('Cocur\Slugify\Slugify');
return new SlugifyViewHelper($slugify);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,47 @@
<?php
/**
* This file is part of cocur/slugify.
*
* (c) Florian Eckerstorfer <florian@eckerstorfer.co>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cocur\Slugify\RuleProvider;
/**
* FileRuleProvider
*
* @package Cocur\Slugify\RuleProvider
* @author Florian Eckerstorfer
* @copyright 2015 Florian Eckerstorfer
*/
class FileRuleProvider implements RuleProviderInterface
{
/**
* @var string
*/
protected $directoryName;
/**
* @param string $directoryName
*/
public function __construct($directoryName)
{
$this->directoryName = $directoryName;
}
/**
* @param $ruleset
*
* @return array
*/
public function getRules($ruleset)
{
$fileName = $this->directoryName.DIRECTORY_SEPARATOR.$ruleset.'.json';
return json_decode(file_get_contents($fileName), true);
}
}

View File

@@ -0,0 +1,29 @@
<?php
/**
* This file is part of cocur/slugify.
*
* (c) Florian Eckerstorfer <florian@eckerstorfer.co>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cocur\Slugify\RuleProvider;
/**
* RuleProviderInterface
*
* @package Cocur\Slugify\RuleProvider
* @author Florian Eckerstorfer
* @copyright 2015 Florian Eckerstorfer
*/
interface RuleProviderInterface
{
/**
* @param $ruleset
*
* @return array
*/
public function getRules($ruleset);
}

177
vendor/cocur/slugify/src/Slugify.php vendored Normal file
View File

@@ -0,0 +1,177 @@
<?php
/**
* This file is part of cocur/slugify.
*
* (c) Florian Eckerstorfer <florian@eckerstorfer.co>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cocur\Slugify;
use Cocur\Slugify\RuleProvider\DefaultRuleProvider;
use Cocur\Slugify\RuleProvider\RuleProviderInterface;
/**
* Slugify
*
* @package Cocur\Slugify
* @author Florian Eckerstorfer <florian@eckerstorfer.co>
* @author Ivo Bathke <ivo.bathke@gmail.com>
* @author Marchenko Alexandr
* @copyright 2012-2015 Florian Eckerstorfer
* @license http://www.opensource.org/licenses/MIT The MIT License
*/
class Slugify implements SlugifyInterface
{
const LOWERCASE_NUMBERS_DASHES = '/([^A-Za-z0-9]|-)+/';
/**
* @var array<string,string>
*/
protected $rules = [];
/**
* @var RuleProviderInterface
*/
protected $provider;
/**
* @var array<string,mixed>
*/
protected $options = [
'regexp' => self::LOWERCASE_NUMBERS_DASHES,
'separator' => '-',
'lowercase' => true,
'rulesets' => [
'default',
// Languages are preferred if they appear later, list is ordered by number of
// websites in that language
// https://en.wikipedia.org/wiki/Languages_used_on_the_Internet#Content_languages_for_websites
'azerbaijani',
'burmese',
'hindi',
'georgian',
'norwegian',
'vietnamese',
'ukrainian',
'latvian',
'finnish',
'greek',
'czech',
'arabic',
'turkish',
'polish',
'german',
'russian',
'romanian'
],
];
/**
* @param array $options
* @param RuleProviderInterface $provider
*/
public function __construct(array $options = [], RuleProviderInterface $provider = null)
{
$this->options = array_merge($this->options, $options);
$this->provider = $provider ? $provider : new DefaultRuleProvider();
foreach ($this->options['rulesets'] as $ruleSet) {
$this->activateRuleSet($ruleSet);
}
}
/**
* Returns the slug-version of the string.
*
* @param string $string String to slugify
* @param string|array|null $options Options
*
* @return string Slugified version of the string
*/
public function slugify($string, $options = null)
{
// BC: the second argument used to be the separator
if (is_string($options)) {
$separator = $options;
$options = [];
$options['separator'] = $separator;
}
$options = array_merge($this->options, (array) $options);
// Add a custom ruleset without touching the default rules
if (isset($options['ruleset'])) {
$rules = array_merge($this->rules, $this->provider->getRules($options['ruleset']));
} else {
$rules = $this->rules;
}
$string = strtr($string, $rules);
unset($rules);
if ($options['lowercase']) {
$string = mb_strtolower($string);
}
$string = preg_replace($options['regexp'], $options['separator'], $string);
return trim($string, $options['separator']);
}
/**
* Adds a custom rule to Slugify.
*
* @param string $character Character
* @param string $replacement Replacement character
*
* @return Slugify
*/
public function addRule($character, $replacement)
{
$this->rules[$character] = $replacement;
return $this;
}
/**
* Adds multiple rules to Slugify.
*
* @param array <string,string> $rules
*
* @return Slugify
*/
public function addRules(array $rules)
{
foreach ($rules as $character => $replacement) {
$this->addRule($character, $replacement);
}
return $this;
}
/**
* @param string $ruleSet
*
* @return Slugify
*/
public function activateRuleSet($ruleSet)
{
return $this->addRules($this->provider->getRules($ruleSet));
}
/**
* Static method to create new instance of {@see Slugify}.
*
* @param array <string,mixed> $options
*
* @return Slugify
*/
public static function create(array $options = [])
{
return new static($options);
}
}

View File

@@ -0,0 +1,36 @@
<?php
/**
* This file is part of cocur/slugify.
*
* (c) Florian Eckerstorfer <florian@eckerstorfer.co>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cocur\Slugify;
/**
* SlugifyInterface
*
* @package org.cocur.slugify
* @author Florian Eckerstorfer <florian@eckerstorfer.co>
* @author Marchenko Alexandr
* @copyright 2012-2014 Florian Eckerstorfer
* @license http://www.opensource.org/licenses/MIT The MIT License
*/
interface SlugifyInterface
{
/**
* Return a URL safe version of a string.
*
* @param string $string
* @param string|array|null $options
*
* @return string
*
* @api
*/
public function slugify($string, $options = null);
}

View File

@@ -0,0 +1,66 @@
<?php
/**
* This file is part of cocur/slugify.
*
* (c) Florian Eckerstorfer <florian@eckerstorfer.co>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cocur\Slugify\Tests\Bridge\Laravel;
use Cocur\Slugify\Bridge\Laravel\SlugifyServiceProvider;
use Illuminate\Foundation\Application;
/**
* SlugifyServiceProviderTest
*
* @category test
* @package cocur/slugify
* @subpackage bridge
* @author Florian Eckerstorfer <florian@eckerstorfer.co>
* @author Colin Viebrock
* @copyright 2012-2014 Florian Eckerstorfer
* @license http://www.opensource.org/licenses/MIT The MIT License
* @group unit
*/
class SlugifyProviderTest extends \PHPUnit_Framework_TestCase
{
/** @var Application */
private $app;
/** @var SlugifyServiceProvider */
private $provider;
protected function setUp()
{
$this->app = new Application();
$this->provider = new SlugifyServiceProvider($this->app);
}
/**
* @test
* @covers Cocur\Slugify\Bridge\Laravel\SlugifyServiceProvider::register()
*/
public function registerRegistersTheServiceProvider()
{
$this->provider->register();
// the service provider is deferred, so this forces it to load
$this->app->make('slugify');
$this->assertArrayHasKey('slugify', $this->app);
$this->assertInstanceOf('Cocur\Slugify\Slugify', $this->app['slugify']);
}
/**
* @test
* @covers Cocur\Slugify\Bridge\Laravel\SlugifyServiceProvider::provides()
*/
public function containsReturnsTheNameOfThProvider()
{
$this->assertContains('slugify', $this->provider->provides());
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace Cocur\Slugify\Tests\Bridge\Latte;
use Cocur\Slugify\Bridge\Latte\SlugifyHelper;
use Mockery as m;
/**
* SlugifyHelperTest
*
* @category test
* @package cocur/slugify
* @subpackage bridge
* @author Lukáš Unger <looky.msc@gmail.com>
* @license http://www.opensource.org/licenses/MIT The MIT License
* @group unit
*/
class SlugifyHelperTest extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
$this->slugify = m::mock('Cocur\Slugify\SlugifyInterface');
$this->helper = new SlugifyHelper($this->slugify);
}
/**
* @test
* @covers Cocur\Slugify\Bridge\Latte\SlugifyHelper::slugify()
*/
public function slugify()
{
$this->slugify->shouldReceive('slugify')->with('hällo wörld', '_')->once()->andReturn('haello_woerld');
$this->assertEquals('haello_woerld', $this->helper->slugify('hällo wörld', '_'));
}
}

View File

@@ -0,0 +1,85 @@
<?php
namespace Cocur\Slugify\Tests\Bridge\League;
use Cocur\Slugify\Bridge\League\SlugifyServiceProvider;
use Cocur\Slugify\RuleProvider\DefaultRuleProvider;
use Cocur\Slugify\RuleProvider\RuleProviderInterface;
use Cocur\Slugify\SlugifyInterface;
use League\Container\Container;
use Mockery as m;
class SlugifyServiceProviderTest extends \PHPUnit_Framework_TestCase
{
public function testProvidesSlugify()
{
$container = new Container();
$container->addServiceProvider(new SlugifyServiceProvider());
$slugify = $container->get(SlugifyInterface::class);
$this->assertInstanceOf(SlugifyInterface::class, $slugify);
$this->assertAttributeInstanceOf(DefaultRuleProvider::class, 'provider', $slugify);
}
public function testProvidesSlugifyAsSharedService()
{
$container = new Container();
$container->addServiceProvider(new SlugifyServiceProvider());
$slugify = $container->get(SlugifyInterface::class);
$this->assertSame($slugify, $container->get(SlugifyInterface::class));
}
public function testProvidesSlugifyUsingSharedConfigurationOptions()
{
$container = new Container();
$options = [
'lowercase' => false,
];
$container->share('config.slugify.options', $options);
$container->addServiceProvider(new SlugifyServiceProvider());
/* @var SlugifyInterface $slugify */
$slugify = $container->get(SlugifyInterface::class);
$slug = 'Foo-Bar-Baz';
$this->assertSame($slug, $slugify->slugify($slug));
}
public function testProvidesSlugifyUsingSharedProvider()
{
$container = new Container();
$ruleProvider = $this->getRuleProviderMock();
$container->share(RuleProviderInterface::class, $ruleProvider);
$container->addServiceProvider(new SlugifyServiceProvider());
$slugify = $container->get(SlugifyInterface::class);
$this->assertAttributeSame($ruleProvider, 'provider', $slugify);
}
/**
* @return m\Mock|RuleProviderInterface
*/
private function getRuleProviderMock()
{
$ruleProvider = m::mock(RuleProviderInterface::class);
$ruleProvider
->shouldReceive('getRules')
->withAnyArgs()
->andReturn([])
;
return $ruleProvider;
}
}

View File

@@ -0,0 +1,133 @@
<?php
namespace Cocur\Slugify\Tests\Bridge\Nette;
use Cocur\Slugify\Bridge\Nette\SlugifyExtension;
use Mockery as m;
/**
* SlugifyExtensionTest
*
* @category test
* @package cocur/slugify
* @subpackage bridge
* @author Lukáš Unger <looky.msc@gmail.com>
* @license http://www.opensource.org/licenses/MIT The MIT License
* @group unit
*/
class SlugifyExtensionTest extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
$this->extension = new SlugifyExtension();
}
/**
* @test
* @covers Cocur\Slugify\Bridge\Nette\SlugifyExtension::loadConfiguration()
*/
public function loadConfiguration()
{
$slugify = m::mock('Nette\DI\ServiceDefinition');
$slugify
->shouldReceive('setClass')
->with('Cocur\Slugify\SlugifyInterface')
->once()
->andReturn($slugify);
$slugify
->shouldReceive('setFactory')
->with('Cocur\Slugify\Slugify')
->once()
->andReturn($slugify);
$helper = m::mock('Nette\DI\ServiceDefinition');
$helper
->shouldReceive('setClass')
->with('Cocur\Slugify\Bridge\Latte\SlugifyHelper')
->once()
->andReturn($helper);
$helper
->shouldReceive('setAutowired')
->with(false)
->once()
->andReturn($helper);
$builder = m::mock('Nette\DI\ContainerBuilder');
$builder
->shouldReceive('addDefinition')
->with('slugify.slugify')
->once()
->andReturn($slugify);
$builder
->shouldReceive('addDefinition')
->with('slugify.helper')
->once()
->andReturn($helper);
$compiler = m::mock('Nette\DI\Compiler');
$compiler
->shouldReceive('getContainerBuilder')
->once()
->andReturn($builder);
$this->extension->setCompiler($compiler, 'slugify');
$this->extension->loadConfiguration();
}
/**
* @test
* @covers Cocur\Slugify\Bridge\Nette\SlugifyExtension::beforeCompile()
*/
public function beforeCompile()
{
$latteFactory = m::mock('Nette\DI\ServiceDefinition');
$latteFactory
->shouldReceive('addSetup')
->with('addFilter', ['slugify', ['@slugify.helper', 'slugify']])
->once()
->andReturn($latteFactory);
$latte = m::mock('Nette\DI\ServiceDefinition');
$latte
->shouldReceive('addSetup')
->with('addFilter', ['slugify', ['@slugify.helper', 'slugify']])
->once()
->andReturn($latte);
$builder = m::mock('Nette\DI\ContainerBuilder');
$builder
->shouldReceive('getByType')
->with('Nette\Bridges\ApplicationLatte\ILatteFactory')
->once()
->andReturn('latte.latteFactory');
$builder
->shouldReceive('hasDefinition')
->with('latte.latteFactory')
->once()
->andReturn(true);
$builder
->shouldReceive('getDefinition')
->with('latte.latteFactory')
->once()
->andReturn($latteFactory);
$builder
->shouldReceive('hasDefinition')
->with('nette.latte')
->once()
->andReturn(true);
$builder
->shouldReceive('getDefinition')
->with('nette.latte')
->once()
->andReturn($latte);
$compiler = m::mock('Nette\DI\Compiler');
$compiler
->shouldReceive('getContainerBuilder')
->once()
->andReturn($builder);
$this->extension->setCompiler($compiler, 'slugify');
$this->extension->beforeCompile();
}
}

View File

@@ -0,0 +1,53 @@
<?php
/**
* This file is part of cocur/slugify.
*
* (c) Florian Eckerstorfer <florian@eckerstorfer.co>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cocur\Slugify\Tests\Bridge\Plum;
use Cocur\Slugify\Bridge\Plum\SlugifyConverter;
use Mockery;
use PHPUnit_Framework_TestCase;
/**
* SlugifyConverterTest
*
* @package Cocur\Slugify\Bridge\Plum
* @author Florian Eckerstorfer <florian@eckerstorfer.co>
* @copyright 2012-2015 Florian Eckerstorfer
* @group unit
*/
class SlugifyConverterTest extends PHPUnit_Framework_TestCase
{
/**
* @test
* @covers Cocur\Slugify\Bridge\Plum\SlugifyConverter::__construct()
* @covers Cocur\Slugify\Bridge\Plum\SlugifyConverter::convert()
*/
public function convertSlugifiesString()
{
$slugify = Mockery::mock('Cocur\Slugify\SlugifyInterface');
$slugify->shouldReceive('slugify')->with('Hello World')->once()->andReturn('hello_world');
$converter = new SlugifyConverter($slugify);
$this->assertSame('hello_world', $converter->convert('Hello World'));
}
/**
* @test
* @covers Cocur\Slugify\Bridge\Plum\SlugifyConverter::__construct()
* @covers Cocur\Slugify\Bridge\Plum\SlugifyConverter::convert()
*/
public function constructorCreatesSlugifyIfNoneIsProvided()
{
$converter = new SlugifyConverter();
$this->assertSame('hello-world', $converter->convert('Hello World'));
}
}

View File

@@ -0,0 +1,60 @@
<?php
/**
* This file is part of cocur/slugify.
*
* (c) Florian Eckerstorfer <florian@eckerstorfer.co>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cocur\Slugify\Tests\Bridge\Silex;
use Cocur\Slugify\Bridge\Silex\SlugifyServiceProvider;
use Cocur\Slugify\Bridge\Twig\SlugifyExtension;
use Silex\Application;
use Silex\Provider\TwigServiceProvider;
/**
* SlugifyServiceProviderTest
*
* @category test
* @package cocur/slugify
* @subpackage bridge
* @author Florian Eckerstorfer <florian@eckerstorfer.co>
* @copyright 2012-2014 Florian Eckerstorfer
* @license http://www.opensource.org/licenses/MIT The MIT License
* @group unit
*/
class SlugifySilexProviderTest extends \PHPUnit_Framework_TestCase
{
/**
* @test
* @covers Cocur\Slugify\Bridge\Silex\SlugifyServiceProvider
*/
public function register()
{
// it seems like Application is not mockable.
$app = new Application();
$app->register(new SlugifyServiceProvider());
$app->boot();
$this->assertArrayHasKey('slugify', $app);
$this->assertArrayHasKey('slugify.provider', $app);
$this->assertArrayHasKey('slugify.options', $app);
$this->assertInstanceOf('Cocur\Slugify\Slugify', $app['slugify']);
}
/**
* @test
*/
public function registerWithTwig()
{
$app = new Application();
$app->register(new TwigServiceProvider());
$app->register(new SlugifyServiceProvider());
$this->assertTrue($app['twig']->hasExtension(SlugifyExtension::class));
}
}

View File

@@ -0,0 +1,40 @@
<?php
/**
* This file is part of cocur/slugify.
*
* (c) Florian Eckerstorfer <florian@eckerstorfer.co>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cocur\Slugify\Tests\Bridge\Symfony;
use Cocur\Slugify\Bridge\Symfony\CocurSlugifyBundle;
use Cocur\Slugify\Bridge\Symfony\CocurSlugifyExtension;
/**
* CocurSlugifyBundleTest
*
* @category test
* @package cocur/slugify
* @subpackage bridge
* @author Florian Eckerstorfer <florian@eckerstorfer.co>
* @copyright 2012-2014 Florian Eckerstorfer
* @license http://www.opensource.org/licenses/MIT The MIT License
* @group unit
*/
class CocurSlugifyBundleTest extends \PHPUnit_Framework_TestCase
{
/**
* @covers Cocur\Slugify\Bridge\Symfony\CocurSlugifyBundle::getContainerExtension()
*/
public function testGetContainerExtension()
{
$bundle = new CocurSlugifyBundle();
static::assertInstanceOf(CocurSlugifyExtension::class, $bundle->getContainerExtension());
}
}

View File

@@ -0,0 +1,70 @@
<?php
/**
* This file is part of cocur/slugify.
*
* (c) Florian Eckerstorfer <florian@eckerstorfer.co>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cocur\Slugify\Tests\Bridge\Symfony;
use Cocur\Slugify\Bridge\Symfony\CocurSlugifyExtension;
use Mockery as m;
/**
* CocurSlugifyExtensionTest
*
* @category test
* @package cocur/slugify
* @subpackage bridge
* @author Florian Eckerstorfer <florian@eckerstorfer.co>
* @copyright 2012-2014 Florian Eckerstorfer
* @license http://www.opensource.org/licenses/MIT The MIT License
* @group unit
*/
class CocurSlugifyExtensionTest extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
$this->extension = new CocurSlugifyExtension();
}
/**
* @test
* @covers Cocur\Slugify\Bridge\Symfony\CocurSlugifyExtension::load()
*/
public function load()
{
$twigDefinition = m::mock('Symfony\Component\DependencyInjection\Definition');
$twigDefinition
->shouldReceive('addTag')
->with('twig.extension')
->once()
->andReturn($twigDefinition);
$twigDefinition
->shouldReceive('setPublic')
->with(false)
->once();
$container = m::mock('Symfony\Component\DependencyInjection\ContainerBuilder');
$container
->shouldReceive('setDefinition')
->with('cocur_slugify', m::type('Symfony\Component\DependencyInjection\Definition'))
->once();
$container
->shouldReceive('setDefinition')
->with('cocur_slugify.twig.slugify', m::type('Symfony\Component\DependencyInjection\Definition'))
->once()
->andReturn($twigDefinition);
$container
->shouldReceive('setAlias')
->with('slugify', 'cocur_slugify')
->once();
$this->extension->load([], $container);
}
}

View File

@@ -0,0 +1,55 @@
<?php
/*
* This file is part of the cocur/slugify package.
*
* (c) Enrico Stahn <enrico.stahn@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cocur\Slugify\Tests\Bridge\Symfony;
use Cocur\Slugify\Bridge\Symfony\Configuration;
use Symfony\Component\Config\Definition\Processor;
class ConfigurationTest extends \PHPUnit_Framework_TestCase
{
public function testAll()
{
$configs = [
[
'lowercase' => true,
'separator' => '_',
'regexp' => 'abcd',
'rulesets' => ['burmese', 'hindi']
],
];
$this->process($configs);
}
/**
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidTypeException
*/
public function testLowercaseOnlyAcceptsBoolean()
{
$configs = [['lowercase' => 'abc']];
$this->process($configs);
}
/**
* Processes an array of configurations and returns a compiled version.
*
* @param array $configs An array of raw configurations
*
* @return array A normalized array
*/
protected function process($configs)
{
$processor = new Processor();
return $processor->processConfiguration(new Configuration(), $configs);
}
}

View File

@@ -0,0 +1,69 @@
<?php
/**
* This file is part of cocur/slugify.
*
* (c) Florian Eckerstorfer <florian@eckerstorfer.co>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cocur\Slugify\Tests\Bridge\Twig;
use Cocur\Slugify\Bridge\Twig\SlugifyExtension;
use Mockery as m;
/**
* SlugifyExtensionTest
*
* @category test
* @package cocur/slugify
* @subpackage bridge
* @author Florian Eckerstorfer <florian@eckerstorfer.co>
* @copyright 2012-2014 Florian Eckerstorfer
* @license http://www.opensource.org/licenses/MIT The MIT License
* @group unit
*/
class SlugifyExtensionTest extends \PHPUnit_Framework_TestCase
{
/**
* @var \Cocur\Slugify\SlugifyInterface|\Mockery\MockInterface
*/
protected $slugify;
/**
* @var SlugifyExtension
*/
protected $extension;
protected function setUp()
{
$this->slugify = m::mock('Cocur\Slugify\SlugifyInterface');
$this->extension = new SlugifyExtension($this->slugify);
}
/**
* @test
* @covers Cocur\Slugify\Bridge\Twig\SlugifyExtension::getFilters()
*/
public function getFilters()
{
$filters = $this->extension->getFilters();
$this->assertCount(1, $filters);
$this->assertInstanceOf('\Twig_SimpleFilter', $filters[0]);
}
/**
* @test
* @covers Cocur\Slugify\Bridge\Twig\SlugifyExtension::slugifyFilter()
*/
public function slugifyFilter()
{
$this->slugify->shouldReceive('slugify')->with('hällo wörld', '_')->once()->andReturn('haello_woerld');
$this->assertEquals('haello_woerld', $this->extension->slugifyFilter('hällo wörld', '_'));
}
}

View File

@@ -0,0 +1,49 @@
<?php
namespace Cocur\Slugify\Tests\Bridge\ZF2;
use Cocur\Slugify\Bridge\ZF2\Module;
/**
* Class ModuleTest
* @package cocur/slugify
* @subpackage bridge
* @license http://www.opensource.org/licenses/MIT The MIT License
*/
class ModuleTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Module
*/
private $module;
protected function setUp()
{
$this->module = new Module();
}
/**
* @test
* @covers Cocur\Slugify\Bridge\ZF2\Module::getServiceConfig()
*/
public function getServiceConfig()
{
$smConfig = $this->module->getServiceConfig();
$this->assertTrue(is_array($smConfig));
$this->assertArrayHasKey('factories', $smConfig);
$this->assertArrayHasKey('Cocur\Slugify\Slugify', $smConfig['factories']);
$this->assertArrayHasKey('aliases', $smConfig);
$this->assertArrayHasKey('slugify', $smConfig['aliases']);
}
/**
* @test
* @covers Cocur\Slugify\Bridge\ZF2\Module::getViewHelperConfig()
*/
public function getViewHelperConfig()
{
$vhConfig = $this->module->getViewHelperConfig();
$this->assertTrue(is_array($vhConfig));
$this->assertArrayHasKey('factories', $vhConfig);
$this->assertArrayHasKey('slugify', $vhConfig['factories']);
}
}

View File

@@ -0,0 +1,69 @@
<?php
namespace Cocur\Slugify\Tests\Bridge\ZF2;
use Cocur\Slugify\Bridge\ZF2\Module;
use Cocur\Slugify\Bridge\ZF2\SlugifyService;
use Zend\ServiceManager\ServiceManager;
/**
* Class SlugifyServiceTest
* @package cocur/slugify
* @subpackage bridge
* @license http://www.opensource.org/licenses/MIT The MIT License
*/
class SlugifyServiceTest extends \PHPUnit_Framework_TestCase
{
/**
* @var SlugifyService
*/
private $slugifyService;
protected function setUp()
{
$this->slugifyService = new SlugifyService();
}
/**
* @test
* @covers Cocur\Slugify\Bridge\ZF2\SlugifyService::__invoke()
*/
public function invokeWithoutCustomConfig()
{
$sm = $this->createServiceManagerMock();
$slugify = call_user_func($this->slugifyService, $sm);
$this->assertInstanceOf('Cocur\Slugify\Slugify', $slugify);
// Make sure reg exp is default one
$actual = 'Hello My Friend.zip';
$expected = 'hello-my-friend-zip';
$this->assertEquals($expected, $slugify->slugify($actual));
}
/**
* @test
* @covers Cocur\Slugify\Bridge\ZF2\SlugifyService::__invoke()
*/
public function invokeWithCustomConfig()
{
$sm = $this->createServiceManagerMock([
Module::CONFIG_KEY => [
'options' => ['regexp' => '/([^a-z0-9.]|-)+/']
]
]);
$slugify = call_user_func($this->slugifyService, $sm);
$this->assertInstanceOf('Cocur\Slugify\Slugify', $slugify);
// Make sure reg exp is the one provided and dots are kept
$actual = 'Hello My Friend.zip';
$expected = 'hello-my-friend.zip';
$this->assertEquals($expected, $slugify->slugify($actual));
}
protected function createServiceManagerMock(array $config = [])
{
$sm = new ServiceManager();
$sm->setService('Config', $config);
return $sm;
}
}

View File

@@ -0,0 +1,41 @@
<?php
namespace Cocur\Slugify\Tests\Bridge\ZF2;
use Cocur\Slugify\Bridge\ZF2\SlugifyViewHelperFactory;
use Cocur\Slugify\Slugify;
use Zend\ServiceManager\ServiceManager;
use Zend\View\HelperPluginManager;
/**
* Class SlugifyViewHelperFactoryTest
* @package cocur/slugify
* @subpackage bridge
* @license http://www.opensource.org/licenses/MIT The MIT License
*/
class SlugifyViewHelperFactoryTest extends \PHPUnit_Framework_TestCase
{
/**
* @var SlugifyViewHelperFactory
*/
private $factory;
protected function setUp()
{
$this->factory = new SlugifyViewHelperFactory();
}
/**
* @test
* @covers Cocur\Slugify\Bridge\ZF2\SlugifyViewHelperFactory::__invoke()
*/
public function createService()
{
$sm = new ServiceManager();
$sm->setService('Cocur\Slugify\Slugify', new Slugify());
$vhm = new HelperPluginManager();
$vhm->setServiceLocator($sm);
$viewHelper = call_user_func($this->factory, $vhm);
$this->assertInstanceOf('Cocur\Slugify\Bridge\ZF2\SlugifyViewHelper', $viewHelper);
}
}

View File

@@ -0,0 +1,46 @@
<?php
namespace Cocur\Slugify\Tests\Bridge\ZF2;
use Cocur\Slugify\Bridge\ZF2\SlugifyViewHelper;
use Cocur\Slugify\Slugify;
/**
* Class SlugifyViewHelperTest
* @package cocur/slugify
* @subpackage bridge
* @license http://www.opensource.org/licenses/MIT The MIT License
*/
class SlugifyViewHelperTest extends \PHPUnit_Framework_TestCase
{
/**
* @var SlugifyViewHelper
*/
private $viewHelper;
/**
* @var Slugify
*/
private $slugify;
/**
* @covers Cocur\Slugify\Bridge\ZF2\SlugifyViewHelper::__construct()
*/
protected function setUp()
{
$this->slugify = new Slugify();
$this->viewHelper = new SlugifyViewHelper($this->slugify);
}
/**
* @test
* @covers Cocur\Slugify\Bridge\ZF2\SlugifyViewHelper::__invoke()
*/
public function invoke()
{
$actual = 'Hällo Wörld';
$expected = call_user_func($this->viewHelper, $actual);
$this->assertEquals($expected, $this->slugify->slugify($actual));
$expected = call_user_func($this->viewHelper, $actual, '_');
$this->assertEquals($expected, $this->slugify->slugify($actual, '_'));
}
}

View File

@@ -0,0 +1,45 @@
<?php
/**
* This file is part of cocur/slugify.
*
* (c) Florian Eckerstorfer <florian@eckerstorfer.co>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cocur\Slugify\Tests\RuleProvider;
use Cocur\Slugify\RuleProvider\FileRuleProvider;
use org\bovigo\vfs\vfsStream;
use PHPUnit_Framework_TestCase;
/**
* FileRuleProviderTest
*
* @package Cocur\Slugify\RuleProvider
* @author Florian Eckerstorfer
* @copyright 2015 Florian Eckerstorfer
* @group unit
*/
class FileRuleProviderTest extends PHPUnit_Framework_TestCase
{
/**
* @test
* @covers Cocur\Slugify\RuleProvider\FileRuleProvider::__construct()
* @covers Cocur\Slugify\RuleProvider\FileRuleProvider::getRules()
*/
public function getRulesReturnsRulesReadFromJsonFile()
{
vfsStream::setup('fixtures', null, [
'german.json' => '{"ä": "a"}',
'austrian.json' => '{"ß": "sz"}',
]);
$provider = new FileRuleProvider(vfsStream::url('fixtures'));
$this->assertEquals(['ä' => 'a'], $provider->getRules('german'));
$this->assertEquals(['ß' => 'sz'], $provider->getRules('austrian'));
}
}

View File

@@ -0,0 +1,263 @@
<?php
/**
* This file is part of cocur/slugify.
*
* (c) Florian Eckerstorfer <florian@eckerstorfer.co>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cocur\Slugify\Tests;
use Cocur\Slugify\Slugify;
use Mockery;
/**
* SlugifyTest
*
* @category test
* @package org.cocur.slugify
* @author Florian Eckerstorfer <florian@eckerstorfer.co>
* @author Ivo Bathke <ivo.bathke@gmail.com>
* @author Marchenko Alexandr
* @copyright 2012-2014 Florian Eckerstorfer
* @license http://www.opensource.org/licenses/MIT The MIT License
*/
class SlugifyTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Slugify
*/
private $slugify;
/**
* @var \Cocur\Slugify\RuleProvider\RuleProviderInterface|\Mockery\MockInterface
*/
private $provider;
protected function setUp()
{
$this->provider = Mockery::mock('\Cocur\Slugify\RuleProvider\RuleProviderInterface');
$this->provider->shouldReceive('getRules')->andReturn([]);
$this->slugify = new Slugify([], $this->provider);
}
/**
* @test
* @dataProvider defaultRuleProvider
* @covers Cocur\Slugify\Slugify::slugify()
*/
public function slugifyReturnsSlugifiedStringUsingDefaultProvider($string, $result)
{
$slugify = new Slugify();
$this->assertEquals($result, $slugify->slugify($string));
}
/**
* @test
* @covers Cocur\Slugify\Slugify::addRule()
* @covers Cocur\Slugify\Slugify::slugify()
*/
public function addRuleAddsRule()
{
$this->assertInstanceOf(
'Cocur\Slugify\Slugify',
$this->slugify->addRule('X', 'y')
);
$this->assertEquals('y', $this->slugify->slugify('X'));
}
/**
* @test
* @covers Cocur\Slugify\Slugify::addRules()
* @covers Cocur\Slugify\Slugify::slugify()
*/
public function addRulesAddsMultipleRules()
{
$this->assertInstanceOf(
'Cocur\Slugify\Slugify',
$this->slugify->addRules(['x' => 'y', 'a' => 'b'])
);
$this->assertEquals('yb', $this->slugify->slugify('xa'));
}
/**
* @test
* @covers Cocur\Slugify\Slugify::activateRuleset()
*/
public function activateRulesetActivatesTheGivenRuleset()
{
$provider = Mockery::mock('\Cocur\Slugify\RuleProvider\RuleProviderInterface');
$provider->shouldReceive('getRules')->with('esperanto')->once()->andReturn(['ĉ' => 'cx']);
$slugify = new Slugify(['rulesets' => []], $provider);
$this->assertInstanceOf(
'Cocur\Slugify\Slugify',
$slugify->activateRuleset('esperanto')
);
$this->assertEquals('sercxi', $slugify->slugify('serĉi'));
}
/**
* @test
* @covers Cocur\Slugify\Slugify::create()
*/
public function createReturnsAnInstance()
{
$this->assertInstanceOf('Cocur\\Slugify\\SlugifyInterface', Slugify::create());
}
/**
* @test
* @covers Cocur\Slugify\Slugify::__construct()
*/
public function constructWithOtherRegexp()
{
$this->slugify = new Slugify(['regexp' => '/([^a-z0-9.]|-)+/']);
$this->assertEquals('file-name.tar.gz', $this->slugify->slugify('File Name.tar.gz'));
}
/**
* @test
* @covers Cocur\Slugify\Slugify::__construct()
* @covers Cocur\Slugify\Slugify::slugify()
*/
public function doNotConvertToLowercase()
{
$actual = 'File Name';
$expected = 'File-Name';
$this->slugify = new Slugify(['lowercase' => false]);
$this->assertEquals($expected, $this->slugify->slugify($actual));
}
/**
* @test
* @dataProvider customRulesProvider
*/
public function customRules($rule, $string, $result)
{
$slugify = new Slugify();
$slugify->activateRuleSet($rule);
$this->assertSame($result, $slugify->slugify($string));
}
public function customRulesProvider()
{
return [
['azerbaijani', 'əöüğşçı', 'eougsci'],
['azerbaijani', 'Fərhad Səfərov', 'ferhad-seferov'],
['croatian', 'Č Ć Ž Š Đ č ć ž š đ', 'c-c-z-s-dj-c-c-z-s-dj'],
['danish', 'Æ æ Ø ø Å å É é', 'ae-ae-oe-oe-aa-aa-e-e'],
['romanian', 'ă î â ş ș ţ ț Ă Î Â Ş Ș Ţ Ț', 'a-i-a-s-s-t-t-a-i-a-s-s-t-t'],
['serbian', 'А Б В Г Д Ђ Е Ж З И Ј К Л Љ М Н Њ О П Р С Т Ћ У Ф Х Ц Ч Џ Ш а б в г д ђ е ж з и ј к л љ м н њ о п р с т ћ у ф х ц ч џ ш Š Đ Ž Ć Č š đ ž ć č', 'a-b-v-g-d-dj-e-z-z-i-j-k-l-lj-m-n-nj-o-p-r-s-t-c-u-f-h-c-c-dz-s-a-b-v-g-d-dj-e-z-z-i-j-k-l-lj-m-n-nj-o-p-r-s-t-c-u-f-h-c-c-dz-s-s-dj-z-c-c-s-dj-z-c-c'],
['lithuanian', 'Ą Č Ę Ė Į Š Ų Ū Ž ą č ę ė į š ų ū ž', 'a-c-e-e-i-s-u-u-z-a-c-e-e-i-s-u-u-z'],
['estonian', 'Š Ž Õ Ä Ö Ü š ž õ ä ö ü', 's-z-o-a-o-u-s-z-o-a-o-u'],
];
}
/**
* @test
* @covers Cocur\Slugify\Slugify::__construct()
* @covers Cocur\Slugify\Slugify::slugify()
*/
public function slugifyDefaultsToSeparatorOption()
{
$actual = 'file name';
$expected = 'file__name';
$this->slugify = new Slugify(['separator' => '__']);
$this->assertEquals($expected, $this->slugify->slugify($actual));
}
/**
* @test
* @covers Cocur\Slugify\Slugify::__construct()
* @covers Cocur\Slugify\Slugify::slugify()
*/
public function slugifyHonorsSeparatorArgument()
{
$actual = 'file name';
$expected = 'file__name';
$this->slugify = new Slugify(['separator' => 'dummy']);
$this->assertEquals($expected, $this->slugify->slugify($actual, '__'));
}
/**
* @test
* @covers Cocur\Slugify\Slugify::slugify()
*/
public function slugifyOptionsArray()
{
$this->assertEquals('file-name', $this->slugify->slugify('file name'));
$this->assertEquals('file+name', $this->slugify->slugify('file name', ['separator' => '+']));
$this->assertEquals('name-1', $this->slugify->slugify('name(1)'));
$this->assertEquals('name(1)', $this->slugify->slugify('name(1)', ['regexp' => '/([^a-z0-9.()]|-)+/']));
$this->assertEquals('file-name', $this->slugify->slugify('FILE NAME'));
$this->assertEquals('FILE-NAME', $this->slugify->slugify('FILE NAME', ['lowercase' => false]));
}
/**
* @test
* @covers Cocur\Slugify\Slugify::slugify()
*/
public function slugifyCustomRuleSet()
{
$slugify = new Slugify();
$this->assertSame('fur', $slugify->slugify('für', ['ruleset' => 'turkish']));
$this->assertSame('fuer', $slugify->slugify('für'));
}
public function defaultRuleProvider()
{
return [
[' a b ', 'a-b'],
['Hello', 'hello'],
['Hello World', 'hello-world'],
['Привет мир', 'privet-mir'],
['Привіт світ', 'privit-svit'],
['Hello: World', 'hello-world'],
['H+e#l1l--o/W§o r.l:d)', 'h-e-l1l-o-w-o-r-l-d'],
[': World', 'world'],
['Hello World!', 'hello-world'],
['Ä ä Ö ö Ü ü ß', 'ae-ae-oe-oe-ue-ue-ss'],
['Á À á à É È é è Ó Ò ó ò Ñ ñ Ú Ù ú ù', 'a-a-a-a-e-e-e-e-o-o-o-o-n-n-u-u-u-u'],
['Â â Ê ê Ô ô Û û', 'a-a-e-e-o-o-u-u'],
['Â â Ê ê Ô ô Û 1', 'a-a-e-e-o-o-u-1'],
['°¹²³⁴⁵⁶⁷⁸⁹@₀₁₂₃₄₅₆₇₈₉', '0123456789at0123456789'],
['Mórë thån wørds', 'more-thaan-woerds'],
['Блоґ їжачка', 'blog-jizhachka'],
['фильм', 'film'],
['драма', 'drama'],
['Ύπαρξη Αυτής η Σκουληκομυρμηγκότρυπα', 'iparxi-autis-i-skoulikomirmigkotripa'],
['Français Œuf où à', 'francais-oeuf-ou-a'],
['هذه هي اللغة العربية', 'hthh-hy-llgh-laarby'],
['مرحبا العالم', 'mrhb-laa-lm'],
['Één jaar', 'een-jaar'],
['tiếng việt rất khó', 'tieng-viet-rat-kho'],
['Nguyễn Đăng Khoa', 'nguyen-dang-khoa'],
['နှစ်သစ်ကူးတွင် သတ္တဝါတွေ စိတ်ချမ်းသာ ကိုယ်ကျန်းမာ၍ ကောင်းခြင်း အနန္တနှင့် ပြည့်စုံကြပါစေ', 'nhitthitkutwin-thttwatwe-seikkhyaantha-koekyaanmaywae-kaungkhyin-anntnhin-pyisonkypase'],
['Zażółć żółcią gęślą jaźń', 'zazolc-zolcia-gesla-jazn'],
['Mężny bądź chroń pułk twój i sześć flag', 'mezny-badz-chron-pulk-twoj-i-szesc-flag'],
['ერთი ორი სამი ოთხი ხუთი', 'erti-ori-sami-otkhi-khuti'],
['अ ऒ न द', 'a-oii-na-tha'],
['Æ Ø Å æ ø å', 'ae-oe-aa-ae-oe-aa'],
[str_repeat('Übergrößenträger', 1000), str_repeat('uebergroessentraeger', 1000)],
[str_repeat('my🎉', 5000), substr(str_repeat('my-', 5000), 0, -1)],
[str_repeat('hi🇦🇹', 5000), substr(str_repeat('hi-', 5000), 0, -1)],
['Č Ć Ž Š Đ č ć ž š đ', 'c-c-z-s-d-c-c-z-s-d'],
['Ą Č Ę Ė Į Š Ų Ū Ž ą č ę ė į š ų ū ž', 'a-c-e-e-i-s-u-u-z-a-c-e-e-i-s-u-u-z'],
];
}
}