File manager - Edit - /home/autoph/public_html/projects/Rating-AutoHub/public/css/doctrine.zip
Back
PK ���Z�ne2� � deprecations/phpcs.xmlnu �[��� <?xml version="1.0"?> <ruleset> <arg name="basepath" value="."/> <arg name="extensions" value="php"/> <arg name="parallel" value="80"/> <arg name="cache" value=".phpcs-cache"/> <arg name="colors"/> <!-- Ignore warnings, show progress of the run and show sniff names --> <arg value="nps"/> <config name="php_version" value="70100"/> <!-- Directories to be checked --> <file>lib</file> <file>tests</file> <!-- Include full Doctrine Coding Standard --> <rule ref="Doctrine"> <exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint" /> </rule> </ruleset> PK ���Z.�͚� � deprecations/composer.jsonnu �[��� { "name": "doctrine/deprecations", "type": "library", "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", "homepage": "https://www.doctrine-project.org/", "license": "MIT", "require": { "php": "^7.1|^8.0" }, "require-dev": { "phpunit/phpunit": "^7.5|^8.5|^9.5", "psr/log": "^1|^2|^3", "doctrine/coding-standard": "^9" }, "suggest": { "psr/log": "Allows logging deprecations via PSR-3 logger implementation" }, "autoload": { "psr-4": {"Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations"} }, "autoload-dev": { "psr-4": { "DeprecationTests\\": "test_fixtures/src", "Doctrine\\Foo\\": "test_fixtures/vendor/doctrine/foo" } }, "config": { "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true } } } PK ���Z�<R\� � 6 deprecations/lib/Doctrine/Deprecations/Deprecation.phpnu �[��� <?php declare(strict_types=1); namespace Doctrine\Deprecations; use Psr\Log\LoggerInterface; use function array_key_exists; use function array_reduce; use function debug_backtrace; use function sprintf; use function strpos; use function strrpos; use function substr; use function trigger_error; use const DEBUG_BACKTRACE_IGNORE_ARGS; use const DIRECTORY_SEPARATOR; use const E_USER_DEPRECATED; /** * Manages Deprecation logging in different ways. * * By default triggered exceptions are not logged. * * To enable different deprecation logging mechanisms you can call the * following methods: * * - Minimal collection of deprecations via getTriggeredDeprecations() * \Doctrine\Deprecations\Deprecation::enableTrackingDeprecations(); * * - Uses @trigger_error with E_USER_DEPRECATED * \Doctrine\Deprecations\Deprecation::enableWithTriggerError(); * * - Sends deprecation messages via a PSR-3 logger * \Doctrine\Deprecations\Deprecation::enableWithPsrLogger($logger); * * Packages that trigger deprecations should use the `trigger()` or * `triggerIfCalledFromOutside()` methods. */ class Deprecation { private const TYPE_NONE = 0; private const TYPE_TRACK_DEPRECATIONS = 1; private const TYPE_TRIGGER_ERROR = 2; private const TYPE_PSR_LOGGER = 4; /** @var int */ private static $type = self::TYPE_NONE; /** @var LoggerInterface|null */ private static $logger; /** @var array<string,bool> */ private static $ignoredPackages = []; /** @var array<string,int> */ private static $ignoredLinks = []; /** @var bool */ private static $deduplication = true; /** * Trigger a deprecation for the given package and identfier. * * The link should point to a Github issue or Wiki entry detailing the * deprecation. It is additionally used to de-duplicate the trigger of the * same deprecation during a request. * * @param mixed $args */ public static function trigger(string $package, string $link, string $message, ...$args): void { if (self::$type === self::TYPE_NONE) { return; } if (array_key_exists($link, self::$ignoredLinks)) { self::$ignoredLinks[$link]++; } else { self::$ignoredLinks[$link] = 1; } if (self::$deduplication === true && self::$ignoredLinks[$link] > 1) { return; } if (isset(self::$ignoredPackages[$package])) { return; } $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); $message = sprintf($message, ...$args); self::delegateTriggerToBackend($message, $backtrace, $link, $package); } /** * Trigger a deprecation for the given package and identifier when called from outside. * * "Outside" means we assume that $package is currently installed as a * dependency and the caller is not a file in that package. When $package * is installed as a root package then deprecations triggered from the * tests folder are also considered "outside". * * This deprecation method assumes that you are using Composer to install * the dependency and are using the default /vendor/ folder and not a * Composer plugin to change the install location. The assumption is also * that $package is the exact composer packge name. * * Compared to {@link trigger()} this method causes some overhead when * deprecation tracking is enabled even during deduplication, because it * needs to call {@link debug_backtrace()} * * @param mixed $args */ public static function triggerIfCalledFromOutside(string $package, string $link, string $message, ...$args): void { if (self::$type === self::TYPE_NONE) { return; } $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); // first check that the caller is not from a tests folder, in which case we always let deprecations pass if (strpos($backtrace[1]['file'], DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR) === false) { $path = DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR; if (strpos($backtrace[0]['file'], $path) === false) { return; } if (strpos($backtrace[1]['file'], $path) !== false) { return; } } if (array_key_exists($link, self::$ignoredLinks)) { self::$ignoredLinks[$link]++; } else { self::$ignoredLinks[$link] = 1; } if (self::$deduplication === true && self::$ignoredLinks[$link] > 1) { return; } if (isset(self::$ignoredPackages[$package])) { return; } $message = sprintf($message, ...$args); self::delegateTriggerToBackend($message, $backtrace, $link, $package); } /** * @param array<mixed> $backtrace */ private static function delegateTriggerToBackend(string $message, array $backtrace, string $link, string $package): void { if ((self::$type & self::TYPE_PSR_LOGGER) > 0) { $context = [ 'file' => $backtrace[0]['file'], 'line' => $backtrace[0]['line'], 'package' => $package, 'link' => $link, ]; self::$logger->notice($message, $context); } if (! ((self::$type & self::TYPE_TRIGGER_ERROR) > 0)) { return; } $message .= sprintf( ' (%s:%d called by %s:%d, %s, package %s)', self::basename($backtrace[0]['file']), $backtrace[0]['line'], self::basename($backtrace[1]['file']), $backtrace[1]['line'], $link, $package ); @trigger_error($message, E_USER_DEPRECATED); } /** * A non-local-aware version of PHPs basename function. */ private static function basename(string $filename): string { $pos = strrpos($filename, DIRECTORY_SEPARATOR); if ($pos === false) { return $filename; } return substr($filename, $pos + 1); } public static function enableTrackingDeprecations(): void { self::$type |= self::TYPE_TRACK_DEPRECATIONS; } public static function enableWithTriggerError(): void { self::$type |= self::TYPE_TRIGGER_ERROR; } public static function enableWithPsrLogger(LoggerInterface $logger): void { self::$type |= self::TYPE_PSR_LOGGER; self::$logger = $logger; } public static function withoutDeduplication(): void { self::$deduplication = false; } public static function disable(): void { self::$type = self::TYPE_NONE; self::$logger = null; self::$deduplication = true; foreach (self::$ignoredLinks as $link => $count) { self::$ignoredLinks[$link] = 0; } } public static function ignorePackage(string $packageName): void { self::$ignoredPackages[$packageName] = true; } public static function ignoreDeprecations(string ...$links): void { foreach ($links as $link) { self::$ignoredLinks[$link] = 0; } } public static function getUniqueTriggeredDeprecationsCount(): int { return array_reduce(self::$ignoredLinks, static function (int $carry, int $count) { return $carry + $count; }, 0); } /** * Returns each triggered deprecation link identifier and the amount of occurrences. * * @return array<string,int> */ public static function getTriggeredDeprecations(): array { return self::$ignoredLinks; } } PK ���Z�/Gdz � E deprecations/lib/Doctrine/Deprecations/PHPUnit/VerifyDeprecations.phpnu �[��� <?php declare(strict_types=1); namespace Doctrine\Deprecations\PHPUnit; use Doctrine\Deprecations\Deprecation; use function sprintf; trait VerifyDeprecations { /** @var array<string,int> */ private $doctrineDeprecationsExpectations = []; /** @var array<string,int> */ private $doctrineNoDeprecationsExpectations = []; public function expectDeprecationWithIdentifier(string $identifier): void { $this->doctrineDeprecationsExpectations[$identifier] = Deprecation::getTriggeredDeprecations()[$identifier] ?? 0; } public function expectNoDeprecationWithIdentifier(string $identifier): void { $this->doctrineNoDeprecationsExpectations[$identifier] = Deprecation::getTriggeredDeprecations()[$identifier] ?? 0; } /** * @before */ public function enableDeprecationTracking(): void { Deprecation::enableTrackingDeprecations(); } /** * @after */ public function verifyDeprecationsAreTriggered(): void { foreach ($this->doctrineDeprecationsExpectations as $identifier => $expectation) { $actualCount = Deprecation::getTriggeredDeprecations()[$identifier] ?? 0; $this->assertTrue( $actualCount > $expectation, sprintf( "Expected deprecation with identifier '%s' was not triggered by code executed in test.", $identifier ) ); } foreach ($this->doctrineNoDeprecationsExpectations as $identifier => $expectation) { $actualCount = Deprecation::getTriggeredDeprecations()[$identifier] ?? 0; $this->assertTrue( $actualCount === $expectation, sprintf( "Expected deprecation with identifier '%s' was triggered by code executed in test, but expected not to.", $identifier ) ); } } } PK ���Z0Fv�v v deprecations/README.mdnu �[��� # Doctrine Deprecations A small (side-effect free by default) layer on top of `trigger_error(E_USER_DEPRECATED)` or PSR-3 logging. - no side-effects by default, making it a perfect fit for libraries that don't know how the error handler works they operate under - options to avoid having to rely on error handlers global state by using PSR-3 logging - deduplicate deprecation messages to avoid excessive triggering and reduce overhead We recommend to collect Deprecations using a PSR logger instead of relying on the global error handler. ## Usage from consumer perspective: Enable Doctrine deprecations to be sent to a PSR3 logger: ```php \Doctrine\Deprecations\Deprecation::enableWithPsrLogger($logger); ``` Enable Doctrine deprecations to be sent as `@trigger_error($message, E_USER_DEPRECATED)` messages. ```php \Doctrine\Deprecations\Deprecation::enableWithTriggerError(); ``` If you only want to enable deprecation tracking, without logging or calling `trigger_error` then call: ```php \Doctrine\Deprecations\Deprecation::enableTrackingDeprecations(); ``` Tracking is enabled with all three modes and provides access to all triggered deprecations and their individual count: ```php $deprecations = \Doctrine\Deprecations\Deprecation::getTriggeredDeprecations(); foreach ($deprecations as $identifier => $count) { echo $identifier . " was triggered " . $count . " times\n"; } ``` ### Suppressing Specific Deprecations Disable triggering about specific deprecations: ```php \Doctrine\Deprecations\Deprecation::ignoreDeprecations("https://link/to/deprecations-description-identifier"); ``` Disable all deprecations from a package ```php \Doctrine\Deprecations\Deprecation::ignorePackage("doctrine/orm"); ``` ### Other Operations When used within PHPUnit or other tools that could collect multiple instances of the same deprecations the deduplication can be disabled: ```php \Doctrine\Deprecations\Deprecation::withoutDeduplication(); ``` Disable deprecation tracking again: ```php \Doctrine\Deprecations\Deprecation::disable(); ``` ## Usage from a library/producer perspective: When you want to unconditionally trigger a deprecation even when called from the library itself then the `trigger` method is the way to go: ```php \Doctrine\Deprecations\Deprecation::trigger( "doctrine/orm", "https://link/to/deprecations-description", "message" ); ``` If variable arguments are provided at the end, they are used with `sprintf` on the message. ```php \Doctrine\Deprecations\Deprecation::trigger( "doctrine/orm", "https://github.com/doctrine/orm/issue/1234", "message %s %d", "foo", 1234 ); ``` When you want to trigger a deprecation only when it is called by a function outside of the current package, but not trigger when the package itself is the cause, then use: ```php \Doctrine\Deprecations\Deprecation::triggerIfCalledFromOutside( "doctrine/orm", "https://link/to/deprecations-description", "message" ); ``` Based on the issue link each deprecation message is only triggered once per request. A limited stacktrace is included in the deprecation message to find the offending location. Note: A producer/library should never call `Deprecation::enableWith` methods and leave the decision how to handle deprecations to application and frameworks. ## Usage in PHPUnit tests There is a `VerifyDeprecations` trait that you can use to make assertions on the occurrence of deprecations within a test. ```php use Doctrine\Deprecations\PHPUnit\VerifyDeprecations; class MyTest extends TestCase { use VerifyDeprecations; public function testSomethingDeprecation() { $this->expectDeprecationWithIdentifier('https://github.com/doctrine/orm/issue/1234'); triggerTheCodeWithDeprecation(); } public function testSomethingDeprecationFixed() { $this->expectNoDeprecationWithIdentifier('https://github.com/doctrine/orm/issue/1234'); triggerTheCodeWithoutDeprecation(); } } ``` ## What is a deprecation identifier? An identifier for deprecations is just a link to any resource, most often a Github Issue or Pull Request explaining the deprecation and potentially its alternative. PK ���Z"��0) ) deprecations/LICENSEnu �[��� Copyright (c) 2020-2021 Doctrine Project 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. PK ���Zچ�� inflector/composer.jsonnu �[��� { "name": "doctrine/inflector", "type": "library", "description": "PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.", "keywords": ["php", "strings", "words", "manipulation", "inflector", "inflection", "uppercase", "lowercase", "singular", "plural"], "homepage": "https://www.doctrine-project.org/projects/inflector.html", "license": "MIT", "authors": [ {"name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com"}, {"name": "Roman Borschel", "email": "roman@code-factory.org"}, {"name": "Benjamin Eberlei", "email": "kontakt@beberlei.de"}, {"name": "Jonathan Wage", "email": "jonwage@gmail.com"}, {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"} ], "require": { "php": "^7.2 || ^8.0" }, "require-dev": { "doctrine/coding-standard": "^10", "phpstan/phpstan": "^1.8", "phpstan/phpstan-phpunit": "^1.1", "phpstan/phpstan-strict-rules": "^1.3", "phpunit/phpunit": "^8.5 || ^9.5", "vimeo/psalm": "^4.25" }, "autoload": { "psr-4": { "Doctrine\\Inflector\\": "lib/Doctrine/Inflector" } }, "autoload-dev": { "psr-4": { "Doctrine\\Tests\\Inflector\\": "tests/Doctrine/Tests/Inflector" } }, "config": { "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true } } } PK ���Z#�#l� � 2 inflector/lib/Doctrine/Inflector/WordInflector.phpnu �[��� <?php declare(strict_types=1); namespace Doctrine\Inflector; interface WordInflector { public function inflect(string $word): string; } PK ���Z�edK K 5 inflector/lib/Doctrine/Inflector/RulesetInflector.phpnu �[��� <?php declare(strict_types=1); namespace Doctrine\Inflector; use Doctrine\Inflector\Rules\Ruleset; use function array_merge; /** * Inflects based on multiple rulesets. * * Rules: * - If the word matches any uninflected word pattern, it is not inflected * - The first ruleset that returns a different value for an irregular word wins * - The first ruleset that returns a different value for a regular word wins * - If none of the above match, the word is left as-is */ class RulesetInflector implements WordInflector { /** @var Ruleset[] */ private $rulesets; public function __construct(Ruleset $ruleset, Ruleset ...$rulesets) { $this->rulesets = array_merge([$ruleset], $rulesets); } public function inflect(string $word): string { if ($word === '') { return ''; } foreach ($this->rulesets as $ruleset) { if ($ruleset->getUninflected()->matches($word)) { return $word; } $inflected = $ruleset->getIrregular()->inflect($word); if ($inflected !== $word) { return $inflected; } $inflected = $ruleset->getRegular()->inflect($word); if ($inflected !== $word) { return $inflected; } } return $word; } } PK ���Z��02 02 . inflector/lib/Doctrine/Inflector/Inflector.phpnu �[��� <?php declare(strict_types=1); namespace Doctrine\Inflector; use RuntimeException; use function chr; use function function_exists; use function lcfirst; use function mb_strtolower; use function ord; use function preg_match; use function preg_replace; use function sprintf; use function str_replace; use function strlen; use function strtolower; use function strtr; use function trim; use function ucwords; class Inflector { private const ACCENTED_CHARACTERS = [ 'À' => 'A', 'Á' => 'A', 'Â' => 'A', 'Ã' => 'A', 'Ä' => 'Ae', 'Æ' => 'Ae', 'Å' => 'Aa', 'æ' => 'a', 'Ç' => 'C', 'È' => 'E', 'É' => 'E', 'Ê' => 'E', 'Ë' => 'E', 'Ì' => 'I', 'Í' => 'I', 'Î' => 'I', 'Ï' => 'I', 'Ñ' => 'N', 'Ò' => 'O', 'Ó' => 'O', 'Ô' => 'O', 'Õ' => 'O', 'Ö' => 'Oe', 'Ù' => 'U', 'Ú' => 'U', 'Û' => 'U', 'Ü' => 'Ue', 'Ý' => 'Y', 'ß' => 'ss', 'à' => 'a', 'á' => 'a', 'â' => 'a', 'ã' => 'a', 'ä' => 'ae', 'å' => 'aa', 'ç' => 'c', 'è' => 'e', 'é' => 'e', 'ê' => 'e', 'ë' => 'e', 'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i', 'ñ' => 'n', 'ò' => 'o', 'ó' => 'o', 'ô' => 'o', 'õ' => 'o', 'ö' => 'oe', 'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ü' => 'ue', 'ý' => 'y', 'ÿ' => 'y', 'Ā' => 'A', 'ā' => 'a', 'Ă' => 'A', 'ă' => 'a', 'Ą' => 'A', 'ą' => 'a', 'Ć' => 'C', 'ć' => 'c', 'Ĉ' => 'C', 'ĉ' => 'c', 'Ċ' => 'C', 'ċ' => 'c', 'Č' => 'C', 'č' => 'c', 'Ď' => 'D', 'ď' => 'd', 'Đ' => 'D', 'đ' => 'd', 'Ē' => 'E', 'ē' => 'e', 'Ĕ' => 'E', 'ĕ' => 'e', 'Ė' => 'E', 'ė' => 'e', 'Ę' => 'E', 'ę' => 'e', 'Ě' => 'E', 'ě' => 'e', 'Ĝ' => 'G', 'ĝ' => 'g', 'Ğ' => 'G', 'ğ' => 'g', 'Ġ' => 'G', 'ġ' => 'g', 'Ģ' => 'G', 'ģ' => 'g', 'Ĥ' => 'H', 'ĥ' => 'h', 'Ħ' => 'H', 'ħ' => 'h', 'Ĩ' => 'I', 'ĩ' => 'i', 'Ī' => 'I', 'ī' => 'i', 'Ĭ' => 'I', 'ĭ' => 'i', 'Į' => 'I', 'į' => 'i', 'İ' => 'I', 'ı' => 'i', 'IJ' => 'IJ', 'ij' => 'ij', 'Ĵ' => 'J', 'ĵ' => 'j', 'Ķ' => 'K', 'ķ' => 'k', 'ĸ' => 'k', 'Ĺ' => 'L', 'ĺ' => 'l', 'Ļ' => 'L', 'ļ' => 'l', 'Ľ' => 'L', 'ľ' => 'l', 'Ŀ' => 'L', 'ŀ' => 'l', 'Ł' => 'L', 'ł' => 'l', 'Ń' => 'N', 'ń' => 'n', 'Ņ' => 'N', 'ņ' => 'n', 'Ň' => 'N', 'ň' => 'n', 'ʼn' => 'N', 'Ŋ' => 'n', 'ŋ' => 'N', 'Ō' => 'O', 'ō' => 'o', 'Ŏ' => 'O', 'ŏ' => 'o', 'Ő' => 'O', 'ő' => 'o', 'Œ' => 'OE', 'œ' => 'oe', 'Ø' => 'O', 'ø' => 'o', 'Ŕ' => 'R', 'ŕ' => 'r', 'Ŗ' => 'R', 'ŗ' => 'r', 'Ř' => 'R', 'ř' => 'r', 'Ś' => 'S', 'ś' => 's', 'Ŝ' => 'S', 'ŝ' => 's', 'Ş' => 'S', 'ş' => 's', 'Š' => 'S', 'š' => 's', 'Ţ' => 'T', 'ţ' => 't', 'Ť' => 'T', 'ť' => 't', 'Ŧ' => 'T', 'ŧ' => 't', 'Ũ' => 'U', 'ũ' => 'u', 'Ū' => 'U', 'ū' => 'u', 'Ŭ' => 'U', 'ŭ' => 'u', 'Ů' => 'U', 'ů' => 'u', 'Ű' => 'U', 'ű' => 'u', 'Ų' => 'U', 'ų' => 'u', 'Ŵ' => 'W', 'ŵ' => 'w', 'Ŷ' => 'Y', 'ŷ' => 'y', 'Ÿ' => 'Y', 'Ź' => 'Z', 'ź' => 'z', 'Ż' => 'Z', 'ż' => 'z', 'Ž' => 'Z', 'ž' => 'z', 'ſ' => 's', '€' => 'E', '£' => '', ]; /** @var WordInflector */ private $singularizer; /** @var WordInflector */ private $pluralizer; public function __construct(WordInflector $singularizer, WordInflector $pluralizer) { $this->singularizer = $singularizer; $this->pluralizer = $pluralizer; } /** * Converts a word into the format for a Doctrine table name. Converts 'ModelName' to 'model_name'. */ public function tableize(string $word): string { $tableized = preg_replace('~(?<=\\w)([A-Z])~u', '_$1', $word); if ($tableized === null) { throw new RuntimeException(sprintf( 'preg_replace returned null for value "%s"', $word )); } return mb_strtolower($tableized); } /** * Converts a word into the format for a Doctrine class name. Converts 'table_name' to 'TableName'. */ public function classify(string $word): string { return str_replace([' ', '_', '-'], '', ucwords($word, ' _-')); } /** * Camelizes a word. This uses the classify() method and turns the first character to lowercase. */ public function camelize(string $word): string { return lcfirst($this->classify($word)); } /** * Uppercases words with configurable delimiters between words. * * Takes a string and capitalizes all of the words, like PHP's built-in * ucwords function. This extends that behavior, however, by allowing the * word delimiters to be configured, rather than only separating on * whitespace. * * Here is an example: * <code> * <?php * $string = 'top-o-the-morning to all_of_you!'; * echo $inflector->capitalize($string); * // Top-O-The-Morning To All_of_you! * * echo $inflector->capitalize($string, '-_ '); * // Top-O-The-Morning To All_Of_You! * ?> * </code> * * @param string $string The string to operate on. * @param string $delimiters A list of word separators. * * @return string The string with all delimiter-separated words capitalized. */ public function capitalize(string $string, string $delimiters = " \n\t\r\0\x0B-"): string { return ucwords($string, $delimiters); } /** * Checks if the given string seems like it has utf8 characters in it. * * @param string $string The string to check for utf8 characters in. */ public function seemsUtf8(string $string): bool { for ($i = 0; $i < strlen($string); $i++) { if (ord($string[$i]) < 0x80) { continue; // 0bbbbbbb } if ((ord($string[$i]) & 0xE0) === 0xC0) { $n = 1; // 110bbbbb } elseif ((ord($string[$i]) & 0xF0) === 0xE0) { $n = 2; // 1110bbbb } elseif ((ord($string[$i]) & 0xF8) === 0xF0) { $n = 3; // 11110bbb } elseif ((ord($string[$i]) & 0xFC) === 0xF8) { $n = 4; // 111110bb } elseif ((ord($string[$i]) & 0xFE) === 0xFC) { $n = 5; // 1111110b } else { return false; // Does not match any model } for ($j = 0; $j < $n; $j++) { // n bytes matching 10bbbbbb follow ? if (++$i === strlen($string) || ((ord($string[$i]) & 0xC0) !== 0x80)) { return false; } } } return true; } /** * Remove any illegal characters, accents, etc. * * @param string $string String to unaccent * * @return string Unaccented string */ public function unaccent(string $string): string { if (preg_match('/[\x80-\xff]/', $string) === false) { return $string; } if ($this->seemsUtf8($string)) { $string = strtr($string, self::ACCENTED_CHARACTERS); } else { $characters = []; // Assume ISO-8859-1 if not UTF-8 $characters['in'] = chr(128) . chr(131) . chr(138) . chr(142) . chr(154) . chr(158) . chr(159) . chr(162) . chr(165) . chr(181) . chr(192) . chr(193) . chr(194) . chr(195) . chr(196) . chr(197) . chr(199) . chr(200) . chr(201) . chr(202) . chr(203) . chr(204) . chr(205) . chr(206) . chr(207) . chr(209) . chr(210) . chr(211) . chr(212) . chr(213) . chr(214) . chr(216) . chr(217) . chr(218) . chr(219) . chr(220) . chr(221) . chr(224) . chr(225) . chr(226) . chr(227) . chr(228) . chr(229) . chr(231) . chr(232) . chr(233) . chr(234) . chr(235) . chr(236) . chr(237) . chr(238) . chr(239) . chr(241) . chr(242) . chr(243) . chr(244) . chr(245) . chr(246) . chr(248) . chr(249) . chr(250) . chr(251) . chr(252) . chr(253) . chr(255); $characters['out'] = 'EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy'; $string = strtr($string, $characters['in'], $characters['out']); $doubleChars = []; $doubleChars['in'] = [ chr(140), chr(156), chr(198), chr(208), chr(222), chr(223), chr(230), chr(240), chr(254), ]; $doubleChars['out'] = ['OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th']; $string = str_replace($doubleChars['in'], $doubleChars['out'], $string); } return $string; } /** * Convert any passed string to a url friendly string. * Converts 'My first blog post' to 'my-first-blog-post' * * @param string $string String to urlize. * * @return string Urlized string. */ public function urlize(string $string): string { // Remove all non url friendly characters with the unaccent function $unaccented = $this->unaccent($string); if (function_exists('mb_strtolower')) { $lowered = mb_strtolower($unaccented); } else { $lowered = strtolower($unaccented); } $replacements = [ '/\W/' => ' ', '/([A-Z]+)([A-Z][a-z])/' => '\1_\2', '/([a-z\d])([A-Z])/' => '\1_\2', '/[^A-Z^a-z^0-9^\/]+/' => '-', ]; $urlized = $lowered; foreach ($replacements as $pattern => $replacement) { $replaced = preg_replace($pattern, $replacement, $urlized); if ($replaced === null) { throw new RuntimeException(sprintf( 'preg_replace returned null for value "%s"', $urlized )); } $urlized = $replaced; } return trim($urlized, '-'); } /** * Returns a word in singular form. * * @param string $word The word in plural form. * * @return string The word in singular form. */ public function singularize(string $word): string { return $this->singularizer->inflect($word); } /** * Returns a word in plural form. * * @param string $word The word in singular form. * * @return string The word in plural form. */ public function pluralize(string $word): string { return $this->pluralizer->inflect($word); } } PK ���Z�3� � F inflector/lib/Doctrine/Inflector/Rules/Portuguese/InflectorFactory.phpnu �[��� <?php declare(strict_types=1); namespace Doctrine\Inflector\Rules\Portuguese; use Doctrine\Inflector\GenericLanguageInflectorFactory; use Doctrine\Inflector\Rules\Ruleset; final class InflectorFactory extends GenericLanguageInflectorFactory { protected function getSingularRuleset(): Ruleset { return Rules::getSingularRuleset(); } protected function getPluralRuleset(): Ruleset { return Rules::getPluralRuleset(); } } PK ���Z�n*�� � A inflector/lib/Doctrine/Inflector/Rules/Portuguese/Uninflected.phpnu �[��� <?php declare(strict_types=1); namespace Doctrine\Inflector\Rules\Portuguese; use Doctrine\Inflector\Rules\Pattern; final class Uninflected { /** @return Pattern[] */ public static function getSingular(): iterable { yield from self::getDefault(); } /** @return Pattern[] */ public static function getPlural(): iterable { yield from self::getDefault(); } /** @return Pattern[] */ private static function getDefault(): iterable { yield new Pattern('tórax'); yield new Pattern('tênis'); yield new Pattern('ônibus'); yield new Pattern('lápis'); yield new Pattern('fênix'); } } PK ���Z!<ۘm m ; inflector/lib/Doctrine/Inflector/Rules/Portuguese/Rules.phpnu �[��� <?php declare(strict_types=1); namespace Doctrine\Inflector\Rules\Portuguese; use Doctrine\Inflector\Rules\Patterns; use Doctrine\Inflector\Rules\Ruleset; use Doctrine\Inflector\Rules\Substitutions; use Doctrine\Inflector\Rules\Transformations; final class Rules { public static function getSingularRuleset(): Ruleset { return new Ruleset( new Transformations(...Inflectible::getSingular()), new Patterns(...Uninflected::getSingular()), (new Substitutions(...Inflectible::getIrregular()))->getFlippedSubstitutions() ); } public static function getPluralRuleset(): Ruleset { return new Ruleset( new Transformations(...Inflectible::getPlural()), new Patterns(...Uninflected::getPlural()), new Substitutions(...Inflectible::getIrregular()) ); } } PK ���Z@Yo A inflector/lib/Doctrine/Inflector/Rules/Portuguese/Inflectible.phpnu �[��� <?php declare(strict_types=1); namespace Doctrine\Inflector\Rules\Portuguese; use Doctrine\Inflector\Rules\Pattern; use Doctrine\Inflector\Rules\Substitution; use Doctrine\Inflector\Rules\Transformation; use Doctrine\Inflector\Rules\Word; class Inflectible { /** @return Transformation[] */ public static function getSingular(): iterable { yield new Transformation(new Pattern('/^(g|)ases$/i'), '\1ás'); yield new Transformation(new Pattern('/(japon|escoc|ingl|dinamarqu|fregu|portugu)eses$/i'), '\1ês'); yield new Transformation(new Pattern('/(ae|ao|oe)s$/'), 'ao'); yield new Transformation(new Pattern('/(ãe|ão|õe)s$/'), 'ão'); yield new Transformation(new Pattern('/^(.*[^s]s)es$/i'), '\1'); yield new Transformation(new Pattern('/sses$/i'), 'sse'); yield new Transformation(new Pattern('/ns$/i'), 'm'); yield new Transformation(new Pattern('/(r|t|f|v)is$/i'), '\1il'); yield new Transformation(new Pattern('/uis$/i'), 'ul'); yield new Transformation(new Pattern('/ois$/i'), 'ol'); yield new Transformation(new Pattern('/eis$/i'), 'ei'); yield new Transformation(new Pattern('/éis$/i'), 'el'); yield new Transformation(new Pattern('/([^p])ais$/i'), '\1al'); yield new Transformation(new Pattern('/(r|z)es$/i'), '\1'); yield new Transformation(new Pattern('/^(á|gá)s$/i'), '\1s'); yield new Transformation(new Pattern('/([^ê])s$/i'), '\1'); } /** @return Transformation[] */ public static function getPlural(): iterable { yield new Transformation(new Pattern('/^(alem|c|p)ao$/i'), '\1aes'); yield new Transformation(new Pattern('/^(irm|m)ao$/i'), '\1aos'); yield new Transformation(new Pattern('/ao$/i'), 'oes'); yield new Transformation(new Pattern('/^(alem|c|p)ão$/i'), '\1ães'); yield new Transformation(new Pattern('/^(irm|m)ão$/i'), '\1ãos'); yield new Transformation(new Pattern('/ão$/i'), 'ões'); yield new Transformation(new Pattern('/^(|g)ás$/i'), '\1ases'); yield new Transformation(new Pattern('/^(japon|escoc|ingl|dinamarqu|fregu|portugu)ês$/i'), '\1eses'); yield new Transformation(new Pattern('/m$/i'), 'ns'); yield new Transformation(new Pattern('/([^aeou])il$/i'), '\1is'); yield new Transformation(new Pattern('/ul$/i'), 'uis'); yield new Transformation(new Pattern('/ol$/i'), 'ois'); yield new Transformation(new Pattern('/el$/i'), 'eis'); yield new Transformation(new Pattern('/al$/i'), 'ais'); yield new Transformation(new Pattern('/(z|r)$/i'), '\1es'); yield new Transformation(new Pattern('/(s)$/i'), '\1'); yield new Transformation(new Pattern('/$/'), 's'); } /** @return Substitution[] */ public static function getIrregular(): iterable { yield new Substitution(new Word('abdomen'), new Word('abdomens')); yield new Substitution(new Word('alemão'), new Word('alemães')); yield new Substitution(new Word('artesã'), new Word('artesãos')); yield new Substitution(new Word('álcool'), new Word('álcoois')); yield new Substitution(new Word('árvore'), new Word('árvores')); yield new Substitution(new Word('bencão'), new Word('bencãos')); yield new Substitution(new Word('cão'), new Word('cães')); yield new Substitution(new Word('campus'), new Word('campi')); yield new Substitution(new Word('cadáver'), new Word('cadáveres')); yield new Substitution(new Word('capelão'), new Word('capelães')); yield new Substitution(new Word('capitão'), new Word('capitães')); yield new Substitution(new Word('chão'), new Word('chãos')); yield new Substitution(new Word('charlatão'), new Word('charlatães')); yield new Substitution(new Word('cidadão'), new Word('cidadãos')); yield new Substitution(new Word('consul'), new Word('consules')); yield new Substitution(new Word('cristão'), new Word('cristãos')); yield new Substitution(new Word('difícil'), new Word('difíceis')); yield new Substitution(new Word('email'), new Word('emails')); yield new Substitution(new Word('escrivão'), new Word('escrivães')); yield new Substitution(new Word('fóssil'), new Word('fósseis')); yield new Substitution(new Word('gás'), new Word('gases')); yield new Substitution(new Word('germens'), new Word('germen')); yield new Substitution(new Word('grão'), new Word('grãos')); yield new Substitution(new Word('hífen'), new Word('hífens')); yield new Substitution(new Word('irmão'), new Word('irmãos')); yield new Substitution(new Word('liquens'), new Word('liquen')); yield new Substitution(new Word('mal'), new Word('males')); yield new Substitution(new Word('mão'), new Word('mãos')); yield new Substitution(new Word('orfão'), new Word('orfãos')); yield new Substitution(new Word('país'), new Word('países')); yield new Substitution(new Word('pai'), new Word('pais')); yield new Substitution(new Word('pão'), new Word('pães')); yield new Substitution(new Word('projétil'), new Word('projéteis')); yield new Substitution(new Word('réptil'), new Word('répteis')); yield new Substitution(new Word('sacristão'), new Word('sacristães')); yield new Substitution(new Word('sotão'), new Word('sotãos')); yield new Substitution(new Word('tabelião'), new Word('tabeliães')); } } PK ���Z�'� 9 inflector/lib/Doctrine/Inflector/Rules/Transformation.phpnu �[��� <?php declare(strict_types=1); namespace Doctrine\Inflector\Rules; use Doctrine\Inflector\WordInflector; use function preg_replace; final class Transformation implements WordInflector { /** @var Pattern */ private $pattern; /** @var string */ private $replacement; public function __construct(Pattern $pattern, string $replacement) { $this->pattern = $pattern; $this->replacement = $replacement; } public function getPattern(): Pattern { return $this->pattern; } public function getReplacement(): string { return $this->replacement; } public function inflect(string $word): string { return (string) preg_replace($this->pattern->getRegex(), $this->replacement, $word); } } PK ���Z�a_� 2 inflector/lib/Doctrine/Inflector/Rules/Pattern.phpnu �[��� <?php declare(strict_types=1); namespace Doctrine\Inflector\Rules; use function preg_match; final class Pattern { /** @var string */ private $pattern; /** @var string */ private $regex; public function __construct(string $pattern) { $this->pattern = $pattern; if (isset($this->pattern[0]) && $this->pattern[0] === '/') { $this->regex = $this->pattern; } else { $this->regex = '/' . $this->pattern . '/i'; } } public function getPattern(): string { return $this->pattern; } public function getRegex(): string { return $this->regex; } public function matches(string $word): bool { return preg_match($this->getRegex(), $word) === 1; } } PK ���Z��[�� � C inflector/lib/Doctrine/Inflector/Rules/Spanish/InflectorFactory.phpnu �[��� <?php declare(strict_types=1); namespace Doctrine\Inflector\Rules\Spanish; use Doctrine\Inflector\GenericLanguageInflectorFactory; use Doctrine\Inflector\Rules\Ruleset; final class InflectorFactory extends GenericLanguageInflectorFactory { protected function getSingularRuleset(): Ruleset { return Rules::getSingularRuleset(); } protected function getPluralRuleset(): Ruleset { return Rules::getPluralRuleset(); } } PK ���Z�@Og g >