diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7410957 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +upLoadImage/vendor diff --git a/upLoadImage/composer.json b/upLoadImage/composer.json new file mode 100644 index 0000000..4f392ab --- /dev/null +++ b/upLoadImage/composer.json @@ -0,0 +1,18 @@ +{ + "name": "david/up-load-image", + "autoload": { + "psr-4": { + "App\\": "src/" + } + }, + "authors": [ + { + "name": "pestak", + "email": "wawawaformation@gmail.com" + } + ], + "require": { + "intervention/image": "^3.11", + "symfony/var-dumper": "^7.4" + } +} diff --git a/upLoadImage/composer.lock b/upLoadImage/composer.lock new file mode 100644 index 0000000..118e8a8 --- /dev/null +++ b/upLoadImage/composer.lock @@ -0,0 +1,402 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "96bf757a5ca346a045f7159c18329289", + "packages": [ + { + "name": "intervention/gif", + "version": "4.2.4", + "source": { + "type": "git", + "url": "https://github.com/Intervention/gif.git", + "reference": "c3598a16ebe7690cd55640c44144a9df383ea73c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Intervention/gif/zipball/c3598a16ebe7690cd55640c44144a9df383ea73c", + "reference": "c3598a16ebe7690cd55640c44144a9df383ea73c", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "require-dev": { + "phpstan/phpstan": "^2.1", + "phpunit/phpunit": "^10.0 || ^11.0 || ^12.0", + "slevomat/coding-standard": "~8.0", + "squizlabs/php_codesniffer": "^3.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Intervention\\Gif\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Oliver Vogel", + "email": "oliver@intervention.io", + "homepage": "https://intervention.io/" + } + ], + "description": "Native PHP GIF Encoder/Decoder", + "homepage": "https://github.com/intervention/gif", + "keywords": [ + "animation", + "gd", + "gif", + "image" + ], + "support": { + "issues": "https://github.com/Intervention/gif/issues", + "source": "https://github.com/Intervention/gif/tree/4.2.4" + }, + "funding": [ + { + "url": "https://paypal.me/interventionio", + "type": "custom" + }, + { + "url": "https://github.com/Intervention", + "type": "github" + }, + { + "url": "https://ko-fi.com/interventionphp", + "type": "ko_fi" + } + ], + "time": "2026-01-04T09:27:23+00:00" + }, + { + "name": "intervention/image", + "version": "3.11.6", + "source": { + "type": "git", + "url": "https://github.com/Intervention/image.git", + "reference": "5f6d27d9fd56312c47f347929e7ac15345c605a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Intervention/image/zipball/5f6d27d9fd56312c47f347929e7ac15345c605a1", + "reference": "5f6d27d9fd56312c47f347929e7ac15345c605a1", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "intervention/gif": "^4.2", + "php": "^8.1" + }, + "require-dev": { + "mockery/mockery": "^1.6", + "phpstan/phpstan": "^2.1", + "phpunit/phpunit": "^10.0 || ^11.0 || ^12.0", + "slevomat/coding-standard": "~8.0", + "squizlabs/php_codesniffer": "^3.8" + }, + "suggest": { + "ext-exif": "Recommended to be able to read EXIF data properly." + }, + "type": "library", + "autoload": { + "psr-4": { + "Intervention\\Image\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Oliver Vogel", + "email": "oliver@intervention.io", + "homepage": "https://intervention.io" + } + ], + "description": "PHP Image Processing", + "homepage": "https://image.intervention.io", + "keywords": [ + "gd", + "image", + "imagick", + "resize", + "thumbnail", + "watermark" + ], + "support": { + "issues": "https://github.com/Intervention/image/issues", + "source": "https://github.com/Intervention/image/tree/3.11.6" + }, + "funding": [ + { + "url": "https://paypal.me/interventionio", + "type": "custom" + }, + { + "url": "https://github.com/Intervention", + "type": "github" + }, + { + "url": "https://ko-fi.com/interventionphp", + "type": "ko_fi" + } + ], + "time": "2025-12-17T13:38:29+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62", + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.6-dev" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.6.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:21:43+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.33.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493", + "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493", + "shasum": "" + }, + "require": { + "ext-iconv": "*", + "php": ">=7.2" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.33.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-12-23T08:48:59+00:00" + }, + { + "name": "symfony/var-dumper", + "version": "v7.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-dumper.git", + "reference": "7e99bebcb3f90d8721890f2963463280848cba92" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/7e99bebcb3f90d8721890f2963463280848cba92", + "reference": "7e99bebcb3f90d8721890f2963463280848cba92", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/console": "<6.4" + }, + "require-dev": { + "symfony/console": "^6.4|^7.0|^8.0", + "symfony/http-kernel": "^6.4|^7.0|^8.0", + "symfony/process": "^6.4|^7.0|^8.0", + "symfony/uid": "^6.4|^7.0|^8.0", + "twig/twig": "^3.12" + }, + "bin": [ + "Resources/bin/var-dump-server" + ], + "type": "library", + "autoload": { + "files": [ + "Resources/functions/dump.php" + ], + "psr-4": { + "Symfony\\Component\\VarDumper\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides mechanisms for walking through any arbitrary PHP variable", + "homepage": "https://symfony.com", + "keywords": [ + "debug", + "dump" + ], + "support": { + "source": "https://github.com/symfony/var-dumper/tree/v7.4.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-12-18T07:04:31+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": {}, + "prefer-stable": false, + "prefer-lowest": false, + "platform": {}, + "platform-dev": {}, + "plugin-api-version": "2.9.0" +} diff --git a/upLoadImage/img/20260109091629_4298_registre_a_decalage_schema.jpg b/upLoadImage/img/20260109091629_4298_registre_a_decalage_schema.jpg new file mode 100644 index 0000000..93bb08c Binary files /dev/null and b/upLoadImage/img/20260109091629_4298_registre_a_decalage_schema.jpg differ diff --git a/upLoadImage/img/test.webp b/upLoadImage/img/test.webp new file mode 100644 index 0000000..27ac65e Binary files /dev/null and b/upLoadImage/img/test.webp differ diff --git a/upLoadImage/index.php b/upLoadImage/index.php index a79fb18..db0662d 100644 --- a/upLoadImage/index.php +++ b/upLoadImage/index.php @@ -1,48 +1,11 @@ '; - - print_r($_FILES); - echo ''; +use Intervention\Image\ImageManager; +use Intervention\Image\Drivers\Gd\Driver; +require 'vendor/autoload.php'; - - if(isset($_FILES['image']) && $_FILES['image']['error'] === UPLOAD_ERR_OK) { - $dirUpload = 'img/'; - $tmpName = $_FILES['image']['tmp_name']; - $name = basename($_FILES['image']['name']); - $uploadPath = $dirUpload . $name; - if (move_uploaded_file($tmpName, $uploadPath)) { - echo 'Fichier téléchargé avec succès : ' . htmlspecialchars($name); - } else { - echo 'Erreur lors du déplacement du fichier téléchargé.'; - } - - - } else { - echo 'Erreur lors du téléchargement du fichier. Code d\'erreur : ' . $_FILES['image']['error']; - } -} -?> - - - - - - - Document - - -
-
- - - -
- -
- -
- - \ No newline at end of file +$interventionImage = new ImageManager(new Driver()); +$image = $interventionImage->read('img/registre_a_decalage_schema.jpg'); +$image->resize(300, 200); +$image->save('img/test.webp', 60); diff --git a/upLoadImage/vendor/autoload.php b/upLoadImage/vendor/autoload.php new file mode 100644 index 0000000..a344306 --- /dev/null +++ b/upLoadImage/vendor/autoload.php @@ -0,0 +1,22 @@ +realpath = realpath($opened_path) ?: $opened_path; + $opened_path = $this->realpath; + $this->handle = fopen($this->realpath, $mode); + $this->position = 0; + + return (bool) $this->handle; + } + + public function stream_read($count) + { + $data = fread($this->handle, $count); + + if ($this->position === 0) { + $data = preg_replace('{^#!.*\r?\n}', '', $data); + } + + $this->position += strlen($data); + + return $data; + } + + public function stream_cast($castAs) + { + return $this->handle; + } + + public function stream_close() + { + fclose($this->handle); + } + + public function stream_lock($operation) + { + return $operation ? flock($this->handle, $operation) : true; + } + + public function stream_seek($offset, $whence) + { + if (0 === fseek($this->handle, $offset, $whence)) { + $this->position = ftell($this->handle); + return true; + } + + return false; + } + + public function stream_tell() + { + return $this->position; + } + + public function stream_eof() + { + return feof($this->handle); + } + + public function stream_stat() + { + return array(); + } + + public function stream_set_option($option, $arg1, $arg2) + { + return true; + } + + public function url_stat($path, $flags) + { + $path = substr($path, 17); + if (file_exists($path)) { + return stat($path); + } + + return false; + } + } + } + + if ( + (function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true)) + || (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) + ) { + return include("phpvfscomposer://" . __DIR__ . '/..'.'/symfony/var-dumper/Resources/bin/var-dump-server'); + } +} + +return include __DIR__ . '/..'.'/symfony/var-dumper/Resources/bin/var-dump-server'; diff --git a/upLoadImage/vendor/composer/ClassLoader.php b/upLoadImage/vendor/composer/ClassLoader.php new file mode 100644 index 0000000..7824d8f --- /dev/null +++ b/upLoadImage/vendor/composer/ClassLoader.php @@ -0,0 +1,579 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see https://www.php-fig.org/psr/psr-0/ + * @see https://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + /** @var \Closure(string):void */ + private static $includeFile; + + /** @var string|null */ + private $vendorDir; + + // PSR-4 + /** + * @var array> + */ + private $prefixLengthsPsr4 = array(); + /** + * @var array> + */ + private $prefixDirsPsr4 = array(); + /** + * @var list + */ + private $fallbackDirsPsr4 = array(); + + // PSR-0 + /** + * List of PSR-0 prefixes + * + * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) + * + * @var array>> + */ + private $prefixesPsr0 = array(); + /** + * @var list + */ + private $fallbackDirsPsr0 = array(); + + /** @var bool */ + private $useIncludePath = false; + + /** + * @var array + */ + private $classMap = array(); + + /** @var bool */ + private $classMapAuthoritative = false; + + /** + * @var array + */ + private $missingClasses = array(); + + /** @var string|null */ + private $apcuPrefix; + + /** + * @var array + */ + private static $registeredLoaders = array(); + + /** + * @param string|null $vendorDir + */ + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + self::initializeIncludeClosure(); + } + + /** + * @return array> + */ + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); + } + + return array(); + } + + /** + * @return array> + */ + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + /** + * @return list + */ + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + /** + * @return list + */ + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + /** + * @return array Array of classname => path + */ + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + * + * @return void + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + * + * @return void + */ + public function add($prefix, $paths, $prepend = false) + { + $paths = (array) $paths; + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + $paths = (array) $paths; + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 base directories + * + * @return void + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + * + * @return void + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + * + * @return void + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + * + * @return void + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + * + * @return void + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + + if (null === $this->vendorDir) { + return; + } + + if ($prepend) { + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; + } else { + unset(self::$registeredLoaders[$this->vendorDir]); + self::$registeredLoaders[$this->vendorDir] = $this; + } + } + + /** + * Unregisters this instance as an autoloader. + * + * @return void + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + + if (null !== $this->vendorDir) { + unset(self::$registeredLoaders[$this->vendorDir]); + } + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return true|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + $includeFile = self::$includeFile; + $includeFile($file); + + return true; + } + + return null; + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + /** + * Returns the currently registered loaders keyed by their corresponding vendor directories. + * + * @return array + */ + public static function getRegisteredLoaders() + { + return self::$registeredLoaders; + } + + /** + * @param string $class + * @param string $ext + * @return string|false + */ + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath . '\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } + + /** + * @return void + */ + private static function initializeIncludeClosure() + { + if (self::$includeFile !== null) { + return; + } + + /** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + */ + self::$includeFile = \Closure::bind(static function($file) { + include $file; + }, null, null); + } +} diff --git a/upLoadImage/vendor/composer/InstalledVersions.php b/upLoadImage/vendor/composer/InstalledVersions.php new file mode 100644 index 0000000..2052022 --- /dev/null +++ b/upLoadImage/vendor/composer/InstalledVersions.php @@ -0,0 +1,396 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer; + +use Composer\Autoload\ClassLoader; +use Composer\Semver\VersionParser; + +/** + * This class is copied in every Composer installed project and available to all + * + * See also https://getcomposer.org/doc/07-runtime.md#installed-versions + * + * To require its presence, you can require `composer-runtime-api ^2.0` + * + * @final + */ +class InstalledVersions +{ + /** + * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to + * @internal + */ + private static $selfDir = null; + + /** + * @var mixed[]|null + * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}|array{}|null + */ + private static $installed; + + /** + * @var bool + */ + private static $installedIsLocalDir; + + /** + * @var bool|null + */ + private static $canGetVendors; + + /** + * @var array[] + * @psalm-var array}> + */ + private static $installedByVendor = array(); + + /** + * Returns a list of all package names which are present, either by being installed, replaced or provided + * + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackages() + { + $packages = array(); + foreach (self::getInstalled() as $installed) { + $packages[] = array_keys($installed['versions']); + } + + if (1 === \count($packages)) { + return $packages[0]; + } + + return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); + } + + /** + * Returns a list of all package names with a specific type e.g. 'library' + * + * @param string $type + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackagesByType($type) + { + $packagesByType = array(); + + foreach (self::getInstalled() as $installed) { + foreach ($installed['versions'] as $name => $package) { + if (isset($package['type']) && $package['type'] === $type) { + $packagesByType[] = $name; + } + } + } + + return $packagesByType; + } + + /** + * Checks whether the given package is installed + * + * This also returns true if the package name is provided or replaced by another package + * + * @param string $packageName + * @param bool $includeDevRequirements + * @return bool + */ + public static function isInstalled($packageName, $includeDevRequirements = true) + { + foreach (self::getInstalled() as $installed) { + if (isset($installed['versions'][$packageName])) { + return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; + } + } + + return false; + } + + /** + * Checks whether the given package satisfies a version constraint + * + * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: + * + * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') + * + * @param VersionParser $parser Install composer/semver to have access to this class and functionality + * @param string $packageName + * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package + * @return bool + */ + public static function satisfies(VersionParser $parser, $packageName, $constraint) + { + $constraint = $parser->parseConstraints((string) $constraint); + $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); + + return $provided->matches($constraint); + } + + /** + * Returns a version constraint representing all the range(s) which are installed for a given package + * + * It is easier to use this via isInstalled() with the $constraint argument if you need to check + * whether a given version of a package is installed, and not just whether it exists + * + * @param string $packageName + * @return string Version constraint usable with composer/semver + */ + public static function getVersionRanges($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + $ranges = array(); + if (isset($installed['versions'][$packageName]['pretty_version'])) { + $ranges[] = $installed['versions'][$packageName]['pretty_version']; + } + if (array_key_exists('aliases', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); + } + if (array_key_exists('replaced', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); + } + if (array_key_exists('provided', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); + } + + return implode(' || ', $ranges); + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['version'])) { + return null; + } + + return $installed['versions'][$packageName]['version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getPrettyVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['pretty_version'])) { + return null; + } + + return $installed['versions'][$packageName]['pretty_version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference + */ + public static function getReference($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['reference'])) { + return null; + } + + return $installed['versions'][$packageName]['reference']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. + */ + public static function getInstallPath($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @return array + * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} + */ + public static function getRootPackage() + { + $installed = self::getInstalled(); + + return $installed[0]['root']; + } + + /** + * Returns the raw installed.php data for custom implementations + * + * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. + * @return array[] + * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} + */ + public static function getRawData() + { + @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + self::$installed = include __DIR__ . '/installed.php'; + } else { + self::$installed = array(); + } + } + + return self::$installed; + } + + /** + * Returns the raw data of all installed.php which are currently loaded for custom implementations + * + * @return array[] + * @psalm-return list}> + */ + public static function getAllRawData() + { + return self::getInstalled(); + } + + /** + * Lets you reload the static array from another file + * + * This is only useful for complex integrations in which a project needs to use + * this class but then also needs to execute another project's autoloader in process, + * and wants to ensure both projects have access to their version of installed.php. + * + * A typical case would be PHPUnit, where it would need to make sure it reads all + * the data it needs from this class, then call reload() with + * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure + * the project in which it runs can then also use this class safely, without + * interference between PHPUnit's dependencies and the project's dependencies. + * + * @param array[] $data A vendor/composer/installed.php data set + * @return void + * + * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $data + */ + public static function reload($data) + { + self::$installed = $data; + self::$installedByVendor = array(); + + // when using reload, we disable the duplicate protection to ensure that self::$installed data is + // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not, + // so we have to assume it does not, and that may result in duplicate data being returned when listing + // all installed packages for example + self::$installedIsLocalDir = false; + } + + /** + * @return string + */ + private static function getSelfDir() + { + if (self::$selfDir === null) { + self::$selfDir = strtr(__DIR__, '\\', '/'); + } + + return self::$selfDir; + } + + /** + * @return array[] + * @psalm-return list}> + */ + private static function getInstalled() + { + if (null === self::$canGetVendors) { + self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); + } + + $installed = array(); + $copiedLocalDir = false; + + if (self::$canGetVendors) { + $selfDir = self::getSelfDir(); + foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { + $vendorDir = strtr($vendorDir, '\\', '/'); + if (isset(self::$installedByVendor[$vendorDir])) { + $installed[] = self::$installedByVendor[$vendorDir]; + } elseif (is_file($vendorDir.'/composer/installed.php')) { + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require $vendorDir.'/composer/installed.php'; + self::$installedByVendor[$vendorDir] = $required; + $installed[] = $required; + if (self::$installed === null && $vendorDir.'/composer' === $selfDir) { + self::$installed = $required; + self::$installedIsLocalDir = true; + } + } + if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) { + $copiedLocalDir = true; + } + } + } + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require __DIR__ . '/installed.php'; + self::$installed = $required; + } else { + self::$installed = array(); + } + } + + if (self::$installed !== array() && !$copiedLocalDir) { + $installed[] = self::$installed; + } + + return $installed; + } +} diff --git a/upLoadImage/vendor/composer/LICENSE b/upLoadImage/vendor/composer/LICENSE new file mode 100644 index 0000000..f27399a --- /dev/null +++ b/upLoadImage/vendor/composer/LICENSE @@ -0,0 +1,21 @@ + +Copyright (c) Nils Adermann, Jordi Boggiano + +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. + diff --git a/upLoadImage/vendor/composer/autoload_classmap.php b/upLoadImage/vendor/composer/autoload_classmap.php new file mode 100644 index 0000000..0fb0a2c --- /dev/null +++ b/upLoadImage/vendor/composer/autoload_classmap.php @@ -0,0 +1,10 @@ + $vendorDir . '/composer/InstalledVersions.php', +); diff --git a/upLoadImage/vendor/composer/autoload_files.php b/upLoadImage/vendor/composer/autoload_files.php new file mode 100644 index 0000000..7401525 --- /dev/null +++ b/upLoadImage/vendor/composer/autoload_files.php @@ -0,0 +1,12 @@ + $vendorDir . '/symfony/deprecation-contracts/function.php', + '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', + '667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php', +); diff --git a/upLoadImage/vendor/composer/autoload_namespaces.php b/upLoadImage/vendor/composer/autoload_namespaces.php new file mode 100644 index 0000000..15a2ff3 --- /dev/null +++ b/upLoadImage/vendor/composer/autoload_namespaces.php @@ -0,0 +1,9 @@ + array($vendorDir . '/symfony/polyfill-mbstring'), + 'Symfony\\Component\\VarDumper\\' => array($vendorDir . '/symfony/var-dumper'), + 'Intervention\\Image\\' => array($vendorDir . '/intervention/image/src'), + 'Intervention\\Gif\\' => array($vendorDir . '/intervention/gif/src'), + 'App\\' => array($baseDir . '/src'), +); diff --git a/upLoadImage/vendor/composer/autoload_real.php b/upLoadImage/vendor/composer/autoload_real.php new file mode 100644 index 0000000..de4f101 --- /dev/null +++ b/upLoadImage/vendor/composer/autoload_real.php @@ -0,0 +1,50 @@ +register(true); + + $filesToLoad = \Composer\Autoload\ComposerStaticInit3b209c2e463c36e66e539cfd67f7b941::$files; + $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; + + require $file; + } + }, null, null); + foreach ($filesToLoad as $fileIdentifier => $file) { + $requireFile($fileIdentifier, $file); + } + + return $loader; + } +} diff --git a/upLoadImage/vendor/composer/autoload_static.php b/upLoadImage/vendor/composer/autoload_static.php new file mode 100644 index 0000000..f1b5b98 --- /dev/null +++ b/upLoadImage/vendor/composer/autoload_static.php @@ -0,0 +1,68 @@ + __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', + '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', + '667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php', + ); + + public static $prefixLengthsPsr4 = array ( + 'S' => + array ( + 'Symfony\\Polyfill\\Mbstring\\' => 26, + 'Symfony\\Component\\VarDumper\\' => 28, + ), + 'I' => + array ( + 'Intervention\\Image\\' => 19, + 'Intervention\\Gif\\' => 17, + ), + 'A' => + array ( + 'App\\' => 4, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'Symfony\\Polyfill\\Mbstring\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring', + ), + 'Symfony\\Component\\VarDumper\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/var-dumper', + ), + 'Intervention\\Image\\' => + array ( + 0 => __DIR__ . '/..' . '/intervention/image/src', + ), + 'Intervention\\Gif\\' => + array ( + 0 => __DIR__ . '/..' . '/intervention/gif/src', + ), + 'App\\' => + array ( + 0 => __DIR__ . '/../..' . '/src', + ), + ); + + public static $classMap = array ( + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInit3b209c2e463c36e66e539cfd67f7b941::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit3b209c2e463c36e66e539cfd67f7b941::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit3b209c2e463c36e66e539cfd67f7b941::$classMap; + + }, null, ClassLoader::class); + } +} diff --git a/upLoadImage/vendor/composer/installed.json b/upLoadImage/vendor/composer/installed.json new file mode 100644 index 0000000..e61db4b --- /dev/null +++ b/upLoadImage/vendor/composer/installed.json @@ -0,0 +1,404 @@ +{ + "packages": [ + { + "name": "intervention/gif", + "version": "4.2.4", + "version_normalized": "4.2.4.0", + "source": { + "type": "git", + "url": "https://github.com/Intervention/gif.git", + "reference": "c3598a16ebe7690cd55640c44144a9df383ea73c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Intervention/gif/zipball/c3598a16ebe7690cd55640c44144a9df383ea73c", + "reference": "c3598a16ebe7690cd55640c44144a9df383ea73c", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "require-dev": { + "phpstan/phpstan": "^2.1", + "phpunit/phpunit": "^10.0 || ^11.0 || ^12.0", + "slevomat/coding-standard": "~8.0", + "squizlabs/php_codesniffer": "^3.8" + }, + "time": "2026-01-04T09:27:23+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Intervention\\Gif\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Oliver Vogel", + "email": "oliver@intervention.io", + "homepage": "https://intervention.io/" + } + ], + "description": "Native PHP GIF Encoder/Decoder", + "homepage": "https://github.com/intervention/gif", + "keywords": [ + "animation", + "gd", + "gif", + "image" + ], + "support": { + "issues": "https://github.com/Intervention/gif/issues", + "source": "https://github.com/Intervention/gif/tree/4.2.4" + }, + "funding": [ + { + "url": "https://paypal.me/interventionio", + "type": "custom" + }, + { + "url": "https://github.com/Intervention", + "type": "github" + }, + { + "url": "https://ko-fi.com/interventionphp", + "type": "ko_fi" + } + ], + "install-path": "../intervention/gif" + }, + { + "name": "intervention/image", + "version": "3.11.6", + "version_normalized": "3.11.6.0", + "source": { + "type": "git", + "url": "https://github.com/Intervention/image.git", + "reference": "5f6d27d9fd56312c47f347929e7ac15345c605a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Intervention/image/zipball/5f6d27d9fd56312c47f347929e7ac15345c605a1", + "reference": "5f6d27d9fd56312c47f347929e7ac15345c605a1", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "intervention/gif": "^4.2", + "php": "^8.1" + }, + "require-dev": { + "mockery/mockery": "^1.6", + "phpstan/phpstan": "^2.1", + "phpunit/phpunit": "^10.0 || ^11.0 || ^12.0", + "slevomat/coding-standard": "~8.0", + "squizlabs/php_codesniffer": "^3.8" + }, + "suggest": { + "ext-exif": "Recommended to be able to read EXIF data properly." + }, + "time": "2025-12-17T13:38:29+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Intervention\\Image\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Oliver Vogel", + "email": "oliver@intervention.io", + "homepage": "https://intervention.io" + } + ], + "description": "PHP Image Processing", + "homepage": "https://image.intervention.io", + "keywords": [ + "gd", + "image", + "imagick", + "resize", + "thumbnail", + "watermark" + ], + "support": { + "issues": "https://github.com/Intervention/image/issues", + "source": "https://github.com/Intervention/image/tree/3.11.6" + }, + "funding": [ + { + "url": "https://paypal.me/interventionio", + "type": "custom" + }, + { + "url": "https://github.com/Intervention", + "type": "github" + }, + { + "url": "https://ko-fi.com/interventionphp", + "type": "ko_fi" + } + ], + "install-path": "../intervention/image" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.6.0", + "version_normalized": "3.6.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62", + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "time": "2024-09-25T14:21:43+00:00", + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.6-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.6.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/deprecation-contracts" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.33.0", + "version_normalized": "1.33.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493", + "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493", + "shasum": "" + }, + "require": { + "ext-iconv": "*", + "php": ">=7.2" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "time": "2024-12-23T08:48:59+00:00", + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.33.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/polyfill-mbstring" + }, + { + "name": "symfony/var-dumper", + "version": "v7.4.3", + "version_normalized": "7.4.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-dumper.git", + "reference": "7e99bebcb3f90d8721890f2963463280848cba92" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/7e99bebcb3f90d8721890f2963463280848cba92", + "reference": "7e99bebcb3f90d8721890f2963463280848cba92", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/console": "<6.4" + }, + "require-dev": { + "symfony/console": "^6.4|^7.0|^8.0", + "symfony/http-kernel": "^6.4|^7.0|^8.0", + "symfony/process": "^6.4|^7.0|^8.0", + "symfony/uid": "^6.4|^7.0|^8.0", + "twig/twig": "^3.12" + }, + "time": "2025-12-18T07:04:31+00:00", + "bin": [ + "Resources/bin/var-dump-server" + ], + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "Resources/functions/dump.php" + ], + "psr-4": { + "Symfony\\Component\\VarDumper\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides mechanisms for walking through any arbitrary PHP variable", + "homepage": "https://symfony.com", + "keywords": [ + "debug", + "dump" + ], + "support": { + "source": "https://github.com/symfony/var-dumper/tree/v7.4.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/var-dumper" + } + ], + "dev": true, + "dev-package-names": [] +} diff --git a/upLoadImage/vendor/composer/installed.php b/upLoadImage/vendor/composer/installed.php new file mode 100644 index 0000000..893f328 --- /dev/null +++ b/upLoadImage/vendor/composer/installed.php @@ -0,0 +1,68 @@ + array( + 'name' => 'david/up-load-image', + 'pretty_version' => 'dev-main', + 'version' => 'dev-main', + 'reference' => 'd0f4ed4eb2a09d5a71e5a7ff525514067ef181ae', + 'type' => 'library', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'dev' => true, + ), + 'versions' => array( + 'david/up-load-image' => array( + 'pretty_version' => 'dev-main', + 'version' => 'dev-main', + 'reference' => 'd0f4ed4eb2a09d5a71e5a7ff525514067ef181ae', + 'type' => 'library', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'intervention/gif' => array( + 'pretty_version' => '4.2.4', + 'version' => '4.2.4.0', + 'reference' => 'c3598a16ebe7690cd55640c44144a9df383ea73c', + 'type' => 'library', + 'install_path' => __DIR__ . '/../intervention/gif', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'intervention/image' => array( + 'pretty_version' => '3.11.6', + 'version' => '3.11.6.0', + 'reference' => '5f6d27d9fd56312c47f347929e7ac15345c605a1', + 'type' => 'library', + 'install_path' => __DIR__ . '/../intervention/image', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'symfony/deprecation-contracts' => array( + 'pretty_version' => 'v3.6.0', + 'version' => '3.6.0.0', + 'reference' => '63afe740e99a13ba87ec199bb07bbdee937a5b62', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/deprecation-contracts', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'symfony/polyfill-mbstring' => array( + 'pretty_version' => 'v1.33.0', + 'version' => '1.33.0.0', + 'reference' => '6d857f4d76bd4b343eac26d6b539585d2bc56493', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'symfony/var-dumper' => array( + 'pretty_version' => 'v7.4.3', + 'version' => '7.4.3.0', + 'reference' => '7e99bebcb3f90d8721890f2963463280848cba92', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/var-dumper', + 'aliases' => array(), + 'dev_requirement' => false, + ), + ), +); diff --git a/upLoadImage/vendor/composer/platform_check.php b/upLoadImage/vendor/composer/platform_check.php new file mode 100644 index 0000000..14bf88d --- /dev/null +++ b/upLoadImage/vendor/composer/platform_check.php @@ -0,0 +1,25 @@ += 80200)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 8.2.0". You are running ' . PHP_VERSION . '.'; +} + +if ($issues) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + if (!ini_get('display_errors')) { + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { + fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); + } elseif (!headers_sent()) { + echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; + } + } + throw new \RuntimeException( + 'Composer detected issues in your platform: ' . implode(' ', $issues) + ); +} diff --git a/upLoadImage/vendor/intervention/gif/LICENSE b/upLoadImage/vendor/intervention/gif/LICENSE new file mode 100755 index 0000000..d621d28 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2020-present Oliver Vogel + +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. diff --git a/upLoadImage/vendor/intervention/gif/README.md b/upLoadImage/vendor/intervention/gif/README.md new file mode 100755 index 0000000..26a019f --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/README.md @@ -0,0 +1,101 @@ +# Intervention GIF +## Native PHP GIF Encoder/Decoder + +[![Latest Version](https://img.shields.io/packagist/v/intervention/gif.svg)](https://packagist.org/packages/intervention/gif) +![build](https://github.com/Intervention/gif/actions/workflows/build.yml/badge.svg) +[![Monthly Downloads](https://img.shields.io/packagist/dm/intervention/gif.svg)](https://packagist.org/packages/intervention/gif/stats) +[![Support me on Ko-fi](https://raw.githubusercontent.com/Intervention/gif/main/.github/images/support.svg)](https://ko-fi.com/interventionphp) + +Intervention GIF is a PHP encoder and decoder for the GIF image format that +does not depend on any image processing extension. + +Only the special `Splitter::class` class divides the data stream of an animated +GIF into individual `GDImage` objects for each frame and is therefore dependent +on the GD library. + +The library is the main component of [Intervention +Image](https://github.com/Intervention/image) for processing animated GIF files +with the GD library, but also works independently. + +## Installation + +You can easily install this package using [Composer](https://getcomposer.org). +Just request the package with the following command: + +```bash +composer require intervention/gif +``` + +## Code Examples + +### Decoding + +```php +use Intervention\Gif\Decoder; + +// Decode filepath to Intervention\Gif\GifDataStream::class +$gif = Decoder::decode('images/animation.gif'); + +// Decoder can also handle binary content directly +$gif = Decoder::decode($contents); +``` + +### Encoding + +Use the Builder class to create a new GIF image. + +```php +use Intervention\Gif\Builder; + +// create new gif canvas +$gif = Builder::canvas(width: 32, height: 32); + +// add animation frames to canvas +$delay = .25; // delay in seconds after next frame is displayed +$left = 0; // position offset (left) +$top = 0; // position offset (top) + +// add animation frames with optional delay in seconds +// and optional position offset for each frame +$gif->addFrame('images/frame01.gif', $delay, $left, $top); +$gif->addFrame('images/frame02.gif', $delay, $left); +$gif->addFrame('images/frame03.gif', $delay); +$gif->addFrame('images/frame04.gif'); + +// set loop count; 0 for infinite looping +$gif->setLoops(12); + +// encode +$data = $gif->encode(); +``` + + +## Requirements + +- PHP >= 8.1 + +## Development & Testing + +With this package comes a Docker image to build a test suite and analysis +container. To build this container you have to have Docker installed on your +system. You can run all tests with this command. + +```bash +docker-compose run --rm --build tests +``` + +Run the static analyzer on the code base. + +```bash +docker-compose run --rm --build analysis +``` + +## Authors + +This library is developed and maintained by [Oliver Vogel](https://intervention.io) + +Thanks to the community of [contributors](https://github.com/Intervention/gif/graphs/contributors) who have helped to improve this project. + +## License + +Intervention GIF is licensed under the [MIT License](LICENSE). diff --git a/upLoadImage/vendor/intervention/gif/composer.json b/upLoadImage/vendor/intervention/gif/composer.json new file mode 100755 index 0000000..0fd37ab --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/composer.json @@ -0,0 +1,44 @@ +{ + "name": "intervention/gif", + "description": "Native PHP GIF Encoder/Decoder", + "homepage": "https://github.com/intervention/gif", + "keywords": [ + "image", + "gd", + "gif", + "animation" + ], + "license": "MIT", + "authors": [ + { + "name": "Oliver Vogel", + "email": "oliver@intervention.io", + "homepage": "https://intervention.io/" + } + ], + "require": { + "php": "^8.1" + }, + "require-dev": { + "phpunit/phpunit": "^10.0 || ^11.0 || ^12.0", + "phpstan/phpstan": "^2.1", + "squizlabs/php_codesniffer": "^3.8", + "slevomat/coding-standard": "~8.0" + }, + "autoload": { + "psr-4": { + "Intervention\\Gif\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "Intervention\\Gif\\Tests\\": "tests" + } + }, + "minimum-stability": "stable", + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + } +} diff --git a/upLoadImage/vendor/intervention/gif/phpunit.xml.dist b/upLoadImage/vendor/intervention/gif/phpunit.xml.dist new file mode 100755 index 0000000..6a2bf07 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/phpunit.xml.dist @@ -0,0 +1,13 @@ + + + + + ./tests/Unit/ + + + + + src + + + diff --git a/upLoadImage/vendor/intervention/gif/src/AbstractEntity.php b/upLoadImage/vendor/intervention/gif/src/AbstractEntity.php new file mode 100644 index 0000000..3a09f6f --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/AbstractEntity.php @@ -0,0 +1,37 @@ +getShortName(); + } + + /** + * Cast object to string + * + * @throws EncoderException + */ + public function __toString(): string + { + return $this->encode(); + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/AbstractExtension.php b/upLoadImage/vendor/intervention/gif/src/AbstractExtension.php new file mode 100644 index 0000000..329ac50 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/AbstractExtension.php @@ -0,0 +1,10 @@ + + */ + protected array $blocks = []; + + /** + * Get size of block + */ + public function getBlockSize(): int + { + return strlen($this->application); + } + + /** + * Set application name + */ + public function setApplication(string $value): self + { + $this->application = $value; + + return $this; + } + + /** + * Get application name + */ + public function getApplication(): string + { + return $this->application; + } + + /** + * Add block to application extension + */ + public function addBlock(DataSubBlock $block): self + { + $this->blocks[] = $block; + + return $this; + } + + /** + * Set data sub blocks of instance + * + * @param array $blocks + */ + public function setBlocks(array $blocks): self + { + $this->blocks = $blocks; + + return $this; + } + + /** + * Get blocks of ApplicationExtension + * + * @return array + */ + public function getBlocks(): array + { + return $this->blocks; + } + + /** + * Get first block of ApplicationExtension + * + * @throws RuntimeException + */ + public function getFirstBlock(): DataSubBlock + { + if (!array_key_exists(0, $this->blocks)) { + throw new RuntimeException('Unable to retrieve data sub block.'); + } + + return $this->blocks[0]; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Blocks/Color.php b/upLoadImage/vendor/intervention/gif/src/Blocks/Color.php new file mode 100644 index 0000000..b0eea21 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Blocks/Color.php @@ -0,0 +1,83 @@ +r; + } + + /** + * Set red value + */ + public function setRed(int $value): self + { + $this->r = $value; + + return $this; + } + + /** + * Get green value + */ + public function getGreen(): int + { + return $this->g; + } + + /** + * Set green value + */ + public function setGreen(int $value): self + { + $this->g = $value; + + return $this; + } + + /** + * Get blue value + */ + public function getBlue(): int + { + return $this->b; + } + + /** + * Set blue value + */ + public function setBlue(int $value): self + { + $this->b = $value; + + return $this; + } + + /** + * Return hash value of current color + */ + public function getHash(): string + { + return md5($this->r . $this->g . $this->b); + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Blocks/ColorTable.php b/upLoadImage/vendor/intervention/gif/src/Blocks/ColorTable.php new file mode 100644 index 0000000..1a800cc --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Blocks/ColorTable.php @@ -0,0 +1,121 @@ + $colors + * @return void + */ + public function __construct(protected array $colors = []) + { + // + } + + /** + * Return array of current colors + * + * @return array + */ + public function getColors(): array + { + return array_values($this->colors); + } + + /** + * Add color to table + */ + public function addRgb(int $r, int $g, int $b): self + { + $this->addColor(new Color($r, $g, $b)); + + return $this; + } + + /** + * Add color to table + */ + public function addColor(Color $color): self + { + $this->colors[] = $color; + + return $this; + } + + /** + * Reset colors to array of color objects + * + * @param array $colors + */ + public function setColors(array $colors): self + { + $this->empty(); + foreach ($colors as $color) { + $this->addColor($color); + } + + return $this; + } + + /** + * Count colors of current instance + */ + public function countColors(): int + { + return count($this->colors); + } + + /** + * Determine if any colors are present on the current table + */ + public function hasColors(): bool + { + return $this->countColors() >= 1; + } + + /** + * Empty color table + */ + public function empty(): self + { + $this->colors = []; + + return $this; + } + + /** + * Get size of color table in logical screen descriptor + */ + public function getLogicalSize(): int + { + return match ($this->countColors()) { + 4 => 1, + 8 => 2, + 16 => 3, + 32 => 4, + 64 => 5, + 128 => 6, + 256 => 7, + default => 0, + }; + } + + /** + * Calculate the number of bytes contained by the current table + */ + public function getByteSize(): int + { + if (!$this->hasColors()) { + return 0; + } + + return 3 * pow(2, $this->getLogicalSize() + 1); + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Blocks/CommentExtension.php b/upLoadImage/vendor/intervention/gif/src/Blocks/CommentExtension.php new file mode 100644 index 0000000..082b770 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Blocks/CommentExtension.php @@ -0,0 +1,47 @@ + + */ + protected array $comments = []; + + /** + * Get all or one comment + * + * @return array + */ + public function getComments(): array + { + return $this->comments; + } + + /** + * Get one comment by key + */ + public function getComment(int $key): mixed + { + return $this->comments[$key] ?? null; + } + + /** + * Set comment text + */ + public function addComment(string $value): self + { + $this->comments[] = $value; + + return $this; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Blocks/DataSubBlock.php b/upLoadImage/vendor/intervention/gif/src/Blocks/DataSubBlock.php new file mode 100644 index 0000000..0480d20 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Blocks/DataSubBlock.php @@ -0,0 +1,41 @@ +getSize() > 255) { + throw new FormatException( + 'Data Sub-Block can not have a block size larger than 255 bytes.' + ); + } + } + + /** + * Return size of current block + */ + public function getSize(): int + { + return strlen($this->value); + } + + /** + * Return block value + */ + public function getValue(): string + { + return $this->value; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Blocks/FrameBlock.php b/upLoadImage/vendor/intervention/gif/src/Blocks/FrameBlock.php new file mode 100644 index 0000000..01fcfe2 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Blocks/FrameBlock.php @@ -0,0 +1,250 @@ + $applicationExtensions + */ + protected array $applicationExtensions = []; + + /** + * @var array $commentExtensions + */ + protected array $commentExtensions = []; + + public function __construct( + protected ImageDescriptor $imageDescriptor = new ImageDescriptor(), + protected ImageData $imageData = new ImageData() + ) { + // + } + + public function addEntity(AbstractEntity $entity): self + { + return match (true) { + $entity instanceof TableBasedImage => $this->setTableBasedImage($entity), + $entity instanceof GraphicControlExtension => $this->setGraphicControlExtension($entity), + $entity instanceof ImageDescriptor => $this->setImageDescriptor($entity), + $entity instanceof ColorTable => $this->setColorTable($entity), + $entity instanceof ImageData => $this->setImageData($entity), + $entity instanceof PlainTextExtension => $this->setPlainTextExtension($entity), + $entity instanceof NetscapeApplicationExtension, + $entity instanceof ApplicationExtension => $this->addApplicationExtension($entity), + $entity instanceof CommentExtension => $this->addCommentExtension($entity), + default => $this, + }; + } + + /** + * Return application extensions of current frame block + * + * @return array + */ + public function getApplicationExtensions(): array + { + return $this->applicationExtensions; + } + + /** + * Return comment extensions of current frame block + * + * @return array + */ + public function getCommentExtensions(): array + { + return $this->commentExtensions; + } + + /** + * Set the graphic control extension + */ + public function setGraphicControlExtension(GraphicControlExtension $extension): self + { + $this->graphicControlExtension = $extension; + + return $this; + } + + /** + * Get the graphic control extension of the current frame block + */ + public function getGraphicControlExtension(): ?GraphicControlExtension + { + return $this->graphicControlExtension; + } + + /** + * Set the image descriptor + */ + public function setImageDescriptor(ImageDescriptor $descriptor): self + { + $this->imageDescriptor = $descriptor; + return $this; + } + + /** + * Get the image descriptor of the frame block + */ + public function getImageDescriptor(): ImageDescriptor + { + return $this->imageDescriptor; + } + + /** + * Set the color table of the current frame block + */ + public function setColorTable(ColorTable $table): self + { + $this->colorTable = $table; + + return $this; + } + + /** + * Get color table + */ + public function getColorTable(): ?ColorTable + { + return $this->colorTable; + } + + /** + * Determine if frame block has color table + */ + public function hasColorTable(): bool + { + return !is_null($this->colorTable); + } + + /** + * Set image data of frame block + */ + public function setImageData(ImageData $data): self + { + $this->imageData = $data; + + return $this; + } + + /** + * Get image data of current frame block + */ + public function getImageData(): ImageData + { + return $this->imageData; + } + + /** + * Set plain text extension + */ + public function setPlainTextExtension(PlainTextExtension $extension): self + { + $this->plainTextExtension = $extension; + + return $this; + } + + /** + * Get plain text extension + */ + public function getPlainTextExtension(): ?PlainTextExtension + { + return $this->plainTextExtension; + } + + /** + * Add given application extension to the current frame block + */ + public function addApplicationExtension(ApplicationExtension $extension): self + { + $this->applicationExtensions[] = $extension; + + return $this; + } + + /** + * Remove all application extensions from the current frame block. + */ + public function clearApplicationExtensions(): self + { + $this->applicationExtensions = []; + + return $this; + } + + /** + * Add given comment extension to the current frame block + */ + public function addCommentExtension(CommentExtension $extension): self + { + $this->commentExtensions[] = $extension; + + return $this; + } + + /** + * Return netscape extension of the frame block if available + */ + public function getNetscapeExtension(): ?NetscapeApplicationExtension + { + $extensions = array_filter( + $this->applicationExtensions, + fn(ApplicationExtension $extension): bool => $extension instanceof NetscapeApplicationExtension, + ); + + return count($extensions) ? reset($extensions) : null; + } + + /** + * Set the table based image of the current frame block + */ + public function setTableBasedImage(TableBasedImage $tableBasedImage): self + { + $this->setImageDescriptor($tableBasedImage->getImageDescriptor()); + + if ($colorTable = $tableBasedImage->getColorTable()) { + $this->setColorTable($colorTable); + } + + $this->setImageData($tableBasedImage->getImageData()); + + return $this; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Blocks/GraphicControlExtension.php b/upLoadImage/vendor/intervention/gif/src/Blocks/GraphicControlExtension.php new file mode 100644 index 0000000..30f5640 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Blocks/GraphicControlExtension.php @@ -0,0 +1,129 @@ +delay = $value; + + return $this; + } + + /** + * Return delay time (1/100 second) + */ + public function getDelay(): int + { + return $this->delay; + } + + /** + * Set disposal method + */ + public function setDisposalMethod(DisposalMethod $method): self + { + $this->disposalMethod = $method; + + return $this; + } + + /** + * Get disposal method + */ + public function getDisposalMethod(): DisposalMethod + { + return $this->disposalMethod; + } + + /** + * Get transparent color index + */ + public function getTransparentColorIndex(): int + { + return $this->transparentColorIndex; + } + + /** + * Set transparent color index + */ + public function setTransparentColorIndex(int $index): self + { + $this->transparentColorIndex = $index; + + return $this; + } + + /** + * Get current transparent color existance + */ + public function getTransparentColorExistance(): bool + { + return $this->transparentColorExistance; + } + + /** + * Set existance flag of transparent color + */ + public function setTransparentColorExistance(bool $existance = true): self + { + $this->transparentColorExistance = $existance; + + return $this; + } + + /** + * Get user input flag + */ + public function getUserInput(): bool + { + return $this->userInput; + } + + /** + * Set user input flag + */ + public function setUserInput(bool $value = true): self + { + $this->userInput = $value; + + return $this; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Blocks/Header.php b/upLoadImage/vendor/intervention/gif/src/Blocks/Header.php new file mode 100644 index 0000000..2a9175b --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Blocks/Header.php @@ -0,0 +1,38 @@ +version = $value; + + return $this; + } + + /** + * Return current version + */ + public function getVersion(): string + { + return $this->version; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Blocks/ImageData.php b/upLoadImage/vendor/intervention/gif/src/Blocks/ImageData.php new file mode 100644 index 0000000..f956485 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Blocks/ImageData.php @@ -0,0 +1,68 @@ + + */ + protected array $blocks = []; + + /** + * Get LZW min. code size + */ + public function getLzwMinCodeSize(): int + { + return $this->lzw_min_code_size; + } + + /** + * Set lzw min. code size + */ + public function setLzwMinCodeSize(int $size): self + { + $this->lzw_min_code_size = $size; + + return $this; + } + + /** + * Get current data sub blocks + * + * @return array + */ + public function getBlocks(): array + { + return $this->blocks; + } + + /** + * Addd sub block + */ + public function addBlock(DataSubBlock $block): self + { + $this->blocks[] = $block; + + return $this; + } + + /** + * Determine if data sub blocks are present + */ + public function hasBlocks(): bool + { + return count($this->blocks) >= 1; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Blocks/ImageDescriptor.php b/upLoadImage/vendor/intervention/gif/src/Blocks/ImageDescriptor.php new file mode 100644 index 0000000..62ed3ae --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Blocks/ImageDescriptor.php @@ -0,0 +1,194 @@ +width); + } + + /** + * Get current width + */ + public function getHeight(): int + { + return intval($this->height); + } + + /** + * Get current Top + */ + public function getTop(): int + { + return intval($this->top); + } + + /** + * Get current Left + */ + public function getLeft(): int + { + return intval($this->left); + } + + /** + * Set size of current instance + */ + public function setSize(int $width, int $height): self + { + $this->width = $width; + $this->height = $height; + + return $this; + } + + /** + * Set position of current instance + */ + public function setPosition(int $left, int $top): self + { + $this->left = $left; + $this->top = $top; + + return $this; + } + + /** + * Determine if frame is interlaced + */ + public function isInterlaced(): bool + { + return $this->interlaced; + } + + /** + * Set or unset interlaced value + */ + public function setInterlaced(bool $value = true): self + { + $this->interlaced = $value; + + return $this; + } + + /** + * Determine if local color table is present + */ + public function getLocalColorTableExistance(): bool + { + return $this->localColorTableExistance; + } + + /** + * Alias for getLocalColorTableExistance + */ + public function hasLocalColorTable(): bool + { + return $this->getLocalColorTableExistance(); + } + + /** + * Set local color table flag + */ + public function setLocalColorTableExistance(bool $existance = true): self + { + $this->localColorTableExistance = $existance; + + return $this; + } + + /** + * Get local color table sorted flag + */ + public function getLocalColorTableSorted(): bool + { + return $this->localColorTableSorted; + } + + /** + * Set local color table sorted flag + */ + public function setLocalColorTableSorted(bool $sorted = true): self + { + $this->localColorTableSorted = $sorted; + + return $this; + } + + /** + * Get size of local color table + */ + public function getLocalColorTableSize(): int + { + return $this->localColorTableSize; + } + + /** + * Get byte size of global color table + */ + public function getLocalColorTableByteSize(): int + { + return 3 * pow(2, $this->getLocalColorTableSize() + 1); + } + + /** + * Set size of local color table + */ + public function setLocalColorTableSize(int $size): self + { + $this->localColorTableSize = $size; + + return $this; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Blocks/LogicalScreenDescriptor.php b/upLoadImage/vendor/intervention/gif/src/Blocks/LogicalScreenDescriptor.php new file mode 100644 index 0000000..2b1c05c --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Blocks/LogicalScreenDescriptor.php @@ -0,0 +1,201 @@ +width = $width; + $this->height = $height; + + return $this; + } + + /** + * Get width of current instance + */ + public function getWidth(): int + { + return intval($this->width); + } + + /** + * Get height of current instance + */ + public function getHeight(): int + { + return intval($this->height); + } + + /** + * Determine if global color table is present + */ + public function getGlobalColorTableExistance(): bool + { + return $this->globalColorTableExistance; + } + + /** + * Alias of getGlobalColorTableExistance + */ + public function hasGlobalColorTable(): bool + { + return $this->getGlobalColorTableExistance(); + } + + /** + * Set global color table flag + */ + public function setGlobalColorTableExistance(bool $existance = true): self + { + $this->globalColorTableExistance = $existance; + + return $this; + } + + /** + * Get global color table sorted flag + */ + public function getGlobalColorTableSorted(): bool + { + return $this->globalColorTableSorted; + } + + /** + * Set global color table sorted flag + */ + public function setGlobalColorTableSorted(bool $sorted = true): self + { + $this->globalColorTableSorted = $sorted; + + return $this; + } + + /** + * Get size of global color table + */ + public function getGlobalColorTableSize(): int + { + return $this->globalColorTableSize; + } + + /** + * Get byte size of global color table + */ + public function getGlobalColorTableByteSize(): int + { + return 3 * pow(2, $this->getGlobalColorTableSize() + 1); + } + + /** + * Set size of global color table + */ + public function setGlobalColorTableSize(int $size): self + { + $this->globalColorTableSize = $size; + + return $this; + } + + /** + * Get background color index + */ + public function getBackgroundColorIndex(): int + { + return $this->backgroundColorIndex; + } + + /** + * Set background color index + */ + public function setBackgroundColorIndex(int $index): self + { + $this->backgroundColorIndex = $index; + + return $this; + } + + /** + * Get current pixel aspect ration + */ + public function getPixelAspectRatio(): int + { + return $this->pixelAspectRatio; + } + + /** + * Set pixel aspect ratio + */ + public function setPixelAspectRatio(int $ratio): self + { + $this->pixelAspectRatio = $ratio; + + return $this; + } + + /** + * Get color resolution + */ + public function getBitsPerPixel(): int + { + return $this->bitsPerPixel; + } + + /** + * Set color resolution + */ + public function setBitsPerPixel(int $value): self + { + $this->bitsPerPixel = $value; + + return $this; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Blocks/NetscapeApplicationExtension.php b/upLoadImage/vendor/intervention/gif/src/Blocks/NetscapeApplicationExtension.php new file mode 100644 index 0000000..742346b --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Blocks/NetscapeApplicationExtension.php @@ -0,0 +1,56 @@ +setApplication(self::IDENTIFIER . self::AUTH_CODE); + $this->setBlocks([new DataSubBlock(self::SUB_BLOCK_PREFIX . "\x00\x00")]); + } + + /** + * Get number of loops + * + * @throws RuntimeException + */ + public function getLoops(): int + { + $unpacked = unpack('v*', substr($this->getFirstBlock()->getValue(), 1)); + + if ($unpacked === false || !array_key_exists(1, $unpacked)) { + throw new RuntimeException('Unable to get loop count.'); + } + + return $unpacked[1]; + } + + /** + * Set number of loops + * + * @throws FormatException + */ + public function setLoops(int $loops): self + { + $this->setBlocks([ + new DataSubBlock(self::SUB_BLOCK_PREFIX . pack('v*', $loops)) + ]); + + return $this; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Blocks/PlainTextExtension.php b/upLoadImage/vendor/intervention/gif/src/Blocks/PlainTextExtension.php new file mode 100644 index 0000000..f21a4ad --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Blocks/PlainTextExtension.php @@ -0,0 +1,59 @@ + + */ + protected array $text = []; + + /** + * Get current text + * + * @return array + */ + public function getText(): array + { + return $this->text; + } + + /** + * Add text + */ + public function addText(string $text): self + { + $this->text[] = $text; + + return $this; + } + + /** + * Set text array of extension + * + * @param array $text + */ + public function setText(array $text): self + { + $this->text = $text; + + return $this; + } + + /** + * Determine if any text is present + */ + public function hasText(): bool + { + return $this->text !== []; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Blocks/TableBasedImage.php b/upLoadImage/vendor/intervention/gif/src/Blocks/TableBasedImage.php new file mode 100644 index 0000000..cbd447b --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Blocks/TableBasedImage.php @@ -0,0 +1,50 @@ +imageDescriptor; + } + + public function setImageDescriptor(ImageDescriptor $descriptor): self + { + $this->imageDescriptor = $descriptor; + + return $this; + } + + public function getImageData(): ImageData + { + return $this->imageData; + } + + public function setImageData(ImageData $data): self + { + $this->imageData = $data; + + return $this; + } + + public function getColorTable(): ?ColorTable + { + return $this->colorTable; + } + + public function setColorTable(ColorTable $table): self + { + $this->colorTable = $table; + + return $this; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Blocks/Trailer.php b/upLoadImage/vendor/intervention/gif/src/Blocks/Trailer.php new file mode 100644 index 0000000..2c68bc4 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Blocks/Trailer.php @@ -0,0 +1,12 @@ +setSize($width, $height); + } + + /** + * Get GifDataStream object we're currently building + */ + public function getGifDataStream(): GifDataStream + { + return $this->gif; + } + + /** + * Set canvas size of gif + */ + public function setSize(int $width, int $height): self + { + $this->gif->getLogicalScreenDescriptor()->setSize($width, $height); + + return $this; + } + + /** + * Set loop count + * + * @throws Exception + */ + public function setLoops(int $loops): self + { + if ($loops < 0) { + throw new Exception('The loop count must be equal to or greater than 0'); + } + + if ($this->gif->getFrames() === []) { + throw new Exception('Add at least one frame before setting the loop count'); + } + + // with one single loop the netscape extension must be removed otherwise the + // gif is looped twice because the first repetition always takes place + if ($loops === 1) { + $this->gif->getFirstFrame()?->clearApplicationExtensions(); + return $this; + } + + // make sure a netscape extension is present to store the loop count + if (!$this->gif->getFirstFrame()?->getNetscapeExtension()) { + $this->gif->getFirstFrame()?->addApplicationExtension( + new NetscapeApplicationExtension() + ); + } + + // the loop count is reduced by one because what is referred to here as + // the “loop count” actually means repetitions in GIF format, and thus + // the first repetition always takes place. A loop count of 0 howerver + // means infinite repetitions and remains unaltered. + $loops = $loops === 0 ? $loops : $loops - 1; + + // add loop count to netscape extension on first frame + $this->gif->getFirstFrame()?->getNetscapeExtension()?->setLoops($loops); + + return $this; + } + + /** + * Create new animation frame from given source + * which can be path to a file or GIF image data + * + * @throws DecoderException + */ + public function addFrame( + mixed $source, + float $delay = 0, + int $left = 0, + int $top = 0, + bool $interlaced = false + ): self { + $frame = new FrameBlock(); + $source = Decoder::decode($source); + + // store delay + $frame->setGraphicControlExtension( + $this->buildGraphicControlExtension( + $source, + intval($delay * 100) + ) + ); + + // store image + $frame->setTableBasedImage( + $this->buildTableBasedImage($source, $left, $top, $interlaced) + ); + + // add frame + $this->gif->addFrame($frame); + + return $this; + } + + /** + * Build new graphic control extension with given delay & disposal method + */ + protected function buildGraphicControlExtension( + GifDataStream $source, + int $delay, + DisposalMethod $disposalMethod = DisposalMethod::BACKGROUND + ): GraphicControlExtension { + // create extension + $extension = new GraphicControlExtension($delay, $disposalMethod); + + // set transparency index + $control = $source->getFirstFrame()->getGraphicControlExtension(); + if ($control && $control->getTransparentColorExistance()) { + $extension->setTransparentColorExistance(); + $extension->setTransparentColorIndex( + $control->getTransparentColorIndex() + ); + } + + return $extension; + } + + /** + * Build table based image object from given source + */ + protected function buildTableBasedImage( + GifDataStream $source, + int $left, + int $top, + bool $interlaced + ): TableBasedImage { + $block = new TableBasedImage(); + $block->setImageDescriptor(new ImageDescriptor()); + + // set global color table from source as local color table + $block->getImageDescriptor()->setLocalColorTableExistance(); + $block->setColorTable($source->getGlobalColorTable()); + + $block->getImageDescriptor()->setLocalColorTableSorted( + $source->getLogicalScreenDescriptor()->getGlobalColorTableSorted() + ); + + $block->getImageDescriptor()->setLocalColorTableSize( + $source->getLogicalScreenDescriptor()->getGlobalColorTableSize() + ); + + $block->getImageDescriptor()->setSize( + $source->getLogicalScreenDescriptor()->getWidth(), + $source->getLogicalScreenDescriptor()->getHeight() + ); + + // set position + $block->getImageDescriptor()->setPosition($left, $top); + + // set interlaced flag + $block->getImageDescriptor()->setInterlaced($interlaced); + + // add image data from source + $block->setImageData($source->getFirstFrame()->getImageData()); + + return $block; + } + + /** + * Encode the current build + * + * @throws EncoderException + */ + public function encode(): string + { + return $this->gif->encode(); + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Decoder.php b/upLoadImage/vendor/intervention/gif/src/Decoder.php new file mode 100644 index 0000000..873027e --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Decoder.php @@ -0,0 +1,47 @@ + self::getHandleFromFilePath($input), + is_string($input) => self::getHandleFromData($input), + self::isFileHandle($input) => $input, + default => throw new DecoderException( + 'Decoder input must be either file path, file pointer resource or binary data.' + ) + }; + } catch (RuntimeException $e) { + throw new DecoderException($e->getMessage()); + } + + rewind($handle); + + return GifDataStream::decode($handle); + } + + /** + * Determine if input is file pointer resource + */ + private static function isFileHandle(mixed $input): bool + { + return is_resource($input) && get_resource_type($input) === 'stream'; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Decoders/AbstractDecoder.php b/upLoadImage/vendor/intervention/gif/src/Decoders/AbstractDecoder.php new file mode 100644 index 0000000..03c12d1 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Decoders/AbstractDecoder.php @@ -0,0 +1,159 @@ +handle = $handle; + + return $this; + } + + /** + * Read given number of bytes and move file pointer + * + * @throws DecoderException + */ + protected function getNextBytesOrFail(int $length): string + { + if ($length < 1) { + throw new DecoderException('The length passed must be at least one byte.'); + } + + $bytes = fread($this->handle, $length); + if ($bytes === false || strlen($bytes) !== $length) { + throw new DecoderException('Unexpected end of file.'); + } + + return $bytes; + } + + /** + * Read given number of bytes and move pointer back to previous position + * + * @throws DecoderException + */ + protected function viewNextBytesOrFail(int $length): string + { + $bytes = $this->getNextBytesOrFail($length); + $this->movePointer($length * -1); + + return $bytes; + } + + /** + * Read next byte and move pointer back to previous position + * + * @throws DecoderException + */ + protected function viewNextByteOrFail(): string + { + return $this->viewNextBytesOrFail(1); + } + + /** + * Read all remaining bytes from file handler + */ + protected function getRemainingBytes(): string + { + $all = ''; + do { + $byte = fread($this->handle, 1); + $all .= $byte; + } while (!feof($this->handle)); + + return $all; + } + + /** + * Get next byte in stream and move file pointer + * + * @throws DecoderException + */ + protected function getNextByteOrFail(): string + { + return $this->getNextBytesOrFail(1); + } + + /** + * Move file pointer on handle by given offset + */ + protected function movePointer(int $offset): self + { + fseek($this->handle, $offset, SEEK_CUR); + + return $this; + } + + /** + * Decode multi byte value + * + * @throws DecoderException + */ + protected function decodeMultiByte(string $bytes): int + { + $unpacked = unpack('v*', $bytes); + + if ($unpacked === false || !array_key_exists(1, $unpacked)) { + throw new DecoderException('Unable to decode given bytes.'); + } + + return $unpacked[1]; + } + + /** + * Set length + */ + public function setLength(int $length): self + { + $this->length = $length; + + return $this; + } + + /** + * Get length + */ + public function getLength(): ?int + { + return $this->length; + } + + /** + * Get current handle position + * + * @throws DecoderException + */ + public function getPosition(): int + { + $position = ftell($this->handle); + + if ($position === false) { + throw new DecoderException('Unable to read current position from handle.'); + } + + return $position; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Decoders/AbstractPackedBitDecoder.php b/upLoadImage/vendor/intervention/gif/src/Decoders/AbstractPackedBitDecoder.php new file mode 100644 index 0000000..cdc50ed --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Decoders/AbstractPackedBitDecoder.php @@ -0,0 +1,47 @@ +getPackedBits($byte)[$num]; + } + + /** + * Get packed bits + * + * @throws DecoderException + */ + protected function getPackedBits(string $byte, int $start = 0, int $length = 8): string + { + $bits = str_pad(decbin($this->decodePackedByte($byte)), 8, '0', STR_PAD_LEFT); + + return substr($bits, $start, $length); + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Decoders/ApplicationExtensionDecoder.php b/upLoadImage/vendor/intervention/gif/src/Decoders/ApplicationExtensionDecoder.php new file mode 100644 index 0000000..0153103 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Decoders/ApplicationExtensionDecoder.php @@ -0,0 +1,75 @@ +getNextByteOrFail(); // marker + $this->getNextByteOrFail(); // label + $blocksize = $this->decodeBlockSize($this->getNextByteOrFail()); + $application = $this->getNextBytesOrFail($blocksize); + + if ($application === NetscapeApplicationExtension::IDENTIFIER . NetscapeApplicationExtension::AUTH_CODE) { + $result = new NetscapeApplicationExtension(); + + // skip length + $this->getNextByteOrFail(); + + $result->setBlocks([ + new DataSubBlock( + $this->getNextBytesOrFail(3) + ) + ]); + + // skip terminator + $this->getNextByteOrFail(); + + return $result; + } + + $result->setApplication($application); + + // decode data sub blocks + $blocksize = $this->decodeBlockSize($this->getNextByteOrFail()); + while ($blocksize > 0) { + $result->addBlock(new DataSubBlock($this->getNextBytesOrFail($blocksize))); + $blocksize = $this->decodeBlockSize($this->getNextByteOrFail()); + } + + return $result; + } + + /** + * Decode block size of ApplicationExtension from given byte + * + * @throws DecoderException + */ + protected function decodeBlockSize(string $byte): int + { + $unpacked = @unpack('C', $byte); + + if ($unpacked === false || !array_key_exists(1, $unpacked)) { + throw new DecoderException('Unable to decode application extension block size.'); + } + + return intval($unpacked[1]); + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Decoders/ColorDecoder.php b/upLoadImage/vendor/intervention/gif/src/Decoders/ColorDecoder.php new file mode 100644 index 0000000..2c4752c --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Decoders/ColorDecoder.php @@ -0,0 +1,42 @@ +setRed($this->decodeColorValue($this->getNextByteOrFail())); + $color->setGreen($this->decodeColorValue($this->getNextByteOrFail())); + $color->setBlue($this->decodeColorValue($this->getNextByteOrFail())); + + return $color; + } + + /** + * Decode red value from source + * + * @throws DecoderException + */ + protected function decodeColorValue(string $byte): int + { + $unpacked = unpack('C', $byte); + if ($unpacked === false || !array_key_exists(1, $unpacked)) { + throw new DecoderException('Unable to decode color value.'); + } + + return $unpacked[1]; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Decoders/ColorTableDecoder.php b/upLoadImage/vendor/intervention/gif/src/Decoders/ColorTableDecoder.php new file mode 100644 index 0000000..c820df0 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Decoders/ColorTableDecoder.php @@ -0,0 +1,27 @@ +getLength() / 3); $i++) { + $table->addColor(Color::decode($this->handle)); + } + + return $table; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Decoders/CommentExtensionDecoder.php b/upLoadImage/vendor/intervention/gif/src/Decoders/CommentExtensionDecoder.php new file mode 100644 index 0000000..69ec51f --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Decoders/CommentExtensionDecoder.php @@ -0,0 +1,65 @@ +getNextBytesOrFail(2); // skip marker & label + + $extension = new CommentExtension(); + foreach ($this->decodeComments() as $comment) { + $extension->addComment($comment); + } + + return $extension; + } + + /** + * Decode comment from current source + * + * @throws DecoderException + * @return array + */ + protected function decodeComments(): array + { + $comments = []; + + do { + $byte = $this->getNextByteOrFail(); + $size = $this->decodeBlocksize($byte); + if ($size > 0) { + $comments[] = $this->getNextBytesOrFail($size); + } + } while ($byte !== CommentExtension::TERMINATOR); + + return $comments; + } + + /** + * Decode blocksize of following comment + * + * @throws DecoderException + */ + protected function decodeBlocksize(string $byte): int + { + $unpacked = @unpack('C', $byte); + + if ($unpacked === false || !array_key_exists(1, $unpacked)) { + throw new DecoderException('Unable to decode comment extension block size.'); + } + + return intval($unpacked[1]); + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Decoders/DataSubBlockDecoder.php b/upLoadImage/vendor/intervention/gif/src/Decoders/DataSubBlockDecoder.php new file mode 100644 index 0000000..6d407be --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Decoders/DataSubBlockDecoder.php @@ -0,0 +1,31 @@ +getNextByteOrFail(); + $unpacked = unpack('C', $char); + if ($unpacked === false || !array_key_exists(1, $unpacked)) { + throw new DecoderException('Unable to decode data sub block.'); + } + + $size = (int) $unpacked[1]; + + return new DataSubBlock($this->getNextBytesOrFail($size)); + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Decoders/FrameBlockDecoder.php b/upLoadImage/vendor/intervention/gif/src/Decoders/FrameBlockDecoder.php new file mode 100644 index 0000000..30480e5 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Decoders/FrameBlockDecoder.php @@ -0,0 +1,52 @@ +viewNextBytesOrFail(2)) { + AbstractExtension::MARKER . GraphicControlExtension::LABEL + => GraphicControlExtension::decode($this->handle), + AbstractExtension::MARKER . NetscapeApplicationExtension::LABEL + => NetscapeApplicationExtension::decode($this->handle), + AbstractExtension::MARKER . ApplicationExtension::LABEL + => ApplicationExtension::decode($this->handle), + AbstractExtension::MARKER . PlainTextExtension::LABEL + => PlainTextExtension::decode($this->handle), + AbstractExtension::MARKER . CommentExtension::LABEL + => CommentExtension::decode($this->handle), + default => match ($this->viewNextByteOrFail()) { + ImageDescriptor::SEPARATOR => TableBasedImage::decode($this->handle), + default => throw new DecoderException('Unable to decode Data Block'), + } + }; + + $frame->addEntity($block); + } while (!($block instanceof TableBasedImage)); + + return $frame; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Decoders/GifDataStreamDecoder.php b/upLoadImage/vendor/intervention/gif/src/Decoders/GifDataStreamDecoder.php new file mode 100644 index 0000000..3f5c9dc --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Decoders/GifDataStreamDecoder.php @@ -0,0 +1,58 @@ +setHeader( + Header::decode($this->handle), + ); + + $gif->setLogicalScreenDescriptor( + LogicalScreenDescriptor::decode($this->handle), + ); + + if ($gif->getLogicalScreenDescriptor()->hasGlobalColorTable()) { + $length = $gif->getLogicalScreenDescriptor()->getGlobalColorTableByteSize(); + $gif->setGlobalColorTable( + ColorTable::decode($this->handle, $length) + ); + } + + while ($this->viewNextByteOrFail() !== Trailer::MARKER) { + match ($this->viewNextBytesOrFail(2)) { + // trailing "global" comment blocks which are not part of "FrameBlock" + AbstractExtension::MARKER . CommentExtension::LABEL + => $gif->addComment( + CommentExtension::decode($this->handle) + ), + default => $gif->addFrame( + FrameBlock::decode($this->handle) + ), + }; + } + + return $gif; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Decoders/GraphicControlExtensionDecoder.php b/upLoadImage/vendor/intervention/gif/src/Decoders/GraphicControlExtensionDecoder.php new file mode 100644 index 0000000..278d226 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Decoders/GraphicControlExtensionDecoder.php @@ -0,0 +1,106 @@ +getNextBytesOrFail(3); // skip marker, label & bytesize + + // byte #4 + $packedField = $this->getNextByteOrFail(); + $result->setDisposalMethod($this->decodeDisposalMethod($packedField)); + $result->setUserInput($this->decodeUserInput($packedField)); + $result->setTransparentColorExistance($this->decodeTransparentColorExistance($packedField)); + + // bytes 5-6 + $result->setDelay($this->decodeDelay($this->getNextBytesOrFail(2))); + + // byte #7 + $result->setTransparentColorIndex($this->decodeTransparentColorIndex( + $this->getNextByteOrFail() + )); + + // byte #8 (terminator) + $this->getNextByteOrFail(); + + return $result; + } + + /** + * Decode disposal method + * + * @throws DecoderException + */ + protected function decodeDisposalMethod(string $byte): DisposalMethod + { + return DisposalMethod::from( + intval(bindec($this->getPackedBits($byte, 3, 3))) + ); + } + + /** + * Decode user input flag + * + * @throws DecoderException + */ + protected function decodeUserInput(string $byte): bool + { + return $this->hasPackedBit($byte, 6); + } + + /** + * Decode transparent color existance + * + * @throws DecoderException + */ + protected function decodeTransparentColorExistance(string $byte): bool + { + return $this->hasPackedBit($byte, 7); + } + + /** + * Decode delay value + * + * @throws DecoderException + */ + protected function decodeDelay(string $bytes): int + { + $unpacked = unpack('v*', $bytes); + if ($unpacked === false || !array_key_exists(1, $unpacked)) { + throw new DecoderException('Unable to decode animation delay.'); + } + + return $unpacked[1]; + } + + /** + * Decode transparent color index + * + * @throws DecoderException + */ + protected function decodeTransparentColorIndex(string $byte): int + { + $unpacked = unpack('C', $byte); + if ($unpacked === false || !array_key_exists(1, $unpacked)) { + throw new DecoderException('Unable to decode transparent color index.'); + } + + return $unpacked[1]; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Decoders/HeaderDecoder.php b/upLoadImage/vendor/intervention/gif/src/Decoders/HeaderDecoder.php new file mode 100644 index 0000000..d687f05 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Decoders/HeaderDecoder.php @@ -0,0 +1,40 @@ +setVersion($this->decodeVersion()); + + return $header; + } + + /** + * Decode version string + * + * @throws DecoderException + */ + protected function decodeVersion(): string + { + $parsed = (bool) preg_match("/^GIF(?P[0-9]{2}[a-z])$/", $this->getNextBytesOrFail(6), $matches); + + if ($parsed === false) { + throw new DecoderException('Unable to parse file header.'); + } + + return $matches['version']; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Decoders/ImageDataDecoder.php b/upLoadImage/vendor/intervention/gif/src/Decoders/ImageDataDecoder.php new file mode 100644 index 0000000..914c6f6 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Decoders/ImageDataDecoder.php @@ -0,0 +1,51 @@ +getNextByteOrFail(); + $unpacked = unpack('C', $char); + if ($unpacked === false || !array_key_exists(1, $unpacked)) { + throw new DecoderException('Unable to decode lzw min. code size.'); + } + + $data->setLzwMinCodeSize(intval($unpacked[1])); + + do { + // decode sub blocks + $char = $this->getNextByteOrFail(); + $unpacked = unpack('C', $char); + if ($unpacked === false || !array_key_exists(1, $unpacked)) { + throw new DecoderException('Unable to decode image data sub block.'); + } + + $size = intval($unpacked[1]); + + if ($size > 0) { + $data->addBlock(new DataSubBlock($this->getNextBytesOrFail($size))); + } + } while ($char !== AbstractEntity::TERMINATOR); + + return $data; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Decoders/ImageDescriptorDecoder.php b/upLoadImage/vendor/intervention/gif/src/Decoders/ImageDescriptorDecoder.php new file mode 100644 index 0000000..a387ec7 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Decoders/ImageDescriptorDecoder.php @@ -0,0 +1,93 @@ +getNextByteOrFail(); // skip separator + + $descriptor->setPosition( + $this->decodeMultiByte($this->getNextBytesOrFail(2)), + $this->decodeMultiByte($this->getNextBytesOrFail(2)) + ); + + $descriptor->setSize( + $this->decodeMultiByte($this->getNextBytesOrFail(2)), + $this->decodeMultiByte($this->getNextBytesOrFail(2)) + ); + + $packedField = $this->getNextByteOrFail(); + + $descriptor->setLocalColorTableExistance( + $this->decodeLocalColorTableExistance($packedField) + ); + + $descriptor->setLocalColorTableSorted( + $this->decodeLocalColorTableSorted($packedField) + ); + + $descriptor->setLocalColorTableSize( + $this->decodeLocalColorTableSize($packedField) + ); + + $descriptor->setInterlaced( + $this->decodeInterlaced($packedField) + ); + + return $descriptor; + } + + /** + * Decode local color table existance + * + * @throws DecoderException + */ + protected function decodeLocalColorTableExistance(string $byte): bool + { + return $this->hasPackedBit($byte, 0); + } + + /** + * Decode local color table sort method + * + * @throws DecoderException + */ + protected function decodeLocalColorTableSorted(string $byte): bool + { + return $this->hasPackedBit($byte, 2); + } + + /** + * Decode local color table size + * + * @throws DecoderException + */ + protected function decodeLocalColorTableSize(string $byte): int + { + return (int) bindec($this->getPackedBits($byte, 5, 3)); + } + + /** + * Decode interlaced flag + * + * @throws DecoderException + */ + protected function decodeInterlaced(string $byte): bool + { + return $this->hasPackedBit($byte, 1); + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Decoders/LogicalScreenDescriptorDecoder.php b/upLoadImage/vendor/intervention/gif/src/Decoders/LogicalScreenDescriptorDecoder.php new file mode 100644 index 0000000..73c8ddc --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Decoders/LogicalScreenDescriptorDecoder.php @@ -0,0 +1,162 @@ +setSize( + $this->decodeWidth($this->getNextBytesOrFail(2)), + $this->decodeHeight($this->getNextBytesOrFail(2)) + ); + + // byte 5 + $packedField = $this->getNextByteOrFail(); + + $logicalScreenDescriptor->setGlobalColorTableExistance( + $this->decodeGlobalColorTableExistance($packedField) + ); + + $logicalScreenDescriptor->setBitsPerPixel( + $this->decodeBitsPerPixel($packedField) + ); + + $logicalScreenDescriptor->setGlobalColorTableSorted( + $this->decodeGlobalColorTableSorted($packedField) + ); + + $logicalScreenDescriptor->setGlobalColorTableSize( + $this->decodeGlobalColorTableSize($packedField) + ); + + // byte 6 + $logicalScreenDescriptor->setBackgroundColorIndex( + $this->decodeBackgroundColorIndex($this->getNextByteOrFail()) + ); + + // byte 7 + $logicalScreenDescriptor->setPixelAspectRatio( + $this->decodePixelAspectRatio($this->getNextByteOrFail()) + ); + + return $logicalScreenDescriptor; + } + + /** + * Decode width + * + * @throws DecoderException + */ + protected function decodeWidth(string $source): int + { + $unpacked = unpack('v*', $source); + + if ($unpacked === false || !array_key_exists(1, $unpacked)) { + throw new DecoderException('Unable to decode width.'); + } + + return $unpacked[1]; + } + + /** + * Decode height + * + * @throws DecoderException + */ + protected function decodeHeight(string $source): int + { + $unpacked = unpack('v*', $source); + + if ($unpacked === false || !array_key_exists(1, $unpacked)) { + throw new DecoderException('Unable to decode height.'); + } + + return $unpacked[1]; + } + + /** + * Decode existance of global color table + * + * @throws DecoderException + */ + protected function decodeGlobalColorTableExistance(string $byte): bool + { + return $this->hasPackedBit($byte, 0); + } + + /** + * Decode color resolution in bits per pixel + * + * @throws DecoderException + */ + protected function decodeBitsPerPixel(string $byte): int + { + return intval(bindec($this->getPackedBits($byte, 1, 3))) + 1; + } + + /** + * Decode global color table sorted status + * + * @throws DecoderException + */ + protected function decodeGlobalColorTableSorted(string $byte): bool + { + return $this->hasPackedBit($byte, 4); + } + + /** + * Decode size of global color table + * + * @throws DecoderException + */ + protected function decodeGlobalColorTableSize(string $byte): int + { + return intval(bindec($this->getPackedBits($byte, 5, 3))); + } + + /** + * Decode background color index + * + * @throws DecoderException + */ + protected function decodeBackgroundColorIndex(string $source): int + { + $unpacked = unpack('C', $source); + + if ($unpacked === false || !array_key_exists(1, $unpacked)) { + throw new DecoderException('Unable to decode background color index.'); + } + + return $unpacked[1]; + } + + /** + * Decode pixel aspect ratio + * + * @throws DecoderException + */ + protected function decodePixelAspectRatio(string $source): int + { + $unpacked = unpack('C', $source); + + if ($unpacked === false || !array_key_exists(1, $unpacked)) { + throw new DecoderException('Unable to decode pixel aspect ratio.'); + } + + return $unpacked[1]; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Decoders/NetscapeApplicationExtensionDecoder.php b/upLoadImage/vendor/intervention/gif/src/Decoders/NetscapeApplicationExtensionDecoder.php new file mode 100644 index 0000000..3074f89 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Decoders/NetscapeApplicationExtensionDecoder.php @@ -0,0 +1,9 @@ +getNextBytesOrFail(2); + + // skip info block + $this->getNextBytesOrFail($this->getInfoBlockSize()); + + // text blocks + $extension->setText($this->decodeTextBlocks()); + + return $extension; + } + + /** + * Get number of bytes in header block + * + * @throws DecoderException + */ + protected function getInfoBlockSize(): int + { + $unpacked = unpack('C', $this->getNextByteOrFail()); + if ($unpacked === false || !array_key_exists(1, $unpacked)) { + throw new DecoderException('Unable to decode info block size.'); + } + + return $unpacked[1]; + } + + /** + * Decode text sub blocks + * + * @throws DecoderException + * @return array + */ + protected function decodeTextBlocks(): array + { + $blocks = []; + + do { + $char = $this->getNextByteOrFail(); + $unpacked = unpack('C', $char); + if ($unpacked === false || !array_key_exists(1, $unpacked)) { + throw new DecoderException('Unable to decode text block.'); + } + + $size = (int) $unpacked[1]; + + if ($size > 0) { + $blocks[] = $this->getNextBytesOrFail($size); + } + } while ($char !== PlainTextExtension::TERMINATOR); + + return $blocks; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Decoders/TableBasedImageDecoder.php b/upLoadImage/vendor/intervention/gif/src/Decoders/TableBasedImageDecoder.php new file mode 100644 index 0000000..3e10576 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Decoders/TableBasedImageDecoder.php @@ -0,0 +1,41 @@ +setImageDescriptor(ImageDescriptor::decode($this->handle)); + + if ($block->getImageDescriptor()->hasLocalColorTable()) { + $block->setColorTable( + ColorTable::decode( + $this->handle, + $block->getImageDescriptor()->getLocalColorTableByteSize() + ) + ); + } + + $block->setImageData( + ImageData::decode($this->handle) + ); + + return $block; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/DisposalMethod.php b/upLoadImage/vendor/intervention/gif/src/DisposalMethod.php new file mode 100644 index 0000000..7b05044 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/DisposalMethod.php @@ -0,0 +1,13 @@ +source = $source; + } + + /** + * Encode current source + * + * @throws EncoderException + */ + public function encode(): string + { + return implode('', [ + ApplicationExtension::MARKER, + ApplicationExtension::LABEL, + pack('C', $this->source->getBlockSize()), + $this->source->getApplication(), + implode('', array_map(fn(DataSubBlock $block): string => $block->encode(), $this->source->getBlocks())), + ApplicationExtension::TERMINATOR, + ]); + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Encoders/ColorEncoder.php b/upLoadImage/vendor/intervention/gif/src/Encoders/ColorEncoder.php new file mode 100644 index 0000000..10bf438 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Encoders/ColorEncoder.php @@ -0,0 +1,38 @@ +source = $source; + } + + /** + * Encode current source + */ + public function encode(): string + { + return implode('', [ + $this->encodeColorValue($this->source->getRed()), + $this->encodeColorValue($this->source->getGreen()), + $this->encodeColorValue($this->source->getBlue()), + ]); + } + + /** + * Encode color value + */ + protected function encodeColorValue(int $value): string + { + return pack('C', $value); + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Encoders/ColorTableEncoder.php b/upLoadImage/vendor/intervention/gif/src/Encoders/ColorTableEncoder.php new file mode 100644 index 0000000..f417e1f --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Encoders/ColorTableEncoder.php @@ -0,0 +1,33 @@ +source = $source; + } + + /** + * Encode current source + * + * @throws EncoderException + */ + public function encode(): string + { + return implode('', array_map( + fn(Color $color): string => $color->encode(), + $this->source->getColors(), + )); + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Encoders/CommentExtensionEncoder.php b/upLoadImage/vendor/intervention/gif/src/Encoders/CommentExtensionEncoder.php new file mode 100644 index 0000000..51ca0a4 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Encoders/CommentExtensionEncoder.php @@ -0,0 +1,41 @@ +source = $source; + } + + /** + * Encode current source + */ + public function encode(): string + { + return implode('', [ + CommentExtension::MARKER, + CommentExtension::LABEL, + $this->encodeComments(), + CommentExtension::TERMINATOR, + ]); + } + + /** + * Encode comment blocks + */ + protected function encodeComments(): string + { + return implode('', array_map(function (string $comment): string { + return pack('C', strlen($comment)) . $comment; + }, $this->source->getComments())); + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Encoders/DataSubBlockEncoder.php b/upLoadImage/vendor/intervention/gif/src/Encoders/DataSubBlockEncoder.php new file mode 100644 index 0000000..beb09b3 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Encoders/DataSubBlockEncoder.php @@ -0,0 +1,26 @@ +source = $source; + } + + /** + * Encode current source + */ + public function encode(): string + { + return pack('C', $this->source->getSize()) . $this->source->getValue(); + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Encoders/FrameBlockEncoder.php b/upLoadImage/vendor/intervention/gif/src/Encoders/FrameBlockEncoder.php new file mode 100644 index 0000000..9cf428e --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Encoders/FrameBlockEncoder.php @@ -0,0 +1,47 @@ +source = $source; + } + + /** + * @throws EncoderException + */ + public function encode(): string + { + $graphicControlExtension = $this->source->getGraphicControlExtension(); + $colorTable = $this->source->getColorTable(); + $plainTextExtension = $this->source->getPlainTextExtension(); + + return implode('', [ + implode('', array_map( + fn(ApplicationExtension $extension): string => $extension->encode(), + $this->source->getApplicationExtensions(), + )), + implode('', array_map( + fn(CommentExtension $extension): string => $extension->encode(), + $this->source->getCommentExtensions(), + )), + $plainTextExtension ? $plainTextExtension->encode() : '', + $graphicControlExtension ? $graphicControlExtension->encode() : '', + $this->source->getImageDescriptor()->encode(), + $colorTable ? $colorTable->encode() : '', + $this->source->getImageData()->encode(), + ]); + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Encoders/GifDataStreamEncoder.php b/upLoadImage/vendor/intervention/gif/src/Encoders/GifDataStreamEncoder.php new file mode 100644 index 0000000..376fa8b --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Encoders/GifDataStreamEncoder.php @@ -0,0 +1,73 @@ +source = $source; + } + + /** + * Encode current source + * + * @throws EncoderException + */ + public function encode(): string + { + return implode('', [ + $this->source->getHeader()->encode(), + $this->source->getLogicalScreenDescriptor()->encode(), + $this->maybeEncodeGlobalColorTable(), + $this->encodeFrames(), + $this->encodeComments(), + $this->source->getTrailer()->encode(), + ]); + } + + protected function maybeEncodeGlobalColorTable(): string + { + if (!$this->source->hasGlobalColorTable()) { + return ''; + } + + return $this->source->getGlobalColorTable()->encode(); + } + + /** + * Encode data blocks of source + * + * @throws EncoderException + */ + protected function encodeFrames(): string + { + return implode('', array_map( + fn(FrameBlock $frame): string => $frame->encode(), + $this->source->getFrames(), + )); + } + + /** + * Encode comment extension blocks of source + * + * @throws EncoderException + */ + protected function encodeComments(): string + { + return implode('', array_map( + fn(CommentExtension $commentExtension): string => $commentExtension->encode(), + $this->source->getComments() + )); + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Encoders/GraphicControlExtensionEncoder.php b/upLoadImage/vendor/intervention/gif/src/Encoders/GraphicControlExtensionEncoder.php new file mode 100644 index 0000000..eb952a8 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Encoders/GraphicControlExtensionEncoder.php @@ -0,0 +1,63 @@ +source = $source; + } + + /** + * Encode current source + */ + public function encode(): string + { + return implode('', [ + GraphicControlExtension::MARKER, + GraphicControlExtension::LABEL, + GraphicControlExtension::BLOCKSIZE, + $this->encodePackedField(), + $this->encodeDelay(), + $this->encodeTransparentColorIndex(), + GraphicControlExtension::TERMINATOR, + ]); + } + + /** + * Encode delay time + */ + protected function encodeDelay(): string + { + return pack('v*', $this->source->getDelay()); + } + + /** + * Encode transparent color index + */ + protected function encodeTransparentColorIndex(): string + { + return pack('C', $this->source->getTransparentColorIndex()); + } + + /** + * Encode packed field + */ + protected function encodePackedField(): string + { + return pack('C', bindec(implode('', [ + str_pad('0', 3, '0', STR_PAD_LEFT), + str_pad(decbin($this->source->getDisposalMethod()->value), 3, '0', STR_PAD_LEFT), + (int) $this->source->getUserInput(), + (int) $this->source->getTransparentColorExistance(), + ]))); + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Encoders/HeaderEncoder.php b/upLoadImage/vendor/intervention/gif/src/Encoders/HeaderEncoder.php new file mode 100644 index 0000000..37ceacf --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Encoders/HeaderEncoder.php @@ -0,0 +1,26 @@ +source = $source; + } + + /** + * Encode current source + */ + public function encode(): string + { + return Header::SIGNATURE . $this->source->getVersion(); + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Encoders/ImageDataEncoder.php b/upLoadImage/vendor/intervention/gif/src/Encoders/ImageDataEncoder.php new file mode 100644 index 0000000..9214626 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Encoders/ImageDataEncoder.php @@ -0,0 +1,42 @@ +source = $source; + } + + /** + * Encode current source + * + * @throws EncoderException + */ + public function encode(): string + { + if (!$this->source->hasBlocks()) { + throw new EncoderException("No data blocks in ImageData."); + } + + return implode('', [ + pack('C', $this->source->getLzwMinCodeSize()), + implode('', array_map( + fn(DataSubBlock $block): string => $block->encode(), + $this->source->getBlocks(), + )), + AbstractEntity::TERMINATOR, + ]); + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Encoders/ImageDescriptorEncoder.php b/upLoadImage/vendor/intervention/gif/src/Encoders/ImageDescriptorEncoder.php new file mode 100644 index 0000000..42814b1 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Encoders/ImageDescriptorEncoder.php @@ -0,0 +1,95 @@ +source = $source; + } + + /** + * Encode current source + */ + public function encode(): string + { + return implode('', [ + ImageDescriptor::SEPARATOR, + $this->encodeLeft(), + $this->encodeTop(), + $this->encodeWidth(), + $this->encodeHeight(), + $this->encodePackedField(), + ]); + } + + /** + * Encode left value + */ + protected function encodeLeft(): string + { + return pack('v*', $this->source->getLeft()); + } + + /** + * Encode top value + */ + protected function encodeTop(): string + { + return pack('v*', $this->source->getTop()); + } + + /** + * Encode width value + */ + protected function encodeWidth(): string + { + return pack('v*', $this->source->getWidth()); + } + + /** + * Encode height value + */ + protected function encodeHeight(): string + { + return pack('v*', $this->source->getHeight()); + } + + /** + * Encode size of local color table + */ + protected function encodeLocalColorTableSize(): string + { + return str_pad(decbin($this->source->getLocalColorTableSize()), 3, '0', STR_PAD_LEFT); + } + + /** + * Encode reserved field + */ + protected function encodeReservedField(): string + { + return str_pad('0', 2, '0', STR_PAD_LEFT); + } + + /** + * Encode packed field + */ + protected function encodePackedField(): string + { + return pack('C', bindec(implode('', [ + (int) $this->source->getLocalColorTableExistance(), + (int) $this->source->isInterlaced(), + (int) $this->source->getLocalColorTableSorted(), + $this->encodeReservedField(), + $this->encodeLocalColorTableSize(), + ]))); + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Encoders/LogicalScreenDescriptorEncoder.php b/upLoadImage/vendor/intervention/gif/src/Encoders/LogicalScreenDescriptorEncoder.php new file mode 100644 index 0000000..ff393d8 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Encoders/LogicalScreenDescriptorEncoder.php @@ -0,0 +1,93 @@ +source = $source; + } + + /** + * Encode current source + */ + public function encode(): string + { + return implode('', [ + $this->encodeWidth(), + $this->encodeHeight(), + $this->encodePackedField(), + $this->encodeBackgroundColorIndex(), + $this->encodePixelAspectRatio(), + ]); + } + + /** + * Encode width of current instance + */ + protected function encodeWidth(): string + { + return pack('v*', $this->source->getWidth()); + } + + /** + * Encode height of current instance + */ + protected function encodeHeight(): string + { + return pack('v*', $this->source->getHeight()); + } + + /** + * Encode background color index of global color table + */ + protected function encodeBackgroundColorIndex(): string + { + return pack('C', $this->source->getBackgroundColorIndex()); + } + + /** + * Encode pixel aspect ratio + */ + protected function encodePixelAspectRatio(): string + { + return pack('C', $this->source->getPixelAspectRatio()); + } + + /** + * Return color resolution for encoding + */ + protected function encodeColorResolution(): string + { + return str_pad(decbin($this->source->getBitsPerPixel() - 1), 3, '0', STR_PAD_LEFT); + } + + /** + * Encode size of global color table + */ + protected function encodeGlobalColorTableSize(): string + { + return str_pad(decbin($this->source->getGlobalColorTableSize()), 3, '0', STR_PAD_LEFT); + } + + /** + * Encode packed field of current instance + */ + protected function encodePackedField(): string + { + return pack('C', bindec(implode('', [ + (int) $this->source->getGlobalColorTableExistance(), + $this->encodeColorResolution(), + (int) $this->source->getGlobalColorTableSorted(), + $this->encodeGlobalColorTableSize(), + ]))); + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Encoders/NetscapeApplicationExtensionEncoder.php b/upLoadImage/vendor/intervention/gif/src/Encoders/NetscapeApplicationExtensionEncoder.php new file mode 100644 index 0000000..40f97f0 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Encoders/NetscapeApplicationExtensionEncoder.php @@ -0,0 +1,35 @@ +source = $source; + } + + /** + * Encode current source + */ + public function encode(): string + { + return implode('', [ + ApplicationExtension::MARKER, + ApplicationExtension::LABEL, + pack('C', $this->source->getBlockSize()), + $this->source->getApplication(), + implode('', array_map(fn(DataSubBlock $block): string => $block->encode(), $this->source->getBlocks())), + ApplicationExtension::TERMINATOR, + ]); + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Encoders/PlainTextExtensionEncoder.php b/upLoadImage/vendor/intervention/gif/src/Encoders/PlainTextExtensionEncoder.php new file mode 100644 index 0000000..dd1244e --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Encoders/PlainTextExtensionEncoder.php @@ -0,0 +1,55 @@ +source = $source; + } + + /** + * Encode current source + */ + public function encode(): string + { + if (!$this->source->hasText()) { + return ''; + } + + return implode('', [ + PlainTextExtension::MARKER, + PlainTextExtension::LABEL, + $this->encodeHead(), + $this->encodeTexts(), + PlainTextExtension::TERMINATOR, + ]); + } + + /** + * Encode head block + */ + protected function encodeHead(): string + { + return "\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; + } + + /** + * Encode text chunks + */ + protected function encodeTexts(): string + { + return implode('', array_map( + fn(string $text): string => pack('C', strlen($text)) . $text, + $this->source->getText(), + )); + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Encoders/TableBasedImageEncoder.php b/upLoadImage/vendor/intervention/gif/src/Encoders/TableBasedImageEncoder.php new file mode 100644 index 0000000..6769866 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Encoders/TableBasedImageEncoder.php @@ -0,0 +1,24 @@ +source = $source; + } + + public function encode(): string + { + return implode('', [ + $this->source->getImageDescriptor()->encode(), + $this->source->getColorTable() ? $this->source->getColorTable()->encode() : '', + $this->source->getImageData()->encode(), + ]); + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Encoders/TrailerEncoder.php b/upLoadImage/vendor/intervention/gif/src/Encoders/TrailerEncoder.php new file mode 100644 index 0000000..36c8367 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Encoders/TrailerEncoder.php @@ -0,0 +1,26 @@ +source = $source; + } + + /** + * Encode current source + */ + public function encode(): string + { + return Trailer::MARKER; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Exceptions/DecoderException.php b/upLoadImage/vendor/intervention/gif/src/Exceptions/DecoderException.php new file mode 100644 index 0000000..f8b8981 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Exceptions/DecoderException.php @@ -0,0 +1,10 @@ + $frames + * @param array $comments + */ + public function __construct( + protected Header $header = new Header(), + protected LogicalScreenDescriptor $logicalScreenDescriptor = new LogicalScreenDescriptor(), + protected ?ColorTable $globalColorTable = null, + protected array $frames = [], + protected array $comments = [] + ) { + // + } + + /** + * Get header + */ + public function getHeader(): Header + { + return $this->header; + } + + /** + * Set header + */ + public function setHeader(Header $header): self + { + $this->header = $header; + + return $this; + } + + /** + * Get logical screen descriptor + */ + public function getLogicalScreenDescriptor(): LogicalScreenDescriptor + { + return $this->logicalScreenDescriptor; + } + + /** + * Set logical screen descriptor + */ + public function setLogicalScreenDescriptor(LogicalScreenDescriptor $descriptor): self + { + $this->logicalScreenDescriptor = $descriptor; + + return $this; + } + + /** + * Return global color table if available else null + */ + public function getGlobalColorTable(): ?ColorTable + { + return $this->globalColorTable; + } + + /** + * Set global color table + */ + public function setGlobalColorTable(ColorTable $table): self + { + $this->globalColorTable = $table; + $this->logicalScreenDescriptor->setGlobalColorTableExistance(true); + $this->logicalScreenDescriptor->setGlobalColorTableSize( + $table->getLogicalSize() + ); + + return $this; + } + + /** + * Get main graphic control extension + */ + public function getMainApplicationExtension(): ?NetscapeApplicationExtension + { + foreach ($this->frames as $frame) { + if ($extension = $frame->getNetscapeExtension()) { + return $extension; + } + } + + return null; + } + + /** + * Get array of frames + * + * @return array + */ + public function getFrames(): array + { + return $this->frames; + } + + /** + * Return array of "global" comments + * + * @return array + */ + public function getComments(): array + { + return $this->comments; + } + + /** + * Return first frame + */ + public function getFirstFrame(): ?FrameBlock + { + if (!array_key_exists(0, $this->frames)) { + return null; + } + + return $this->frames[0]; + } + + /** + * Add frame + */ + public function addFrame(FrameBlock $frame): self + { + $this->frames[] = $frame; + + return $this; + } + + /** + * Add comment extension + */ + public function addComment(CommentExtension $comment): self + { + $this->comments[] = $comment; + + return $this; + } + + /** + * Set the current data + * + * @param array $frames + */ + public function setFrames(array $frames): self + { + $this->frames = $frames; + + return $this; + } + + /** + * Get trailer + */ + public function getTrailer(): Trailer + { + return new Trailer(); + } + + /** + * Determine if gif is animated + */ + public function isAnimated(): bool + { + return count($this->getFrames()) > 1; + } + + /** + * Determine if global color table is set + */ + public function hasGlobalColorTable(): bool + { + return !is_null($this->globalColorTable); + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Splitter.php b/upLoadImage/vendor/intervention/gif/src/Splitter.php new file mode 100644 index 0000000..c0bdfe2 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Splitter.php @@ -0,0 +1,281 @@ + + */ +class Splitter implements IteratorAggregate +{ + /** + * Single frames resolved to GifDataStream + * + * @var array + */ + protected array $frames = []; + + /** + * Delays of each frame + * + * @var array + */ + protected array $delays = []; + + /** + * Create new instance + */ + public function __construct(protected GifDataStream $stream) + { + // + } + + /** + * Static constructor method + */ + public static function create(GifDataStream $stream): self + { + return new self($stream); + } + + /** + * Iterator + */ + public function getIterator(): Traversable + { + return new ArrayIterator($this->frames); + } + + /** + * Get frames + * + * @return array + */ + public function getFrames(): array + { + return $this->frames; + } + + /** + * Get delays + * + * @return array + */ + public function getDelays(): array + { + return $this->delays; + } + + /** + * Set stream of instance + */ + public function setStream(GifDataStream $stream): self + { + $this->stream = $stream; + + return $this; + } + + /** + * Split current stream into array of seperate streams for each frame + */ + public function split(): self + { + $this->frames = []; + + foreach ($this->stream->getFrames() as $frame) { + // create separate stream for each frame + $gif = Builder::canvas( + $this->stream->getLogicalScreenDescriptor()->getWidth(), + $this->stream->getLogicalScreenDescriptor()->getHeight() + )->getGifDataStream(); + + // check if working stream has global color table + if ($this->stream->hasGlobalColorTable()) { + $gif->setGlobalColorTable($this->stream->getGlobalColorTable()); + $gif->getLogicalScreenDescriptor()->setGlobalColorTableExistance(true); + + $gif->getLogicalScreenDescriptor()->setGlobalColorTableSorted( + $this->stream->getLogicalScreenDescriptor()->getGlobalColorTableSorted() + ); + + $gif->getLogicalScreenDescriptor()->setGlobalColorTableSize( + $this->stream->getLogicalScreenDescriptor()->getGlobalColorTableSize() + ); + + $gif->getLogicalScreenDescriptor()->setBackgroundColorIndex( + $this->stream->getLogicalScreenDescriptor()->getBackgroundColorIndex() + ); + + $gif->getLogicalScreenDescriptor()->setPixelAspectRatio( + $this->stream->getLogicalScreenDescriptor()->getPixelAspectRatio() + ); + + $gif->getLogicalScreenDescriptor()->setBitsPerPixel( + $this->stream->getLogicalScreenDescriptor()->getBitsPerPixel() + ); + } + + // copy original frame + $gif->addFrame($frame); + + $this->frames[] = $gif; + $this->delays[] = match (is_object($frame->getGraphicControlExtension())) { + true => $frame->getGraphicControlExtension()->getDelay(), + default => 0, + }; + } + + return $this; + } + + /** + * Return array of GD library resources for each frame + * + * @throws EncoderException + * @return array + */ + public function toResources(): array + { + $resources = []; + + foreach ($this->frames as $frame) { + $resource = imagecreatefromstring($frame->encode()); + if ($resource === false) { + throw new EncoderException('Unable to extract animation frames.'); + } + + imagepalettetotruecolor($resource); + imagesavealpha($resource, true); + $resources[] = $resource; + } + + return $resources; + } + + /** + * Return array of coalesced GD library resources for each frame + * + * @throws EncoderException + * @return array + */ + public function coalesceToResources(): array + { + $resources = $this->toResources(); + + // static gif files don't need to be coalesced + if (count($resources) === 1) { + return $resources; + } + + $width = imagesx($resources[0]); + $height = imagesy($resources[0]); + $transparent = imagecolortransparent($resources[0]); + + foreach ($resources as $key => $resource) { + // get meta data + $gif = $this->frames[$key]; + $descriptor = $gif->getFirstFrame()->getImageDescriptor(); + $offset_x = $descriptor->getLeft(); + $offset_y = $descriptor->getTop(); + $w = $descriptor->getWidth(); + $h = $descriptor->getHeight(); + + if (in_array($this->getDisposalMethod($gif), [DisposalMethod::NONE, DisposalMethod::PREVIOUS])) { + if ($key >= 1) { + // create normalized gd image + $canvas = imagecreatetruecolor($width, $height); + if (imagecolortransparent($resource) != -1) { + $transparent = imagecolortransparent($resource); + } else { + $transparent = imagecolorallocatealpha($resource, 255, 0, 255, 127); + } + + if (!is_int($transparent)) { + throw new EncoderException('Animation frames cannot be converted into resources.'); + } + + // fill with transparent + imagefill($canvas, 0, 0, $transparent); + imagecolortransparent($canvas, $transparent); + imagealphablending($canvas, true); + + // insert last as base + imagecopy( + $canvas, + $resources[$key - 1], + 0, + 0, + 0, + 0, + $width, + $height + ); + + // insert resource + imagecopy( + $canvas, + $resource, + $offset_x, + $offset_y, + 0, + 0, + $w, + $h + ); + } else { + imagealphablending($resource, true); + $canvas = $resource; + } + } else { + // create normalized gd image + $canvas = imagecreatetruecolor($width, $height); + if (imagecolortransparent($resource) != -1) { + $transparent = imagecolortransparent($resource); + } else { + $transparent = imagecolorallocatealpha($resource, 255, 0, 255, 127); + } + + if (!is_int($transparent)) { + throw new EncoderException('Animation frames cannot be converted into resources.'); + } + + // fill with transparent + imagefill($canvas, 0, 0, $transparent); + imagecolortransparent($canvas, $transparent); + imagealphablending($canvas, true); + + // insert frame resource + imagecopy( + $canvas, + $resource, + $offset_x, + $offset_y, + 0, + 0, + $w, + $h + ); + } + + $resources[$key] = $canvas; + } + + return $resources; + } + + /** + * Find and return disposal method of given gif data stream + */ + private function getDisposalMethod(GifDataStream $gif): DisposalMethod + { + return $gif->getFirstFrame()->getGraphicControlExtension()->getDisposalMethod(); + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Traits/CanDecode.php b/upLoadImage/vendor/intervention/gif/src/Traits/CanDecode.php new file mode 100644 index 0000000..56304d8 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Traits/CanDecode.php @@ -0,0 +1,43 @@ +decode(); + } + + /** + * Get decoder for current instance + * + * @throws DecoderException + */ + protected static function getDecoder(mixed $source, ?int $length = null): AbstractDecoder + { + $classname = sprintf('Intervention\Gif\Decoders\%sDecoder', self::getShortClassname()); + + if (!class_exists($classname)) { + throw new DecoderException("Decoder for '" . static::class . "' not found."); + } + + $decoder = new $classname($source, $length); + + if (!($decoder instanceof AbstractDecoder)) { + throw new DecoderException("Decoder for '" . static::class . "' not found."); + } + + return $decoder; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Traits/CanEncode.php b/upLoadImage/vendor/intervention/gif/src/Traits/CanEncode.php new file mode 100644 index 0000000..6d117b0 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Traits/CanEncode.php @@ -0,0 +1,43 @@ +getEncoder()->encode(); + } + + /** + * Get encoder object for current entity + * + * @throws EncoderException + */ + protected function getEncoder(): AbstractEncoder + { + $classname = sprintf('Intervention\Gif\Encoders\%sEncoder', $this->getShortClassname()); + + if (!class_exists($classname)) { + throw new EncoderException("Encoder for '" . $this::class . "' not found."); + } + + $encoder = new $classname($this); + + if (!($encoder instanceof AbstractEncoder)) { + throw new EncoderException("Encoder for '" . $this::class . "' not found."); + } + + return $encoder; + } +} diff --git a/upLoadImage/vendor/intervention/gif/src/Traits/CanHandleFiles.php b/upLoadImage/vendor/intervention/gif/src/Traits/CanHandleFiles.php new file mode 100644 index 0000000..5c96678 --- /dev/null +++ b/upLoadImage/vendor/intervention/gif/src/Traits/CanHandleFiles.php @@ -0,0 +1,53 @@ +read('images/example.gif'); + +// resize image instance +$image->resize(height: 300); + +// insert a watermark +$image->place('images/watermark.png'); + +// encode edited image +$encoded = $image->toJpg(); + +// save encoded image +$encoded->save('images/example.jpg'); +``` + +## Requirements + +Before you begin with the installation make sure that your server environment +supports the following requirements. + +- PHP >= 8.1 +- Mbstring PHP Extension +- Image Processing PHP Extension + +## Supported Image Libraries + +Depending on your environment Intervention Image lets you choose between +different image processing extensions. + +- GD Library +- Imagick PHP extension +- [libvips](https://github.com/Intervention/image-driver-vips) + +## Security + +If you discover any security related issues, please email oliver@intervention.io directly. + +## Authors + +This library is developed and maintained by [Oliver Vogel](https://intervention.io) + +Thanks to the community of [contributors](https://github.com/Intervention/image/graphs/contributors) who have helped to improve this project. + +## License + +Intervention Image is licensed under the [MIT License](LICENSE). diff --git a/upLoadImage/vendor/intervention/image/src/Analyzers/ColorspaceAnalyzer.php b/upLoadImage/vendor/intervention/image/src/Analyzers/ColorspaceAnalyzer.php new file mode 100644 index 0000000..e3cd1c1 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Analyzers/ColorspaceAnalyzer.php @@ -0,0 +1,12 @@ + + */ +class Collection implements CollectionInterface, IteratorAggregate, Countable +{ + /** + * Create new collection object + * + * @param array $items + * @return void + */ + public function __construct(protected array $items = []) + { + // + } + + /** + * Static constructor + * + * @param array $items + * @return self + */ + public static function create(array $items = []): self + { + return new self($items); + } + + /** + * {@inheritdoc} + * + * @see CollectionInterface::has() + */ + public function has(int|string $key): bool + { + return array_key_exists($key, $this->items); + } + + /** + * Returns Iterator + * + * @return Traversable + */ + public function getIterator(): Traversable + { + return new ArrayIterator($this->items); + } + + /** + * {@inheritdoc} + * + * @see CollectionInterface::toArray() + */ + public function toArray(): array + { + return $this->items; + } + + /** + * Count items in collection + */ + public function count(): int + { + return count($this->items); + } + + /** + * Append new item to collection + * + * @return CollectionInterface + */ + public function push(mixed $item): CollectionInterface + { + $this->items[] = $item; + + return $this; + } + + /** + * Return first item in collection + */ + public function first(): mixed + { + if ($item = reset($this->items)) { + return $item; + } + + return null; + } + + /** + * Returns last item in collection + */ + public function last(): mixed + { + if ($item = end($this->items)) { + return $item; + } + + return null; + } + + /** + * Return item at given position starting at 0 + */ + public function getAtPosition(int $key = 0, mixed $default = null): mixed + { + if ($this->count() == 0) { + return $default; + } + + $positions = array_values($this->items); + if (!array_key_exists($key, $positions)) { + return $default; + } + + return $positions[$key]; + } + + /** + * {@inheritdoc} + * + * @see CollectionInterface::get() + */ + public function get(int|string $query, mixed $default = null): mixed + { + if ($this->count() == 0) { + return $default; + } + + if (is_int($query) && array_key_exists($query, $this->items)) { + return $this->items[$query]; + } + + if (is_string($query) && !str_contains($query, '.')) { + return array_key_exists($query, $this->items) ? $this->items[$query] : $default; + } + + $query = explode('.', (string) $query); + + $result = $default; + $items = $this->items; + foreach ($query as $key) { + if (!is_array($items) || !array_key_exists($key, $items)) { + $result = $default; + break; + } + + $result = $items[$key]; + $items = $result; + } + + return $result; + } + + /** + * Map each item of collection by given callback + */ + public function map(callable $callback): self + { + + return new self( + array_map( + fn(mixed $item) => $callback($item), + $this->items, + ) + ); + } + + /** + * Run callback on each item of the collection an remove it if it does not return true + */ + public function filter(callable $callback): self + { + return new self( + array_filter( + $this->items, + fn(mixed $item) => $callback($item), + ) + ); + } + + /** + * {@inheritdoc} + * + * @see CollectionInterface::empty() + */ + public function empty(): CollectionInterface + { + $this->items = []; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see CollectionInterface::slice() + */ + public function slice(int $offset, ?int $length = null): CollectionInterface + { + $this->items = array_slice($this->items, $offset, $length); + + return $this; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Colors/AbstractColor.php b/upLoadImage/vendor/intervention/image/src/Colors/AbstractColor.php new file mode 100644 index 0000000..9628795 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Colors/AbstractColor.php @@ -0,0 +1,116 @@ + + */ + protected array $channels; + + /** + * {@inheritdoc} + * + * @see ColorInterface::channels() + */ + public function channels(): array + { + return $this->channels; + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::channel() + */ + public function channel(string $classname): ColorChannelInterface + { + $channels = array_filter( + $this->channels(), + fn(ColorChannelInterface $channel): bool => $channel::class === $classname, + ); + + if (count($channels) == 0) { + throw new ColorException('Color channel ' . $classname . ' could not be found.'); + } + + return reset($channels); + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::normalize() + */ + public function normalize(): array + { + return array_map( + fn(ColorChannelInterface $channel): float => $channel->normalize(), + $this->channels(), + ); + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::toArray() + */ + public function toArray(): array + { + return array_map( + fn(ColorChannelInterface $channel): int => $channel->value(), + $this->channels() + ); + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::convertTo() + */ + public function convertTo(string|ColorspaceInterface $colorspace): ColorInterface + { + $colorspace = match (true) { + is_object($colorspace) => $colorspace, + default => new $colorspace(), + }; + + return $colorspace->importColor($this); + } + + /** + * Show debug info for the current color + * + * @return array + */ + public function __debugInfo(): array + { + return array_reduce($this->channels(), function (array $result, ColorChannelInterface $item) { + $key = strtolower((new ReflectionClass($item))->getShortName()); + $result[$key] = $item->value(); + return $result; + }, []); + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::__toString() + */ + public function __toString(): string + { + return $this->toString(); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Colors/AbstractColorChannel.php b/upLoadImage/vendor/intervention/image/src/Colors/AbstractColorChannel.php new file mode 100644 index 0000000..5c52909 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Colors/AbstractColorChannel.php @@ -0,0 +1,92 @@ +value = $this->validate( + match (true) { + is_null($value) && is_numeric($normalized) => intval(round($normalized * $this->max())), + is_numeric($value) && is_null($normalized) => $value, + default => throw new ColorException('Color channels must either have a value or a normalized value') + } + ); + } + + /** + * Alias of value() + */ + public function toInt(): int + { + return $this->value; + } + + /** + * {@inheritdoc} + * + * @see ColorChannelInterface::value() + */ + public function value(): int + { + return $this->value; + } + + /** + * {@inheritdoc} + * + * @see ColorChannelInterface::normalize() + */ + public function normalize(int $precision = 32): float + { + return round(($this->value() - $this->min()) / ($this->max() - $this->min()), $precision); + } + + /** + * {@inheritdoc} + * + * @see ColorChannelInterface::validate() + */ + public function validate(mixed $value): mixed + { + if ($value < $this->min() || $value > $this->max()) { + throw new ColorException('Color channel value must be in range ' . $this->min() . ' to ' . $this->max()); + } + + return $value; + } + + /** + * {@inheritdoc} + * + * @see ColorChannelInterface::toString() + */ + public function toString(): string + { + return (string) $this->value(); + } + + /** + * {@inheritdoc} + * + * @see ColorChannelInterface::__toString() + */ + public function __toString(): string + { + return $this->toString(); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Colors/Cmyk/Channels/Cyan.php b/upLoadImage/vendor/intervention/image/src/Colors/Cmyk/Channels/Cyan.php new file mode 100644 index 0000000..f56b095 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Colors/Cmyk/Channels/Cyan.php @@ -0,0 +1,20 @@ +channels = [ + new Cyan($c), + new Magenta($m), + new Yellow($y), + new Key($k), + ]; + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::create() + */ + public static function create(mixed $input): ColorInterface + { + return InputHandler::withDecoders([ + Decoders\StringColorDecoder::class, + ])->handle($input); + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::colorspace() + */ + public function colorspace(): ColorspaceInterface + { + return new Colorspace(); + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::toHex() + */ + public function toHex(string $prefix = ''): string + { + return $this->convertTo(RgbColorspace::class)->toHex($prefix); + } + + /** + * Return the CMYK cyan channel + */ + public function cyan(): ColorChannelInterface + { + /** @throws void */ + return $this->channel(Cyan::class); + } + + /** + * Return the CMYK magenta channel + */ + public function magenta(): ColorChannelInterface + { + /** @throws void */ + return $this->channel(Magenta::class); + } + + /** + * Return the CMYK yellow channel + */ + public function yellow(): ColorChannelInterface + { + /** @throws void */ + return $this->channel(Yellow::class); + } + + /** + * Return the CMYK key channel + */ + public function key(): ColorChannelInterface + { + /** @throws void */ + return $this->channel(Key::class); + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::toString() + */ + public function toString(): string + { + return sprintf( + 'cmyk(%d%%, %d%%, %d%%, %d%%)', + $this->cyan()->value(), + $this->magenta()->value(), + $this->yellow()->value(), + $this->key()->value() + ); + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::isGreyscale() + */ + public function isGreyscale(): bool + { + return 0 === array_sum([ + $this->cyan()->value(), + $this->magenta()->value(), + $this->yellow()->value(), + ]); + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::isTransparent() + */ + public function isTransparent(): bool + { + return false; + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::isClear() + */ + public function isClear(): bool + { + return false; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Colors/Cmyk/Colorspace.php b/upLoadImage/vendor/intervention/image/src/Colors/Cmyk/Colorspace.php new file mode 100644 index 0000000..4484ef7 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Colors/Cmyk/Colorspace.php @@ -0,0 +1,77 @@ + + */ + public static array $channels = [ + Channels\Cyan::class, + Channels\Magenta::class, + Channels\Yellow::class, + Channels\Key::class + ]; + + /** + * {@inheritdoc} + * + * @see ColorspaceInterface::createColor() + */ + public function colorFromNormalized(array $normalized): ColorInterface + { + return new Color(...array_map( + fn(string $classname, float $value_normalized) => (new $classname(normalized: $value_normalized))->value(), + self::$channels, + $normalized, + )); + } + + /** + * @throws ColorException + */ + public function importColor(ColorInterface $color): ColorInterface + { + return match ($color::class) { + RgbColor::class => $this->importRgbColor($color), + HsvColor::class => $this->importRgbColor($color->convertTo(RgbColorspace::class)), + HslColor::class => $this->importRgbColor($color->convertTo(RgbColorspace::class)), + default => $color, + }; + } + + /** + * @throws ColorException + */ + protected function importRgbColor(ColorInterface $color): CmykColor + { + if (!($color instanceof RgbColor)) { + throw new ColorException('Unabled to import color of type ' . $color::class . '.'); + } + + $c = (255 - $color->red()->value()) / 255.0 * 100; + $m = (255 - $color->green()->value()) / 255.0 * 100; + $y = (255 - $color->blue()->value()) / 255.0 * 100; + $k = intval(round(min([$c, $m, $y]))); + + $c = intval(round($c - $k)); + $m = intval(round($m - $k)); + $y = intval(round($y - $k)); + + return new CmykColor($c, $m, $y, $k); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Colors/Cmyk/Decoders/StringColorDecoder.php b/upLoadImage/vendor/intervention/image/src/Colors/Cmyk/Decoders/StringColorDecoder.php new file mode 100644 index 0000000..e160f2e --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Colors/Cmyk/Decoders/StringColorDecoder.php @@ -0,0 +1,36 @@ +[0-9\.]+%?), ?(?P[0-9\.]+%?), ?(?P[0-9\.]+%?), ?(?P[0-9\.]+%?)\)$/i'; + if (preg_match($pattern, $input, $matches) != 1) { + throw new DecoderException('Unable to decode input'); + } + + $values = array_map(function (string $value): int { + return intval(round(floatval(trim(str_replace('%', '', $value))))); + }, [$matches['c'], $matches['m'], $matches['y'], $matches['k']]); + + return new Color(...$values); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Colors/Hsl/Channels/Hue.php b/upLoadImage/vendor/intervention/image/src/Colors/Hsl/Channels/Hue.php new file mode 100644 index 0000000..049a849 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Colors/Hsl/Channels/Hue.php @@ -0,0 +1,30 @@ +channels = [ + new Hue($h), + new Saturation($s), + new Luminance($l), + ]; + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::colorspace() + */ + public function colorspace(): ColorspaceInterface + { + return new Colorspace(); + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::create() + */ + public static function create(mixed $input): ColorInterface + { + return InputHandler::withDecoders([ + Decoders\StringColorDecoder::class, + ])->handle($input); + } + + /** + * Return the Hue channel + */ + public function hue(): ColorChannelInterface + { + /** @throws void */ + return $this->channel(Hue::class); + } + + /** + * Return the Saturation channel + */ + public function saturation(): ColorChannelInterface + { + /** @throws void */ + return $this->channel(Saturation::class); + } + + /** + * Return the Luminance channel + */ + public function luminance(): ColorChannelInterface + { + /** @throws void */ + return $this->channel(Luminance::class); + } + + public function toHex(string $prefix = ''): string + { + return $this->convertTo(RgbColorspace::class)->toHex($prefix); + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::toString() + */ + public function toString(): string + { + return sprintf( + 'hsl(%d, %d%%, %d%%)', + $this->hue()->value(), + $this->saturation()->value(), + $this->luminance()->value() + ); + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::isGreyscale() + */ + public function isGreyscale(): bool + { + return $this->saturation()->value() == 0; + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::isTransparent() + */ + public function isTransparent(): bool + { + return false; + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::isClear() + */ + public function isClear(): bool + { + return false; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Colors/Hsl/Colorspace.php b/upLoadImage/vendor/intervention/image/src/Colors/Hsl/Colorspace.php new file mode 100644 index 0000000..de4c2cf --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Colors/Hsl/Colorspace.php @@ -0,0 +1,137 @@ + + */ + public static array $channels = [ + Channels\Hue::class, + Channels\Saturation::class, + Channels\Luminance::class + ]; + + /** + * {@inheritdoc} + * + * @see ColorspaceInterface::colorFromNormalized() + */ + public function colorFromNormalized(array $normalized): ColorInterface + { + return new Color(...array_map( + fn(string $classname, float $value_normalized) => (new $classname(normalized: $value_normalized))->value(), + self::$channels, + $normalized + )); + } + + /** + * @throws ColorException + */ + public function importColor(ColorInterface $color): ColorInterface + { + return match ($color::class) { + CmykColor::class => $this->importRgbColor($color->convertTo(RgbColorspace::class)), + RgbColor::class => $this->importRgbColor($color), + HsvColor::class => $this->importHsvColor($color), + default => $color, + }; + } + + /** + * @throws ColorException + */ + protected function importRgbColor(ColorInterface $color): ColorInterface + { + if (!($color instanceof RgbColor)) { + throw new ColorException('Unabled to import color of type ' . $color::class . '.'); + } + + // normalized values of rgb channels + $values = array_map( + fn(ColorChannelInterface $channel): float => $channel->normalize(), + $color->channels(), + ); + + // take only RGB + $values = array_slice($values, 0, 3); + + // calculate Luminance + $min = min(...$values); + $max = max(...$values); + $luminance = ($max + $min) / 2; + $delta = $max - $min; + + // calculate saturation + $saturation = match (true) { + $delta == 0 => 0, + default => $delta / (1 - abs(2 * $luminance - 1)), + }; + + // calculate hue + [$r, $g, $b] = $values; + $hue = match (true) { + ($delta == 0) => 0, + ($max == $r) => 60 * fmod((($g - $b) / $delta), 6), + ($max == $g) => 60 * ((($b - $r) / $delta) + 2), + ($max == $b) => 60 * ((($r - $g) / $delta) + 4), + default => 0, + }; + + $hue = ($hue + 360) % 360; // normalize hue + + return new Color( + intval(round($hue)), + intval(round($saturation * 100)), + intval(round($luminance * 100)), + ); + } + + /** + * @throws ColorException + */ + protected function importHsvColor(ColorInterface $color): ColorInterface + { + if (!($color instanceof HsvColor)) { + throw new ColorException('Unabled to import color of type ' . $color::class . '.'); + } + + // normalized values of hsv channels + [$h, $s, $v] = array_map( + fn(ColorChannelInterface $channel): float => $channel->normalize(), + $color->channels(), + ); + + // calculate Luminance + $luminance = (2 - $s) * $v / 2; + + // calculate Saturation + $saturation = match (true) { + $luminance == 0 => $s, + $luminance == 1 => 0, + $luminance < .5 => $s * $v / ($luminance * 2), + default => $s * $v / (2 - $luminance * 2), + }; + + return new Color( + intval(round($h * 360)), + intval(round($saturation * 100)), + intval(round($luminance * 100)), + ); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Colors/Hsl/Decoders/StringColorDecoder.php b/upLoadImage/vendor/intervention/image/src/Colors/Hsl/Decoders/StringColorDecoder.php new file mode 100644 index 0000000..8ea7ed9 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Colors/Hsl/Decoders/StringColorDecoder.php @@ -0,0 +1,39 @@ +[0-9\.]+), ?(?P[0-9\.]+%?), ?(?P[0-9\.]+%?)\)$/i'; + if (preg_match($pattern, $input, $matches) != 1) { + throw new DecoderException('Unable to decode input'); + } + + $values = array_map(function (string $value): int { + return match (strpos($value, '%')) { + false => intval(trim($value)), + default => intval(trim(str_replace('%', '', $value))), + }; + }, [$matches['h'], $matches['s'], $matches['l']]); + + return new Color(...$values); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Colors/Hsv/Channels/Hue.php b/upLoadImage/vendor/intervention/image/src/Colors/Hsv/Channels/Hue.php new file mode 100644 index 0000000..bbfc1fe --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Colors/Hsv/Channels/Hue.php @@ -0,0 +1,30 @@ +channels = [ + new Hue($h), + new Saturation($s), + new Value($v), + ]; + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::colorspace() + */ + public function colorspace(): ColorspaceInterface + { + return new Colorspace(); + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::create() + */ + public static function create(mixed $input): ColorInterface + { + return InputHandler::withDecoders([ + Decoders\StringColorDecoder::class, + ])->handle($input); + } + + /** + * Return the Hue channel + */ + public function hue(): ColorChannelInterface + { + /** @throws void */ + return $this->channel(Hue::class); + } + + /** + * Return the Saturation channel + */ + public function saturation(): ColorChannelInterface + { + /** @throws void */ + return $this->channel(Saturation::class); + } + + /** + * Return the Value channel + */ + public function value(): ColorChannelInterface + { + /** @throws void */ + return $this->channel(Value::class); + } + + public function toHex(string $prefix = ''): string + { + return $this->convertTo(RgbColorspace::class)->toHex($prefix); + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::toString() + */ + public function toString(): string + { + return sprintf( + 'hsv(%d, %d%%, %d%%)', + $this->hue()->value(), + $this->saturation()->value(), + $this->value()->value() + ); + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::isGreyscale() + */ + public function isGreyscale(): bool + { + return $this->saturation()->value() == 0; + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::isTransparent() + */ + public function isTransparent(): bool + { + return false; + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::isClear() + */ + public function isClear(): bool + { + return false; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Colors/Hsv/Colorspace.php b/upLoadImage/vendor/intervention/image/src/Colors/Hsv/Colorspace.php new file mode 100644 index 0000000..5cf08e2 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Colors/Hsv/Colorspace.php @@ -0,0 +1,122 @@ + + */ + public static array $channels = [ + Channels\Hue::class, + Channels\Saturation::class, + Channels\Value::class + ]; + + /** + * {@inheritdoc} + * + * @see ColorspaceInterface::colorFromNormalized() + */ + public function colorFromNormalized(array $normalized): ColorInterface + { + return new Color(...array_map( + fn(string $classname, float $value_normalized) => (new $classname(normalized: $value_normalized))->value(), + self::$channels, + $normalized + )); + } + + /** + * @throws ColorException + */ + public function importColor(ColorInterface $color): ColorInterface + { + return match ($color::class) { + CmykColor::class => $this->importRgbColor($color->convertTo(RgbColorspace::class)), + RgbColor::class => $this->importRgbColor($color), + HslColor::class => $this->importHslColor($color), + default => $color, + }; + } + + /** + * @throws ColorException + */ + protected function importRgbColor(ColorInterface $color): ColorInterface + { + if (!($color instanceof RgbColor)) { + throw new ColorException('Unabled to import color of type ' . $color::class . '.'); + } + + // normalized values of rgb channels + $values = array_map(fn(ColorChannelInterface $channel): float => $channel->normalize(), $color->channels()); + + // take only RGB + $values = array_slice($values, 0, 3); + + // calculate chroma + $min = min(...$values); + $max = max(...$values); + $chroma = $max - $min; + + // calculate value + $v = 100 * $max; + + if ($chroma == 0) { + // greyscale color + return new Color(0, 0, intval(round($v))); + } + + // calculate saturation + $s = 100 * ($chroma / $max); + + // calculate hue + [$r, $g, $b] = $values; + $h = match (true) { + ($r == $min) => 3 - (($g - $b) / $chroma), + ($b == $min) => 1 - (($r - $g) / $chroma), + default => 5 - (($b - $r) / $chroma), + } * 60; + + return new Color( + intval(round($h)), + intval(round($s)), + intval(round($v)) + ); + } + + /** + * @throws ColorException + */ + protected function importHslColor(ColorInterface $color): ColorInterface + { + if (!($color instanceof HslColor)) { + throw new ColorException('Unabled to import color of type ' . $color::class . '.'); + } + + // normalized values of hsl channels + [$h, $s, $l] = array_map( + fn(ColorChannelInterface $channel): float => $channel->normalize(), + $color->channels() + ); + + $v = $l + $s * min($l, 1 - $l); + $s = ($v == 0) ? 0 : 2 * (1 - $l / $v); + + return $this->colorFromNormalized([$h, $s, $v]); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Colors/Hsv/Decoders/StringColorDecoder.php b/upLoadImage/vendor/intervention/image/src/Colors/Hsv/Decoders/StringColorDecoder.php new file mode 100644 index 0000000..0f1ada3 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Colors/Hsv/Decoders/StringColorDecoder.php @@ -0,0 +1,39 @@ +[0-9\.]+), ?(?P[0-9\.]+%?), ?(?P[0-9\.]+%?)\)$/i'; + if (preg_match($pattern, $input, $matches) != 1) { + throw new DecoderException('Unable to decode input'); + } + + $values = array_map(function (string $value): int { + return match (strpos($value, '%')) { + false => intval(trim($value)), + default => intval(trim(str_replace('%', '', $value))), + }; + }, [$matches['h'], $matches['s'], $matches['v']]); + + return new Color(...$values); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Colors/Profile.php b/upLoadImage/vendor/intervention/image/src/Colors/Profile.php new file mode 100644 index 0000000..b6aa0e9 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Colors/Profile.php @@ -0,0 +1,22 @@ +normalize(), 6)); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Colors/Rgb/Channels/Blue.php b/upLoadImage/vendor/intervention/image/src/Colors/Rgb/Channels/Blue.php new file mode 100644 index 0000000..c5f9ed7 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Colors/Rgb/Channels/Blue.php @@ -0,0 +1,10 @@ +channels = [ + new Red($r), + new Green($g), + new Blue($b), + new Alpha($a), + ]; + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::colorspace() + */ + public function colorspace(): ColorspaceInterface + { + return new Colorspace(); + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::create() + */ + public static function create(mixed $input): ColorInterface + { + return InputHandler::withDecoders([ + Decoders\HexColorDecoder::class, + Decoders\StringColorDecoder::class, + Decoders\TransparentColorDecoder::class, + Decoders\HtmlColornameDecoder::class, + ])->handle($input); + } + + /** + * Return the RGB red color channel + */ + public function red(): ColorChannelInterface + { + /** @throws void */ + return $this->channel(Red::class); + } + + /** + * Return the RGB green color channel + */ + public function green(): ColorChannelInterface + { + /** @throws void */ + return $this->channel(Green::class); + } + + /** + * Return the RGB blue color channel + */ + public function blue(): ColorChannelInterface + { + /** @throws void */ + return $this->channel(Blue::class); + } + + /** + * Return the colors alpha channel + */ + public function alpha(): ColorChannelInterface + { + /** @throws void */ + return $this->channel(Alpha::class); + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::toHex() + */ + public function toHex(string $prefix = ''): string + { + if ($this->isTransparent()) { + return sprintf( + '%s%02x%02x%02x%02x', + $prefix, + $this->red()->value(), + $this->green()->value(), + $this->blue()->value(), + $this->alpha()->value() + ); + } + + return sprintf( + '%s%02x%02x%02x', + $prefix, + $this->red()->value(), + $this->green()->value(), + $this->blue()->value() + ); + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::toString() + */ + public function toString(): string + { + if ($this->isTransparent()) { + return sprintf( + 'rgba(%d, %d, %d, %.1F)', + $this->red()->value(), + $this->green()->value(), + $this->blue()->value(), + $this->alpha()->normalize(), + ); + } + + return sprintf( + 'rgb(%d, %d, %d)', + $this->red()->value(), + $this->green()->value(), + $this->blue()->value() + ); + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::isGreyscale() + */ + public function isGreyscale(): bool + { + $values = [$this->red()->value(), $this->green()->value(), $this->blue()->value()]; + + return count(array_unique($values, SORT_REGULAR)) === 1; + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::isTransparent() + */ + public function isTransparent(): bool + { + return $this->alpha()->value() < $this->alpha()->max(); + } + + /** + * {@inheritdoc} + * + * @see ColorInterface::isClear() + */ + public function isClear(): bool + { + return $this->alpha()->value() == 0; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Colors/Rgb/Colorspace.php b/upLoadImage/vendor/intervention/image/src/Colors/Rgb/Colorspace.php new file mode 100644 index 0000000..dfeaef6 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Colors/Rgb/Colorspace.php @@ -0,0 +1,135 @@ + + */ + public static array $channels = [ + Channels\Red::class, + Channels\Green::class, + Channels\Blue::class, + Channels\Alpha::class + ]; + + /** + * {@inheritdoc} + * + * @see ColorspaceInterface::colorFromNormalized() + */ + public function colorFromNormalized(array $normalized): ColorInterface + { + return new Color(...array_map( + fn($classname, float $value_normalized) => (new $classname(normalized: $value_normalized))->value(), + self::$channels, + $normalized, + )); + } + + /** + * @throws ColorException + */ + public function importColor(ColorInterface $color): ColorInterface + { + return match ($color::class) { + CmykColor::class => $this->importCmykColor($color), + HsvColor::class => $this->importHsvColor($color), + HslColor::class => $this->importHslColor($color), + default => $color, + }; + } + + /** + * @throws ColorException + */ + protected function importCmykColor(ColorInterface $color): ColorInterface + { + if (!($color instanceof CmykColor)) { + throw new ColorException('Unabled to import color of type ' . $color::class . '.'); + } + + return new Color( + (int) (255 * (1 - $color->cyan()->normalize()) * (1 - $color->key()->normalize())), + (int) (255 * (1 - $color->magenta()->normalize()) * (1 - $color->key()->normalize())), + (int) (255 * (1 - $color->yellow()->normalize()) * (1 - $color->key()->normalize())), + ); + } + + /** + * @throws ColorException + */ + protected function importHsvColor(ColorInterface $color): ColorInterface + { + if (!($color instanceof HsvColor)) { + throw new ColorException('Unabled to import color of type ' . $color::class . '.'); + } + + $chroma = $color->value()->normalize() * $color->saturation()->normalize(); + $hue = $color->hue()->normalize() * 6; + $x = $chroma * (1 - abs(fmod($hue, 2) - 1)); + + // connect channel values + $values = match (true) { + $hue < 1 => [$chroma, $x, 0], + $hue < 2 => [$x, $chroma, 0], + $hue < 3 => [0, $chroma, $x], + $hue < 4 => [0, $x, $chroma], + $hue < 5 => [$x, 0, $chroma], + default => [$chroma, 0, $x], + }; + + // add to each value + $values = array_map(fn(float|int $value): float => $value + $color->value()->normalize() - $chroma, $values); + $values[] = 1; // append alpha channel value + + return $this->colorFromNormalized($values); + } + + /** + * @throws ColorException + */ + protected function importHslColor(ColorInterface $color): ColorInterface + { + if (!($color instanceof HslColor)) { + throw new ColorException('Unabled to import color of type ' . $color::class . '.'); + } + + // normalized values of hsl channels + [$h, $s, $l] = array_map( + fn(ColorChannelInterface $channel): float => $channel->normalize(), + $color->channels() + ); + + $c = (1 - abs(2 * $l - 1)) * $s; + $x = $c * (1 - abs(fmod($h * 6, 2) - 1)); + $m = $l - $c / 2; + + $values = match (true) { + $h < 1 / 6 => [$c, $x, 0], + $h < 2 / 6 => [$x, $c, 0], + $h < 3 / 6 => [0, $c, $x], + $h < 4 / 6 => [0, $x, $c], + $h < 5 / 6 => [$x, 0, $c], + default => [$c, 0, $x], + }; + + $values = array_map(fn(float|int $value): float => $value + $m, $values); + $values[] = 1; // append alpha channel value + + return $this->colorFromNormalized($values); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Colors/Rgb/Decoders/HexColorDecoder.php b/upLoadImage/vendor/intervention/image/src/Colors/Rgb/Decoders/HexColorDecoder.php new file mode 100644 index 0000000..b19eee2 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Colors/Rgb/Decoders/HexColorDecoder.php @@ -0,0 +1,46 @@ +[a-f\d]{3}(?:[a-f\d]?|(?:[a-f\d]{3}(?:[a-f\d]{2})?)?)\b)$/i'; + if (preg_match($pattern, $input, $matches) != 1) { + throw new DecoderException('Unable to decode input'); + } + + $values = match (strlen($matches['hex'])) { + 3, 4 => str_split($matches['hex']), + 6, 8 => str_split($matches['hex'], 2), + default => throw new DecoderException('Unable to decode input'), + }; + + $values = array_map(function (string $value): float|int { + return match (strlen($value)) { + 1 => hexdec($value . $value), + 2 => hexdec($value), + default => throw new DecoderException('Unable to decode input'), + }; + }, $values); + + return new Color(...$values); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Colors/Rgb/Decoders/HtmlColornameDecoder.php b/upLoadImage/vendor/intervention/image/src/Colors/Rgb/Decoders/HtmlColornameDecoder.php new file mode 100644 index 0000000..8fc8e70 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Colors/Rgb/Decoders/HtmlColornameDecoder.php @@ -0,0 +1,176 @@ + + */ + protected static array $names = [ + 'lightsalmon' => '#ffa07a', + 'salmon' => '#fa8072', + 'darksalmon' => '#e9967a', + 'lightcoral' => '#f08080', + 'indianred' => '#cd5c5c', + 'crimson' => '#dc143c', + 'firebrick' => '#b22222', + 'red' => '#ff0000', + 'darkred' => '#8b0000', + 'coral' => '#ff7f50', + 'tomato' => '#ff6347', + 'orangered' => '#ff4500', + 'gold' => '#ffd700', + 'orange' => '#ffa500', + 'darkorange' => '#ff8c00', + 'lightyellow' => '#ffffe0', + 'lemonchiffon' => '#fffacd', + 'lightgoldenrodyellow' => '#fafad2', + 'papayawhip' => '#ffefd5', + 'moccasin' => '#ffe4b5', + 'peachpuff' => '#ffdab9', + 'palegoldenrod' => '#eee8aa', + 'khaki' => '#f0e68c', + 'darkkhaki' => '#bdb76b', + 'yellow' => '#ffff00', + 'lawngreen' => '#7cfc00', + 'chartreuse' => '#7fff00', + 'limegreen' => '#32cd32', + 'lime' => '#00ff00', + 'forestgreen' => '#228b22', + 'green' => '#008000', + 'darkgreen' => '#006400', + 'greenyellow' => '#adff2f', + 'yellowgreen' => '#9acd32', + 'springgreen' => '#00ff7f', + 'mediumspringgreen' => '#00fa9a', + 'lightgreen' => '#90ee90', + 'palegreen' => '#98fb98', + 'darkseagreen' => '#8fbc8f', + 'mediumseagre' => 'en #3cb371', + 'seagreen' => '#2e8b57', + 'olive' => '#808000', + 'darkolivegreen' => '#556b2f', + 'olivedrab' => '#6b8e23', + 'lightcyan' => '#e0ffff', + 'cyan' => '#00ffff', + 'aqua' => '#00ffff', + 'aquamarine' => '#7fffd4', + 'mediumaquamarine' => '#66cdaa', + 'paleturquoise' => '#afeeee', + 'turquoise' => '#40e0d0', + 'mediumturquoise' => '#48d1cc', + 'darkturquoise' => '#00ced1', + 'lightseagreen' => '#20b2aa', + 'cadetblue' => '#5f9ea0', + 'darkcyan' => '#008b8b', + 'teal' => '#008080', + 'powderblue' => '#b0e0e6', + 'lightblue' => '#add8e6', + 'lightskyblue' => '#87cefa', + 'skyblue' => '#87ceeb', + 'deepskyblue' => '#00bfff', + 'lightsteelblue' => '#b0c4de', + 'dodgerblue' => '#1e90ff', + 'cornflowerblue' => '#6495ed', + 'steelblue' => '#4682b4', + 'royalblue' => '#4169e1', + 'blue' => '#0000ff', + 'mediumblue' => '#0000cd', + 'darkblue' => '#00008b', + 'navy' => '#000080', + 'midnightblue' => '#191970', + 'mediumslateblue' => '#7b68ee', + 'slateblue' => '#6a5acd', + 'darkslateblue' => '#483d8b', + 'lavender' => '#e6e6fa', + 'thistle' => '#d8bfd8', + 'plum' => '#dda0dd', + 'violet' => '#ee82ee', + 'orchid' => '#da70d6', + 'fuchsia' => '#ff00ff', + 'magenta' => '#ff00ff', + 'mediumorchid' => '#ba55d3', + 'mediumpurple' => '#9370db', + 'blueviolet' => '#8a2be2', + 'darkviolet' => '#9400d3', + 'darkorchid' => '#9932cc', + 'darkmagenta' => '#8b008b', + 'purple' => '#800080', + 'indigo' => '#4b0082', + 'pink' => '#ffc0cb', + 'lightpink' => '#ffb6c1', + 'hotpink' => '#ff69b4', + 'deeppink' => '#ff1493', + 'palevioletred' => '#db7093', + 'mediumvioletred' => '#c71585', + 'white' => '#ffffff', + 'snow' => '#fffafa', + 'honeydew' => '#f0fff0', + 'mintcream' => '#f5fffa', + 'azure' => '#f0ffff', + 'aliceblue' => '#f0f8ff', + 'ghostwhite' => '#f8f8ff', + 'whitesmoke' => '#f5f5f5', + 'seashell' => '#fff5ee', + 'beige' => '#f5f5dc', + 'oldlace' => '#fdf5e6', + 'floralwhite' => '#fffaf0', + 'ivory' => '#fffff0', + 'antiquewhite' => '#faebd7', + 'linen' => '#faf0e6', + 'lavenderblush' => '#fff0f5', + 'mistyrose' => '#ffe4e1', + 'gainsboro' => '#dcdcdc', + 'lightgray' => '#d3d3d3', + 'silver' => '#c0c0c0', + 'darkgray' => '#a9a9a9', + 'gray' => '#808080', + 'dimgray' => '#696969', + 'lightslategray' => '#778899', + 'slategray' => '#708090', + 'darkslategray' => '#2f4f4f', + 'black' => '#000000', + 'cornsilk' => '#fff8dc', + 'blanchedalmond' => '#ffebcd', + 'bisque' => '#ffe4c4', + 'navajowhite' => '#ffdead', + 'wheat' => '#f5deb3', + 'burlywood' => '#deb887', + 'tan' => '#d2b48c', + 'rosybrown' => '#bc8f8f', + 'sandybrown' => '#f4a460', + 'goldenrod' => '#daa520', + 'peru' => '#cd853f', + 'chocolate' => '#d2691e', + 'saddlebrown' => '#8b4513', + 'sienna' => '#a0522d', + 'brown' => '#a52a2a', + 'maroon' => '#800000', + ]; + + /** + * Decode html color names + */ + public function decode(mixed $input): ImageInterface|ColorInterface + { + if (!is_string($input)) { + throw new DecoderException('Unable to decode input'); + } + + if (!array_key_exists(strtolower($input), static::$names)) { + throw new DecoderException('Unable to decode input'); + } + + return parent::decode(static::$names[strtolower($input)]); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Colors/Rgb/Decoders/StringColorDecoder.php b/upLoadImage/vendor/intervention/image/src/Colors/Rgb/Decoders/StringColorDecoder.php new file mode 100644 index 0000000..a2ddb6c --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Colors/Rgb/Decoders/StringColorDecoder.php @@ -0,0 +1,49 @@ +[0-9\.]+%?), ?(?P[0-9\.]+%?), ?(?P[0-9\.]+%?)' . + '(?:, ?(?P(?:1)|(?:1\.0*)|(?:0)|(?:0?\.\d+%?)|(?:\d{1,3}%)))?\)$/i'; + if (preg_match($pattern, $input, $matches) != 1) { + throw new DecoderException('Unable to decode input'); + } + + // rgb values + $values = array_map(function (string $value): int { + return match (strpos($value, '%')) { + false => intval(trim($value)), + default => intval(round(floatval(trim(str_replace('%', '', $value))) / 100 * 255)), + }; + }, [$matches['r'], $matches['g'], $matches['b']]); + + // alpha value + if (array_key_exists('a', $matches)) { + $values[] = match (true) { + strpos($matches['a'], '%') => round(intval(trim(str_replace('%', '', $matches['a']))) / 2.55), + default => intval(round(floatval(trim($matches['a'])) * 255)), + }; + } + + return new Color(...$values); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Colors/Rgb/Decoders/TransparentColorDecoder.php b/upLoadImage/vendor/intervention/image/src/Colors/Rgb/Decoders/TransparentColorDecoder.php new file mode 100644 index 0000000..8d968a6 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Colors/Rgb/Decoders/TransparentColorDecoder.php @@ -0,0 +1,30 @@ +prepareOptions($options) as $name => $value) { + if (!property_exists($this, $name)) { + throw new InputException('Property ' . $name . ' does not exists for ' . $this::class . '.'); + } + + $this->{$name} = $value; + } + + return $this; + } + + /** + * This method makes it possible to call self::setOptions() with a single + * array instead of named parameters + * + * @param array $options + * @return array + */ + private function prepareOptions(array $options): array + { + if ($options === []) { + return $options; + } + + if (count($options) > 1) { + return $options; + } + + if (!array_key_exists(0, $options)) { + return $options; + } + + if (!is_array($options[0])) { + return $options; + } + + return $options[0]; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Decoders/Base64ImageDecoder.php b/upLoadImage/vendor/intervention/image/src/Decoders/Base64ImageDecoder.php new file mode 100644 index 0000000..6dffb2b --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Decoders/Base64ImageDecoder.php @@ -0,0 +1,12 @@ + PHP_MAXPATHLEN) { + return false; + } + + try { + if (!@is_file($input)) { + return false; + } + } catch (Exception) { + return false; + } + + return true; + } + + /** + * Extract and return EXIF data from given input which can be binary image + * data or a file path. + * + * @return CollectionInterface + */ + protected function extractExifData(string $path_or_data): CollectionInterface + { + if (!function_exists('exif_read_data')) { + return new Collection(); + } + + try { + $source = match (true) { + $this->isFile($path_or_data) => $path_or_data, // path + default => $this->buildFilePointer($path_or_data), // data + }; + + // extract exif data + $data = @exif_read_data($source, null, true); + if (is_resource($source)) { + fclose($source); + } + } catch (Exception) { + $data = []; + } + + return new Collection(is_array($data) ? $data : []); + } + + /** + * Determine if given input is base64 encoded data + */ + protected function isValidBase64(mixed $input): bool + { + if (!is_string($input)) { + return false; + } + + return base64_encode(base64_decode($input)) === str_replace(["\n", "\r"], '', $input); + } + + /** + * Parse data uri + */ + protected function parseDataUri(mixed $input): object + { + $pattern = "/^data:(?P\w+\/[-+.\w]+)?" . + "(?P(;[-\w]+=[-\w]+)*)(?P;base64)?,(?P.*)/"; + + $result = preg_match($pattern, (string) $input, $matches); + + return new class ($matches, $result) + { + /** + * @param array $matches + * @return void + */ + public function __construct(private array $matches, private int|false $result) + { + // + } + + public function isValid(): bool + { + return (bool) $this->result; + } + + public function mediaType(): ?string + { + if (isset($this->matches['mediatype']) && !empty($this->matches['mediatype'])) { + return $this->matches['mediatype']; + } + + return null; + } + + public function hasMediaType(): bool + { + return !empty($this->mediaType()); + } + + public function isBase64Encoded(): bool + { + return isset($this->matches['base64']) && $this->matches['base64'] === ';base64'; + } + + public function data(): ?string + { + if (isset($this->matches['data']) && !empty($this->matches['data'])) { + return $this->matches['data']; + } + + return null; + } + }; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/AbstractDriver.php b/upLoadImage/vendor/intervention/image/src/Drivers/AbstractDriver.php new file mode 100644 index 0000000..f5d7024 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/AbstractDriver.php @@ -0,0 +1,127 @@ +config = new Config(); + $this->checkHealth(); + } + + /** + * {@inheritdoc} + * + * @see DriverInterface::config() + */ + public function config(): Config + { + return $this->config; + } + + /** + * {@inheritdoc} + * + * @see DriverInterface::handleInput() + */ + public function handleInput(mixed $input, array $decoders = []): ImageInterface|ColorInterface + { + return InputHandler::withDecoders($decoders, $this)->handle($input); + } + + /** + * {@inheritdoc} + * + * @see DriverInterface::specialize() + */ + public function specialize( + ModifierInterface|AnalyzerInterface|EncoderInterface|DecoderInterface $object + ): ModifierInterface|AnalyzerInterface|EncoderInterface|DecoderInterface { + // return object directly if no specializing is possible + if (!($object instanceof SpecializableInterface)) { + return $object; + } + + // return directly and only attach driver if object is already specialized + if ($object instanceof SpecializedInterface) { + $object->setDriver($this); + + return $object; + } + + // resolve classname for specializable object + $specialized_classname = implode("\\", [ + (new ReflectionClass($this))->getNamespaceName(), // driver's namespace + match (true) { + $object instanceof ModifierInterface => 'Modifiers', + $object instanceof AnalyzerInterface => 'Analyzers', + $object instanceof EncoderInterface => 'Encoders', + $object instanceof DecoderInterface => 'Decoders', + }, + $object_shortname = (new ReflectionClass($object))->getShortName(), + ]); + + // fail if driver specialized classname does not exists + if (!class_exists($specialized_classname)) { + throw new NotSupportedException( + "Class '" . $object_shortname . "' is not supported by " . $this->id() . " driver." + ); + } + + // create a driver specialized object with the specializable properties of generic object + $specialized = new $specialized_classname(...$object->specializable()); + + // attach driver + return $specialized->setDriver($this); + } + + /** + * {@inheritdoc} + * + * @see DriverInterface::specializeMultiple() + * + * @throws NotSupportedException + * @throws DriverException + */ + public function specializeMultiple(array $objects): array + { + return array_map( + function (string|object $object): ModifierInterface|AnalyzerInterface|EncoderInterface|DecoderInterface { + return $this->specialize( + match (true) { + is_string($object) => new $object(), + is_object($object) => $object, + } + ); + }, + $objects + ); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/AbstractEncoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/AbstractEncoder.php new file mode 100644 index 0000000..747cdcb --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/AbstractEncoder.php @@ -0,0 +1,42 @@ +encode($this); + } + + /** + * Build new file pointer, run callback with it and return result as encoded image + * + * @throws RuntimeException + */ + protected function createEncodedImage(callable $callback, ?string $mediaType = null): EncodedImage + { + $pointer = $this->buildFilePointer(); + $callback($pointer); + + return is_string($mediaType) ? new EncodedImage($pointer, $mediaType) : new EncodedImage($pointer); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/AbstractFontProcessor.php b/upLoadImage/vendor/intervention/image/src/Drivers/AbstractFontProcessor.php new file mode 100644 index 0000000..6d0ae66 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/AbstractFontProcessor.php @@ -0,0 +1,172 @@ +wrapTextBlock(new TextBlock($text), $font); + $pivot = $this->buildPivot($lines, $font, $position); + + $leading = $this->leading($font); + $blockWidth = $this->boxSize((string) $lines->longestLine(), $font)->width(); + + $x = $pivot->x(); + $y = $font->hasFilename() ? $pivot->y() + $this->capHeight($font) : $pivot->y(); + $xAdjustment = 0; + + // adjust line positions according to alignment + foreach ($lines as $line) { + $lineBoxSize = $this->boxSize((string) $line, $font); + $lineWidth = $lineBoxSize->width() + $lineBoxSize->pivot()->x(); + $xAdjustment = $font->alignment() === 'left' ? 0 : $blockWidth - $lineWidth; + $xAdjustment = $font->alignment() === 'right' ? intval(round($xAdjustment)) : $xAdjustment; + $xAdjustment = $font->alignment() === 'center' ? intval(round($xAdjustment / 2)) : $xAdjustment; + $position = new Point($x + $xAdjustment, $y); + $position->rotate($font->angle(), $pivot); + $line->setPosition($position); + $y += $leading; + } + + return $lines; + } + + /** + * {@inheritdoc} + * + * @see FontProcessorInterface::nativeFontSize() + */ + public function nativeFontSize(FontInterface $font): float + { + return $font->size(); + } + + /** + * {@inheritdoc} + * + * @see FontProcessorInterface::typographicalSize() + */ + public function typographicalSize(FontInterface $font): int + { + return $this->boxSize('Hy', $font)->height(); + } + + /** + * {@inheritdoc} + * + * @see FontProcessorInterface::capHeight() + */ + public function capHeight(FontInterface $font): int + { + return $this->boxSize('T', $font)->height(); + } + + /** + * {@inheritdoc} + * + * @see FontProcessorInterface::leading() + */ + public function leading(FontInterface $font): int + { + return intval(round($this->typographicalSize($font) * $font->lineHeight())); + } + + /** + * Reformat a text block by wrapping each line before the given maximum width + * + * @throws FontException + */ + protected function wrapTextBlock(TextBlock $block, FontInterface $font): TextBlock + { + $newLines = []; + foreach ($block as $line) { + foreach ($this->wrapLine($line, $font) as $newLine) { + $newLines[] = $newLine; + } + } + + return $block->setLines($newLines); + } + + /** + * Check if a line exceeds the given maximum width and wrap it if necessary. + * The output will be an array of formatted lines that are all within the + * maximum width. + * + * @throws FontException + * @return array + */ + protected function wrapLine(Line $line, FontInterface $font): array + { + // no wrap width - no wrapping + if (is_null($font->wrapWidth())) { + return [$line]; + } + + $wrapped = []; + $formattedLine = new Line(); + + foreach ($line as $word) { + // calculate width of newly formatted line + $lineWidth = $this->boxSize(match ($formattedLine->count()) { + 0 => $word, + default => $formattedLine . ' ' . $word, + }, $font)->width(); + + // decide if word fits on current line or a new line must be created + if ($line->count() === 1 || $lineWidth <= $font->wrapWidth()) { + $formattedLine->add($word); + } else { + if ($formattedLine->count() !== 0) { + $wrapped[] = $formattedLine; + } + $formattedLine = new Line($word); + } + } + + $wrapped[] = $formattedLine; + + return $wrapped; + } + + /** + * Build pivot point of textblock according to the font settings and based on given position + * + * @throws FontException + */ + protected function buildPivot(TextBlock $block, FontInterface $font, PointInterface $position): PointInterface + { + // bounding box + $box = new Rectangle( + $this->boxSize((string) $block->longestLine(), $font)->width(), + $this->leading($font) * ($block->count() - 1) + $this->capHeight($font) + ); + + // set position + $box->setPivot($position); + + // alignment + $box->align($font->alignment()); + $box->valign($font->valignment()); + $box->rotate($font->angle()); + + return $box->last(); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/AbstractFrame.php b/upLoadImage/vendor/intervention/image/src/Drivers/AbstractFrame.php new file mode 100644 index 0000000..706ddf5 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/AbstractFrame.php @@ -0,0 +1,25 @@ + + */ + public function __debugInfo(): array + { + return [ + 'delay' => $this->delay(), + 'left' => $this->offsetLeft(), + 'top' => $this->offsetTop(), + 'dispose' => $this->dispose(), + ]; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Analyzers/ColorspaceAnalyzer.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Analyzers/ColorspaceAnalyzer.php new file mode 100644 index 0000000..73057f7 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Analyzers/ColorspaceAnalyzer.php @@ -0,0 +1,23 @@ +core()->native()); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Analyzers/PixelColorAnalyzer.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Analyzers/PixelColorAnalyzer.php new file mode 100644 index 0000000..80542f3 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Analyzers/PixelColorAnalyzer.php @@ -0,0 +1,51 @@ +colorAt( + $image->colorspace(), + $image->core()->frame($this->frame_key)->native() + ); + } + + /** + * @throws GeometryException + * @throws ColorException + */ + protected function colorAt(ColorspaceInterface $colorspace, GdImage $gd): ColorInterface + { + $index = @imagecolorat($gd, $this->x, $this->y); + + if (!imageistruecolor($gd)) { + $index = imagecolorsforindex($gd, $index); + } + + if ($index === false) { + throw new GeometryException( + 'The specified position is not in the valid image area.' + ); + } + + return $this->driver()->colorProcessor($colorspace)->nativeToColor($index); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Analyzers/PixelColorsAnalyzer.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Analyzers/PixelColorsAnalyzer.php new file mode 100644 index 0000000..862d41e --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Analyzers/PixelColorsAnalyzer.php @@ -0,0 +1,30 @@ +colorspace(); + + foreach ($image as $frame) { + $colors->push( + parent::colorAt($colorspace, $frame->native()) + ); + } + + return $colors; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Analyzers/ResolutionAnalyzer.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Analyzers/ResolutionAnalyzer.php new file mode 100644 index 0000000..93d37f2 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Analyzers/ResolutionAnalyzer.php @@ -0,0 +1,23 @@ +core()->native())); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Analyzers/WidthAnalyzer.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Analyzers/WidthAnalyzer.php new file mode 100644 index 0000000..9c6b793 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Analyzers/WidthAnalyzer.php @@ -0,0 +1,22 @@ +core()->native()); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Cloner.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Cloner.php new file mode 100644 index 0000000..e871996 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Cloner.php @@ -0,0 +1,90 @@ +width(), $size->height()); + + // copy resolution to clone + $resolution = imageresolution($gd); + if (is_array($resolution) && array_key_exists(0, $resolution) && array_key_exists(1, $resolution)) { + imageresolution($clone, $resolution[0], $resolution[1]); + } + + // fill with background + $processor = new ColorProcessor(); + imagefill($clone, 0, 0, $processor->colorToNative($background)); + imagealphablending($clone, true); + imagesavealpha($clone, true); + + // set background image as transparent if alpha channel value if color is below .5 + // comes into effect when the end format only supports binary transparency (like GIF) + if ($background->channel(Alpha::class)->value() < 128) { + imagecolortransparent($clone, $processor->colorToNative($background)); + } + + return $clone; + } + + /** + * Create a clone of an GdImage that is positioned on the specified background color. + * Possible transparent areas are mixed with this color. + * + * @throws ColorException + */ + public static function cloneBlended(GdImage $gd, ColorInterface $background): GdImage + { + // create empty canvas with same size + $clone = static::cloneEmpty($gd, background: $background); + + // transfer actual image to clone + imagecopy($clone, $gd, 0, 0, 0, 0, imagesx($gd), imagesy($gd)); + + return $clone; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/ColorProcessor.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/ColorProcessor.php new file mode 100644 index 0000000..6d738a4 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/ColorProcessor.php @@ -0,0 +1,148 @@ +convertTo($this->colorspace); + + // gd only supports rgb so the channels can be accessed directly + $r = $color->channel(Red::class)->value(); + $g = $color->channel(Green::class)->value(); + $b = $color->channel(Blue::class)->value(); + $a = $color->channel(Alpha::class)->value(); + + // convert alpha value to gd alpha + // ([opaque]255-0[transparent]) to ([opaque]0-127[transparent]) + $a = (int) $this->convertRange($a, 0, 255, 127, 0); + + return ($a << 24) + ($r << 16) + ($g << 8) + $b; + } + + /** + * {@inheritdoc} + * + * @see ColorProcessorInterface::nativeToColor() + */ + public function nativeToColor(mixed $value): ColorInterface + { + if (!is_int($value) && !is_array($value)) { + throw new ColorException('GD driver can only decode colors in integer and array format.'); + } + + if (is_array($value)) { + // array conversion + if (!$this->isValidArrayColor($value)) { + throw new ColorException( + 'GD driver can only decode array color format array{red: int, green: int, blue: int, alpha: int}.', + ); + } + + $r = $value['red']; + $g = $value['green']; + $b = $value['blue']; + $a = $value['alpha']; + } else { + // integer conversion + $a = ($value >> 24) & 0xFF; + $r = ($value >> 16) & 0xFF; + $g = ($value >> 8) & 0xFF; + $b = $value & 0xFF; + } + + // convert gd apha integer to intervention alpha integer + // ([opaque]0-127[transparent]) to ([opaque]255-0[transparent]) + $a = (int) static::convertRange($a, 127, 0, 0, 255); + + return new Color($r, $g, $b, $a); + } + + /** + * Convert input in range (min) to (max) to the corresponding value + * in target range (targetMin) to (targetMax). + */ + protected function convertRange( + float|int $input, + float|int $min, + float|int $max, + float|int $targetMin, + float|int $targetMax + ): float|int { + return ceil(((($input - $min) * ($targetMax - $targetMin)) / ($max - $min)) + $targetMin); + } + + /** + * Check if given array is valid color format + * array{red: int, green: int, blue: int, alpha: int} + * i.e. result of imagecolorsforindex() + * + * @param array $color + */ + private function isValidArrayColor(array $color): bool + { + if (!array_key_exists('red', $color)) { + return false; + } + + if (!array_key_exists('green', $color)) { + return false; + } + + if (!array_key_exists('blue', $color)) { + return false; + } + + if (!array_key_exists('alpha', $color)) { + return false; + } + + if (!is_int($color['red'])) { + return false; + } + + if (!is_int($color['green'])) { + return false; + } + + if (!is_int($color['blue'])) { + return false; + } + + if (!is_int($color['alpha'])) { + return false; + } + + return true; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Core.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Core.php new file mode 100644 index 0000000..66424ad --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Core.php @@ -0,0 +1,117 @@ +push($frame); + + return $this; + } + + /** + * {@inheritdoc} + * + * @see CoreInterface::native() + */ + public function native(): mixed + { + return $this->first()->native(); + } + + /** + * {@inheritdoc} + * + * @see CoreInterface::setNative() + */ + public function setNative(mixed $native): self + { + $this->empty()->push(new Frame($native)); + + return $this; + } + + /** + * {@inheritdoc} + * + * @see CoreInterface::frame() + */ + public function frame(int $position): FrameInterface + { + $frame = $this->getAtPosition($position); + + if (!($frame instanceof FrameInterface)) { + throw new AnimationException('Frame #' . $position . ' could not be found in the image.'); + } + + return $frame; + } + + /** + * {@inheritdoc} + * + * @see CoreInterface::loops() + */ + public function loops(): int + { + return $this->loops; + } + + /** + * {@inheritdoc} + * + * @see CoreInterface::setLoops() + */ + public function setLoops(int $loops): self + { + $this->loops = $loops; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see CollectionInterface::first() + */ + public function first(): FrameInterface + { + return parent::first(); + } + + /** + * {@inheritdoc} + * + * @see CollectionInterface::last() + */ + public function last(): FrameInterface + { + return parent::last(); + } + + /** + * Clone instance + */ + public function __clone(): void + { + foreach ($this->items as $key => $frame) { + $this->items[$key] = clone $frame; + } + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Decoders/AbstractDecoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Decoders/AbstractDecoder.php new file mode 100644 index 0000000..17e2559 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Decoders/AbstractDecoder.php @@ -0,0 +1,57 @@ +isValidBase64($input)) { + throw new DecoderException('Unable to decode input'); + } + + return parent::decode(base64_decode((string) $input)); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Decoders/BinaryImageDecoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Decoders/BinaryImageDecoder.php new file mode 100644 index 0000000..ea19958 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Decoders/BinaryImageDecoder.php @@ -0,0 +1,68 @@ +isGifFormat($input)) { + true => $this->decodeGif($input), + default => $this->decodeBinary($input), + }; + } + + /** + * Decode image from given binary data + * + * @throws RuntimeException + */ + private function decodeBinary(string $input): ImageInterface + { + $gd = @imagecreatefromstring($input); + + if ($gd === false) { + throw new DecoderException('Unable to decode input'); + } + + // create image instance + $image = parent::decode($gd); + + // get media type + $mediaType = $this->getMediaTypeByBinary($input); + + // extract & set exif data for appropriate formats + if (in_array($mediaType->format(), [Format::JPEG, Format::TIFF])) { + $image->setExif($this->extractExifData($input)); + } + + // set mediaType on origin + $image->origin()->setMediaType($mediaType); + + // adjust image orientation + if ($this->driver()->config()->autoOrientation) { + $image->modify(new AlignRotationModifier()); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Decoders/DataUriImageDecoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Decoders/DataUriImageDecoder.php new file mode 100644 index 0000000..fe3abe6 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Decoders/DataUriImageDecoder.php @@ -0,0 +1,37 @@ +parseDataUri($input); + + if (!$uri->isValid()) { + throw new DecoderException('Unable to decode input'); + } + + if ($uri->isBase64Encoded()) { + return parent::decode(base64_decode($uri->data())); + } + + return parent::decode(urldecode($uri->data())); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Decoders/EncodedImageObjectDecoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Decoders/EncodedImageObjectDecoder.php new file mode 100644 index 0000000..f65d0a5 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Decoders/EncodedImageObjectDecoder.php @@ -0,0 +1,27 @@ +toString()); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Decoders/FilePathImageDecoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Decoders/FilePathImageDecoder.php new file mode 100644 index 0000000..bb6ddd5 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Decoders/FilePathImageDecoder.php @@ -0,0 +1,60 @@ +isFile($input)) { + throw new DecoderException('Unable to decode input'); + } + + // detect media (mime) type + $mediaType = $this->getMediaTypeByFilePath($input); + + $image = match ($mediaType->format()) { + // gif files might be animated and therefore cannot + // be handled by the standard GD decoder. + Format::GIF => $this->decodeGif($input), + default => parent::decode(match ($mediaType->format()) { + Format::JPEG => @imagecreatefromjpeg($input), + Format::WEBP => @imagecreatefromwebp($input), + Format::PNG => @imagecreatefrompng($input), + Format::AVIF => @imagecreatefromavif($input), + Format::BMP => @imagecreatefrombmp($input), + default => throw new DecoderException('Unable to decode input'), + }), + }; + + // set file path & mediaType on origin + $image->origin()->setFilePath($input); + $image->origin()->setMediaType($mediaType); + + // extract exif for the appropriate formats + if ($mediaType->format() === Format::JPEG) { + $image->setExif($this->extractExifData($input)); + } + + // adjust image orientation + if ($this->driver()->config()->autoOrientation) { + $image->modify(new AlignRotationModifier()); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Decoders/FilePointerImageDecoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Decoders/FilePointerImageDecoder.php new file mode 100644 index 0000000..0bf649d --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Decoders/FilePointerImageDecoder.php @@ -0,0 +1,32 @@ +driver(), + new Core([ + new Frame($input) + ]) + ); + } + + /** + * Decode image from given GIF source which can be either a file path or binary data + * + * Depending on the configuration, this is taken over by the native GD function + * or, if animations are required, by our own extended decoder. + * + * @throws RuntimeException + */ + protected function decodeGif(mixed $input): ImageInterface + { + // create non-animated image depending on config + if (!$this->driver()->config()->decodeAnimation) { + $native = match (true) { + $this->isGifFormat($input) => @imagecreatefromstring($input), + default => @imagecreatefromgif($input), + }; + + if ($native === false) { + throw new DecoderException('Unable to decode input.'); + } + + $image = self::decode($native); + $image->origin()->setMediaType('image/gif'); + + return $image; + } + + try { + // create empty core + $core = new Core(); + + $gif = GifDecoder::decode($input); + $splitter = GifSplitter::create($gif)->split(); + $delays = $splitter->getDelays(); + + // set loops on core + if ($loops = $gif->getMainApplicationExtension()?->getLoops()) { + $core->setLoops($loops); + } + + // add GDImage instances to core + foreach ($splitter->coalesceToResources() as $key => $native) { + $core->push( + new Frame($native, $delays[$key] / 100) + ); + } + } catch (Exception $e) { + throw new DecoderException($e->getMessage(), $e->getCode(), $e); + } + + // create (possibly) animated image + $image = new Image($this->driver(), $core); + + // set media type + $image->origin()->setMediaType('image/gif'); + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Decoders/SplFileInfoImageDecoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Decoders/SplFileInfoImageDecoder.php new file mode 100644 index 0000000..7aee8f5 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Decoders/SplFileInfoImageDecoder.php @@ -0,0 +1,28 @@ +getRealPath()); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Driver.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Driver.php new file mode 100644 index 0000000..a0202e1 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Driver.php @@ -0,0 +1,163 @@ +core->add( + $this->driver->handleInput($source)->core()->first()->setDelay($delay) + ); + + return $this; + } + + /** + * @throws RuntimeException + */ + public function __invoke(): ImageInterface + { + return new Image( + $this->driver, + $this->core + ); + } + }; + + $init($animation); + + return call_user_func($animation); + } + + /** + * {@inheritdoc} + * + * @see DriverInterface::colorProcessor() + */ + public function colorProcessor(ColorspaceInterface $colorspace): ColorProcessorInterface + { + return new ColorProcessor($colorspace); + } + + /** + * {@inheritdoc} + * + * @see DriverInterface::fontProcessor() + */ + public function fontProcessor(): FontProcessorInterface + { + return new FontProcessor(); + } + + /** + * {@inheritdoc} + * + * @see DriverInterface::supports() + */ + public function supports(string|Format|FileExtension|MediaType $identifier): bool + { + return match (Format::tryCreate($identifier)) { + Format::JPEG => boolval(imagetypes() & IMG_JPEG), + Format::WEBP => boolval(imagetypes() & IMG_WEBP), + Format::GIF => boolval(imagetypes() & IMG_GIF), + Format::PNG => boolval(imagetypes() & IMG_PNG), + Format::AVIF => boolval(imagetypes() & IMG_AVIF), + Format::BMP => boolval(imagetypes() & IMG_BMP), + default => false, + }; + } + + /** + * Return version of GD library + */ + public static function version(): string + { + return gd_info()['GD Version']; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Encoders/AvifEncoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Encoders/AvifEncoder.php new file mode 100644 index 0000000..8b64271 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Encoders/AvifEncoder.php @@ -0,0 +1,25 @@ +createEncodedImage(function ($pointer) use ($image): void { + imageavif($image->core()->native(), $pointer, $this->quality); + }, 'image/avif'); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Encoders/BmpEncoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Encoders/BmpEncoder.php new file mode 100644 index 0000000..1bb34c2 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Encoders/BmpEncoder.php @@ -0,0 +1,25 @@ +createEncodedImage(function ($pointer) use ($image): void { + imagebmp($image->core()->native(), $pointer, false); + }, 'image/bmp'); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Encoders/GifEncoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Encoders/GifEncoder.php new file mode 100644 index 0000000..29d97ec --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Encoders/GifEncoder.php @@ -0,0 +1,64 @@ +isAnimated()) { + return $this->encodeAnimated($image); + } + + $gd = Cloner::clone($image->core()->native()); + + return $this->createEncodedImage(function ($pointer) use ($gd): void { + imageinterlace($gd, $this->interlaced); + imagegif($gd, $pointer); + }, 'image/gif'); + } + + /** + * @throws RuntimeException + */ + protected function encodeAnimated(ImageInterface $image): EncodedImage + { + try { + $builder = GifBuilder::canvas( + $image->width(), + $image->height() + ); + + foreach ($image as $frame) { + $builder->addFrame( + source: $this->encode($frame->toImage($image->driver()))->toFilePointer(), + delay: $frame->delay(), + interlaced: $this->interlaced + ); + } + + $builder->setLoops($image->loops()); + + return new EncodedImage($builder->encode(), 'image/gif'); + } catch (Exception $e) { + throw new EncoderException($e->getMessage(), $e->getCode(), $e); + } + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Encoders/JpegEncoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Encoders/JpegEncoder.php new file mode 100644 index 0000000..0e3ecb8 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Encoders/JpegEncoder.php @@ -0,0 +1,36 @@ +driver()->handleInput( + $this->driver()->config()->blendingColor + ); + + $output = Cloner::cloneBlended( + $image->core()->native(), + background: $blendingColor + ); + + return $this->createEncodedImage(function ($pointer) use ($output): void { + imageinterlace($output, $this->progressive); + imagejpeg($output, $pointer, $this->quality); + }, 'image/jpeg'); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Encoders/PngEncoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Encoders/PngEncoder.php new file mode 100644 index 0000000..fc58e9f --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Encoders/PngEncoder.php @@ -0,0 +1,52 @@ +prepareOutput($image); + + return $this->createEncodedImage(function ($pointer) use ($output): void { + imageinterlace($output, $this->interlaced); + imagepng($output, $pointer, -1); + }, 'image/png'); + } + + /** + * Prepare given image instance for PNG format output according to encoder settings + * + * @throws RuntimeException + * @throws ColorException + * @throws AnimationException + */ + private function prepareOutput(ImageInterface $image): GdImage + { + if ($this->indexed) { + $output = clone $image; + $output->reduceColors(255); + + return $output->core()->native(); + } + + return Cloner::clone($image->core()->native()); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Encoders/WebpEncoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Encoders/WebpEncoder.php new file mode 100644 index 0000000..076c915 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Encoders/WebpEncoder.php @@ -0,0 +1,27 @@ +quality === 100 && defined('IMG_WEBP_LOSSLESS') ? IMG_WEBP_LOSSLESS : $this->quality; + + return $this->createEncodedImage(function ($pointer) use ($image, $quality): void { + imagewebp($image->core()->native(), $pointer, $quality); + }, 'image/webp'); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/FontProcessor.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/FontProcessor.php new file mode 100644 index 0000000..cedad43 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/FontProcessor.php @@ -0,0 +1,107 @@ +hasFilename()) { + // calculate box size from gd font + $box = new Rectangle(0, 0); + $chars = mb_strlen($text); + if ($chars > 0) { + $box->setWidth( + $chars * $this->gdCharacterWidth((int) $font->filename()) + ); + $box->setHeight( + $this->gdCharacterHeight((int) $font->filename()) + ); + } + return $box; + } + + // build full path to font file to make sure to pass absolute path to imageftbbox() + // because of issues with different GD version behaving differently when passing + // relative paths to imageftbbox() + $fontPath = realpath($font->filename()); + if ($fontPath === false) { + throw new FontException('Font file ' . $font->filename() . ' does not exist.'); + } + + // calculate box size from ttf font file with angle 0 + $box = imageftbbox( + size: $this->nativeFontSize($font), + angle: 0, + font_filename: $fontPath, + string: $text, + ); + + if ($box === false) { + throw new FontException('Unable to calculate box size of font ' . $font->filename() . '.'); + } + + // build size from points + return new Rectangle( + width: intval(abs($box[6] - $box[4])), // difference of upper-left-x and upper-right-x + height: intval(abs($box[7] - $box[1])), // difference if upper-left-y and lower-left-y + pivot: new Point($box[6], $box[7]), // position of upper-left corner + ); + } + + /** + * {@inheritdoc} + * + * @see FontProcessorInterface::nativeFontSize() + */ + public function nativeFontSize(FontInterface $font): float + { + return floatval(round($font->size() * .76, 6)); + } + + /** + * {@inheritdoc} + * + * @see FontProcessorInterface::leading() + */ + public function leading(FontInterface $font): int + { + return (int) round(parent::leading($font) * .8); + } + + /** + * Return width of a single character + */ + protected function gdCharacterWidth(int $gdfont): int + { + return $gdfont + 4; + } + + /** + * Return height of a single character + */ + protected function gdCharacterHeight(int $gdfont): int + { + return match ($gdfont) { + 2, 3 => 14, + 4, 5 => 16, + default => 8, + }; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Frame.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Frame.php new file mode 100644 index 0000000..e344f53 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Frame.php @@ -0,0 +1,193 @@ +native = $native; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see FrameInterface::native() + */ + public function native(): GdImage + { + return $this->native; + } + + /** + * {@inheritdoc} + * + * @see FrameInterface::size() + */ + public function size(): SizeInterface + { + return new Rectangle(imagesx($this->native), imagesy($this->native)); + } + + /** + * {@inheritdoc} + * + * @see FrameInterface::delay() + */ + public function delay(): float + { + return $this->delay; + } + + /** + * {@inheritdoc} + * + * @see FrameInterface::setDelay() + */ + public function setDelay(float $delay): FrameInterface + { + $this->delay = $delay; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see FrameInterface::dispose() + */ + public function dispose(): int + { + return $this->dispose; + } + + /** + * {@inheritdoc} + * + * @see FrameInterface::setDispose() + * + * @throws InputException + */ + public function setDispose(int $dispose): FrameInterface + { + if (!in_array($dispose, [0, 1, 2, 3])) { + throw new InputException('Value for argument $dispose must be 0, 1, 2 or 3.'); + } + + $this->dispose = $dispose; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see FrameInterface::setOffset() + */ + public function setOffset(int $left, int $top): FrameInterface + { + $this->offset_left = $left; + $this->offset_top = $top; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see FrameInterface::offsetLeft() + */ + public function offsetLeft(): int + { + return $this->offset_left; + } + + /** + * {@inheritdoc} + * + * @see FrameInterface::setOffsetLeft() + */ + public function setOffsetLeft(int $offset): FrameInterface + { + $this->offset_left = $offset; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see FrameInterface::offsetTop() + */ + public function offsetTop(): int + { + return $this->offset_top; + } + + /** + * {@inheritdoc} + * + * @see FrameInterface::setOffsetTop() + */ + public function setOffsetTop(int $offset): FrameInterface + { + $this->offset_top = $offset; + + return $this; + } + + /** + * This workaround helps cloning GdImages which is currently not possible. + * + * @throws ColorException + */ + public function __clone(): void + { + $this->native = Cloner::clone($this->native); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/AlignRotationModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/AlignRotationModifier.php new file mode 100644 index 0000000..4e45337 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/AlignRotationModifier.php @@ -0,0 +1,52 @@ +exif('IFD0.Orientation')) { + 2 => $image->flop(), + 3 => $image->rotate(180), + 4 => $image->rotate(180)->flop(), + 5 => $image->rotate(270)->flop(), + 6 => $image->rotate(270), + 7 => $image->rotate(90)->flop(), + 8 => $image->rotate(90), + default => $image + }; + + return $this->markAligned($image); + } + + /** + * Set exif data of image to top-left orientation, marking the image as + * aligned and making sure the rotation correction process is not + * performed again. + */ + private function markAligned(ImageInterface $image): ImageInterface + { + $exif = $image->exif()->map(function ($item) { + if (is_array($item) && array_key_exists('Orientation', $item)) { + $item['Orientation'] = 1; + return $item; + } + + return $item; + }); + + return $image->setExif($exif); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/BlendTransparencyModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/BlendTransparencyModifier.php new file mode 100644 index 0000000..861d11c --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/BlendTransparencyModifier.php @@ -0,0 +1,36 @@ +blendingColor($this->driver()); + + foreach ($image as $frame) { + // create new canvas with blending color as background + $modified = Cloner::cloneBlended( + $frame->native(), + background: $blendingColor + ); + + // set new gd image + $frame->setNative($modified); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/BlurModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/BlurModifier.php new file mode 100644 index 0000000..14fe41a --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/BlurModifier.php @@ -0,0 +1,28 @@ +amount; $i++) { + imagefilter($frame->native(), IMG_FILTER_GAUSSIAN_BLUR); + } + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/BrightnessModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/BrightnessModifier.php new file mode 100644 index 0000000..022c679 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/BrightnessModifier.php @@ -0,0 +1,26 @@ +native(), IMG_FILTER_BRIGHTNESS, intval($this->level * 2.55)); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ColorizeModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ColorizeModifier.php new file mode 100644 index 0000000..c753e43 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ColorizeModifier.php @@ -0,0 +1,31 @@ +red * 2.55); + $green = (int) round($this->green * 2.55); + $blue = (int) round($this->blue * 2.55); + + foreach ($image as $frame) { + imagefilter($frame->native(), IMG_FILTER_COLORIZE, $red, $green, $blue); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ColorspaceModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ColorspaceModifier.php new file mode 100644 index 0000000..2065a15 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ColorspaceModifier.php @@ -0,0 +1,30 @@ +targetColorspace() instanceof RgbColorspace)) { + throw new NotSupportedException( + 'Only RGB colorspace is supported by GD driver.' + ); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ContainModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ContainModifier.php new file mode 100644 index 0000000..8462e8e --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ContainModifier.php @@ -0,0 +1,93 @@ +getCropSize($image); + $resize = $this->getResizeSize($image); + $background = $this->driver()->handleInput($this->background); + $blendingColor = $this->driver()->handleInput( + $this->driver()->config()->blendingColor + ); + + foreach ($image as $frame) { + $this->modify($frame, $crop, $resize, $background, $blendingColor); + } + + return $image; + } + + /** + * @throws ColorException + */ + protected function modify( + FrameInterface $frame, + SizeInterface $crop, + SizeInterface $resize, + ColorInterface $background, + ColorInterface $blendingColor + ): void { + // create new gd image + $modified = Cloner::cloneEmpty($frame->native(), $resize, $background); + + // make image area transparent to keep transparency + // even if background-color is set + $transparent = imagecolorallocatealpha( + $modified, + $blendingColor->channel(Red::class)->value(), + $blendingColor->channel(Green::class)->value(), + $blendingColor->channel(Blue::class)->value(), + 127, + ); + imagealphablending($modified, false); // do not blend / just overwrite + imagecolortransparent($modified, $transparent); + imagefilledrectangle( + $modified, + $crop->pivot()->x(), + $crop->pivot()->y(), + $crop->pivot()->x() + $crop->width() - 1, + $crop->pivot()->y() + $crop->height() - 1, + $transparent + ); + + // copy image from original with blending alpha + imagealphablending($modified, true); + imagecopyresampled( + $modified, + $frame->native(), + $crop->pivot()->x(), + $crop->pivot()->y(), + 0, + 0, + $crop->width(), + $crop->height(), + $frame->size()->width(), + $frame->size()->height() + ); + + // set new content as resource + $frame->setNative($modified); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ContrastModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ContrastModifier.php new file mode 100644 index 0000000..7a0ac6b --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ContrastModifier.php @@ -0,0 +1,26 @@ +native(), IMG_FILTER_CONTRAST, ($this->level * -1)); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/CoverDownModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/CoverDownModifier.php new file mode 100644 index 0000000..ac1cec1 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/CoverDownModifier.php @@ -0,0 +1,19 @@ +resizeDown($this->width, $this->height); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/CoverModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/CoverModifier.php new file mode 100644 index 0000000..e676e66 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/CoverModifier.php @@ -0,0 +1,59 @@ +getCropSize($image); + $resize = $this->getResizeSize($crop); + + foreach ($image as $frame) { + $this->modifyFrame($frame, $crop, $resize); + } + + return $image; + } + + /** + * @throws ColorException + */ + protected function modifyFrame(FrameInterface $frame, SizeInterface $crop, SizeInterface $resize): void + { + // create new image + $modified = Cloner::cloneEmpty($frame->native(), $resize); + + // copy content from resource + imagecopyresampled( + $modified, + $frame->native(), + 0, + 0, + $crop->pivot()->x(), + $crop->pivot()->y(), + $resize->width(), + $resize->height(), + $crop->width(), + $crop->height() + ); + + // set new content as resource + $frame->setNative($modified); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/CropModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/CropModifier.php new file mode 100644 index 0000000..c1ea482 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/CropModifier.php @@ -0,0 +1,78 @@ +size(); + $crop = $this->crop($image); + $background = $this->driver()->handleInput($this->background); + + foreach ($image as $frame) { + $this->cropFrame($frame, $originalSize, $crop, $background); + } + + return $image; + } + + /** + * @throws ColorException + */ + protected function cropFrame( + FrameInterface $frame, + SizeInterface $originalSize, + SizeInterface $resizeTo, + ColorInterface $background + ): void { + // create new image with transparent background + $modified = Cloner::cloneEmpty($frame->native(), $resizeTo, $background); + + // define offset + $offset_x = $resizeTo->pivot()->x() + $this->offset_x; + $offset_y = $resizeTo->pivot()->y() + $this->offset_y; + + // define target width & height + $targetWidth = min($resizeTo->width(), $originalSize->width()); + $targetHeight = min($resizeTo->height(), $originalSize->height()); + $targetWidth = $targetWidth < $originalSize->width() ? $targetWidth + $offset_x : $targetWidth; + $targetHeight = $targetHeight < $originalSize->height() ? $targetHeight + $offset_y : $targetHeight; + + // don't alpha blend for copy operation to keep transparent areas of original image + imagealphablending($modified, false); + + // copy content from resource + imagecopyresampled( + $modified, + $frame->native(), + $offset_x * -1, + $offset_y * -1, + 0, + 0, + $targetWidth, + $targetHeight, + $targetWidth, + $targetHeight + ); + + // set new content as resource + $frame->setNative($modified); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/DrawBezierModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/DrawBezierModifier.php new file mode 100644 index 0000000..768d6f8 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/DrawBezierModifier.php @@ -0,0 +1,234 @@ +drawable->count() !== 3 && $this->drawable->count() !== 4) { + throw new GeometryException('You must specify either 3 or 4 points to create a bezier curve'); + } + + [$polygon, $polygon_border_segments] = $this->calculateBezierPoints(); + + if ($this->drawable->hasBackgroundColor() || $this->drawable->hasBorder()) { + imagealphablending($frame->native(), true); + imageantialias($frame->native(), true); + } + + if ($this->drawable->hasBackgroundColor()) { + $background_color = $this->driver()->colorProcessor($image->colorspace())->colorToNative( + $this->backgroundColor() + ); + + imagesetthickness($frame->native(), 0); + imagefilledpolygon( + $frame->native(), + $polygon, + $background_color + ); + } + + if ($this->drawable->hasBorder() && $this->drawable->borderSize() > 0) { + $border_color = $this->driver()->colorProcessor($image->colorspace())->colorToNative( + $this->borderColor() + ); + + if ($this->drawable->borderSize() === 1) { + imagesetthickness($frame->native(), $this->drawable->borderSize()); + + $count = count($polygon); + for ($i = 0; $i < $count; $i += 2) { + if (array_key_exists($i + 2, $polygon) && array_key_exists($i + 3, $polygon)) { + imageline( + $frame->native(), + $polygon[$i], + $polygon[$i + 1], + $polygon[$i + 2], + $polygon[$i + 3], + $border_color + ); + } + } + } else { + $polygon_border_segments_total = count($polygon_border_segments); + + for ($i = 0; $i < $polygon_border_segments_total; $i += 1) { + imagefilledpolygon( + $frame->native(), + $polygon_border_segments[$i], + $border_color + ); + } + } + } + } + + return $image; + } + + /** + * Calculate interpolation points for quadratic beziers using the Bernstein polynomial form + * + * @return array{'x': float, 'y': float} + */ + private function calculateQuadraticBezierInterpolationPoint(float $t = 0.05): array + { + $remainder = 1 - $t; + $control_point_1_multiplier = $remainder * $remainder; + $control_point_2_multiplier = $remainder * $t * 2; + $control_point_3_multiplier = $t * $t; + + $x = ( + $this->drawable->first()->x() * $control_point_1_multiplier + + $this->drawable->second()->x() * $control_point_2_multiplier + + $this->drawable->last()->x() * $control_point_3_multiplier + ); + $y = ( + $this->drawable->first()->y() * $control_point_1_multiplier + + $this->drawable->second()->y() * $control_point_2_multiplier + + $this->drawable->last()->y() * $control_point_3_multiplier + ); + + return ['x' => $x, 'y' => $y]; + } + + /** + * Calculate interpolation points for cubic beziers using the Bernstein polynomial form + * + * @return array{'x': float, 'y': float} + */ + private function calculateCubicBezierInterpolationPoint(float $t = 0.05): array + { + $remainder = 1 - $t; + $t_squared = $t * $t; + $remainder_squared = $remainder * $remainder; + $control_point_1_multiplier = $remainder_squared * $remainder; + $control_point_2_multiplier = $remainder_squared * $t * 3; + $control_point_3_multiplier = $t_squared * $remainder * 3; + $control_point_4_multiplier = $t_squared * $t; + + $x = ( + $this->drawable->first()->x() * $control_point_1_multiplier + + $this->drawable->second()->x() * $control_point_2_multiplier + + $this->drawable->third()->x() * $control_point_3_multiplier + + $this->drawable->last()->x() * $control_point_4_multiplier + ); + $y = ( + $this->drawable->first()->y() * $control_point_1_multiplier + + $this->drawable->second()->y() * $control_point_2_multiplier + + $this->drawable->third()->y() * $control_point_3_multiplier + + $this->drawable->last()->y() * $control_point_4_multiplier + ); + + return ['x' => $x, 'y' => $y]; + } + + /** + * Calculate the points needed to draw a quadratic or cubic bezier with optional border/stroke + * + * @throws GeometryException + * @return array{0: array, 1: array} + */ + private function calculateBezierPoints(): array + { + if ($this->drawable->count() !== 3 && $this->drawable->count() !== 4) { + throw new GeometryException('You must specify either 3 or 4 points to create a bezier curve'); + } + + $polygon = []; + $inner_polygon = []; + $outer_polygon = []; + $polygon_border_segments = []; + + // define ratio t; equivalent to 5 percent distance along edge + $t = 0.05; + + $polygon[] = $this->drawable->first()->x(); + $polygon[] = $this->drawable->first()->y(); + for ($i = $t; $i < 1; $i += $t) { + if ($this->drawable->count() === 3) { + $ip = $this->calculateQuadraticBezierInterpolationPoint($i); + } elseif ($this->drawable->count() === 4) { + $ip = $this->calculateCubicBezierInterpolationPoint($i); + } + $polygon[] = (int) $ip['x']; + $polygon[] = (int) $ip['y']; + } + $polygon[] = $this->drawable->last()->x(); + $polygon[] = $this->drawable->last()->y(); + + if ($this->drawable->hasBorder() && $this->drawable->borderSize() > 1) { + // create the border/stroke effect by calculating two new curves with offset positions + // from the main polygon and then connecting the inner/outer curves to create separate + // 4-point polygon segments + $polygon_total_points = count($polygon); + $offset = ($this->drawable->borderSize() / 2); + + for ($i = 0; $i < $polygon_total_points; $i += 2) { + if (array_key_exists($i + 2, $polygon) && array_key_exists($i + 3, $polygon)) { + $dx = $polygon[$i + 2] - $polygon[$i]; + $dy = $polygon[$i + 3] - $polygon[$i + 1]; + $dxy_sqrt = ($dx * $dx + $dy * $dy) ** 0.5; + + // inner polygon + $scale = $offset / $dxy_sqrt; + $ox = -$dy * $scale; + $oy = $dx * $scale; + + $inner_polygon[] = $ox + $polygon[$i]; + $inner_polygon[] = $oy + $polygon[$i + 1]; + $inner_polygon[] = $ox + $polygon[$i + 2]; + $inner_polygon[] = $oy + $polygon[$i + 3]; + + // outer polygon + $scale = -$offset / $dxy_sqrt; + $ox = -$dy * $scale; + $oy = $dx * $scale; + + $outer_polygon[] = $ox + $polygon[$i]; + $outer_polygon[] = $oy + $polygon[$i + 1]; + $outer_polygon[] = $ox + $polygon[$i + 2]; + $outer_polygon[] = $oy + $polygon[$i + 3]; + } + } + + $inner_polygon_total_points = count($inner_polygon); + + for ($i = 0; $i < $inner_polygon_total_points; $i += 2) { + if (array_key_exists($i + 2, $inner_polygon) && array_key_exists($i + 3, $inner_polygon)) { + $polygon_border_segments[] = [ + $inner_polygon[$i], + $inner_polygon[$i + 1], + $outer_polygon[$i], + $outer_polygon[$i + 1], + $outer_polygon[$i + 2], + $outer_polygon[$i + 3], + $inner_polygon[$i + 2], + $inner_polygon[$i + 3], + ]; + } + } + } + + return [$polygon, $polygon_border_segments]; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/DrawEllipseModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/DrawEllipseModifier.php new file mode 100644 index 0000000..4c4f669 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/DrawEllipseModifier.php @@ -0,0 +1,78 @@ +drawable->hasBorder()) { + imagealphablending($frame->native(), true); + + // slightly smaller ellipse to keep 1px bordered edges clean + if ($this->drawable->hasBackgroundColor()) { + imagefilledellipse( + $frame->native(), + $this->drawable()->position()->x(), + $this->drawable->position()->y(), + $this->drawable->width() - 1, + $this->drawable->height() - 1, + $this->driver()->colorProcessor($image->colorspace())->colorToNative( + $this->backgroundColor() + ) + ); + } + + // gd's imageellipse ignores imagesetthickness + // so i use imagearc with 360 degrees instead. + imagesetthickness( + $frame->native(), + $this->drawable->borderSize(), + ); + + imagearc( + $frame->native(), + $this->drawable()->position()->x(), + $this->drawable()->position()->y(), + $this->drawable->width(), + $this->drawable->height(), + 0, + 360, + $this->driver()->colorProcessor($image->colorspace())->colorToNative( + $this->borderColor() + ) + ); + } else { + imagealphablending($frame->native(), true); + imagesetthickness($frame->native(), 0); + imagefilledellipse( + $frame->native(), + $this->drawable()->position()->x(), + $this->drawable()->position()->y(), + $this->drawable->width(), + $this->drawable->height(), + $this->driver()->colorProcessor($image->colorspace())->colorToNative( + $this->backgroundColor() + ) + ); + } + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/DrawLineModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/DrawLineModifier.php new file mode 100644 index 0000000..ccf6974 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/DrawLineModifier.php @@ -0,0 +1,39 @@ +driver()->colorProcessor($image->colorspace())->colorToNative( + $this->backgroundColor() + ); + + foreach ($image as $frame) { + imagealphablending($frame->native(), true); + imageantialias($frame->native(), true); + imagesetthickness($frame->native(), $this->drawable->width()); + imageline( + $frame->native(), + $this->drawable->start()->x(), + $this->drawable->start()->y(), + $this->drawable->end()->x(), + $this->drawable->end()->y(), + $color + ); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/DrawPixelModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/DrawPixelModifier.php new file mode 100644 index 0000000..9fc954c --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/DrawPixelModifier.php @@ -0,0 +1,36 @@ +driver()->colorProcessor($image->colorspace())->colorToNative( + $this->driver()->handleInput($this->color) + ); + + foreach ($image as $frame) { + imagealphablending($frame->native(), true); + imagesetpixel( + $frame->native(), + $this->position->x(), + $this->position->y(), + $color + ); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/DrawPolygonModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/DrawPolygonModifier.php new file mode 100644 index 0000000..c0cc77b --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/DrawPolygonModifier.php @@ -0,0 +1,51 @@ +drawable->hasBackgroundColor()) { + imagealphablending($frame->native(), true); + imagesetthickness($frame->native(), 0); + imagefilledpolygon( + $frame->native(), + $this->drawable->toArray(), + $this->driver()->colorProcessor($image->colorspace())->colorToNative( + $this->backgroundColor() + ) + ); + } + + if ($this->drawable->hasBorder()) { + imagealphablending($frame->native(), true); + imagesetthickness($frame->native(), $this->drawable->borderSize()); + imagepolygon( + $frame->native(), + $this->drawable->toArray(), + $this->driver()->colorProcessor($image->colorspace())->colorToNative( + $this->borderColor() + ) + ); + } + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/DrawRectangleModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/DrawRectangleModifier.php new file mode 100644 index 0000000..f4a2d79 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/DrawRectangleModifier.php @@ -0,0 +1,61 @@ +drawable->position(); + + foreach ($image as $frame) { + // draw background + if ($this->drawable->hasBackgroundColor()) { + imagealphablending($frame->native(), true); + imagesetthickness($frame->native(), 0); + imagefilledrectangle( + $frame->native(), + $position->x(), + $position->y(), + $position->x() + $this->drawable->width(), + $position->y() + $this->drawable->height(), + $this->driver()->colorProcessor($image->colorspace())->colorToNative( + $this->backgroundColor() + ) + ); + } + + // draw border + if ($this->drawable->hasBorder()) { + imagealphablending($frame->native(), true); + imagesetthickness($frame->native(), $this->drawable->borderSize()); + imagerectangle( + $frame->native(), + $position->x(), + $position->y(), + $position->x() + $this->drawable->width(), + $position->y() + $this->drawable->height(), + $this->driver()->colorProcessor($image->colorspace())->colorToNative( + $this->borderColor() + ) + ); + } + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/FillModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/FillModifier.php new file mode 100644 index 0000000..412f805 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/FillModifier.php @@ -0,0 +1,67 @@ +color($image); + + foreach ($image as $frame) { + if ($this->hasPosition()) { + $this->floodFillWithColor($frame, $color); + } else { + $this->fillAllWithColor($frame, $color); + } + } + + return $image; + } + + /** + * @throws RuntimeException + */ + private function color(ImageInterface $image): int + { + return $this->driver()->colorProcessor($image->colorspace())->colorToNative( + $this->driver()->handleInput($this->color) + ); + } + + private function floodFillWithColor(FrameInterface $frame, int $color): void + { + imagefill( + $frame->native(), + $this->position->x(), + $this->position->y(), + $color + ); + } + + private function fillAllWithColor(FrameInterface $frame, int $color): void + { + imagealphablending($frame->native(), true); + imagefilledrectangle( + $frame->native(), + 0, + 0, + $frame->size()->width() - 1, + $frame->size()->height() - 1, + $color + ); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/FlipModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/FlipModifier.php new file mode 100644 index 0000000..0107200 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/FlipModifier.php @@ -0,0 +1,26 @@ +native(), IMG_FLIP_VERTICAL); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/FlopModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/FlopModifier.php new file mode 100644 index 0000000..7033175 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/FlopModifier.php @@ -0,0 +1,26 @@ +native(), IMG_FLIP_HORIZONTAL); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/GammaModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/GammaModifier.php new file mode 100644 index 0000000..8da6499 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/GammaModifier.php @@ -0,0 +1,26 @@ +native(), 1, $this->gamma); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/GreyscaleModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/GreyscaleModifier.php new file mode 100644 index 0000000..a1cf280 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/GreyscaleModifier.php @@ -0,0 +1,26 @@ +native(), IMG_FILTER_GRAYSCALE); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/InvertModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/InvertModifier.php new file mode 100644 index 0000000..e2c8dc6 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/InvertModifier.php @@ -0,0 +1,26 @@ +native(), IMG_FILTER_NEGATE); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/PadModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/PadModifier.php new file mode 100644 index 0000000..52a6acb --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/PadModifier.php @@ -0,0 +1,24 @@ +size() + ->containMax( + $this->width, + $this->height + ) + ->alignPivotTo( + $this->getResizeSize($image), + $this->position + ); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/PixelateModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/PixelateModifier.php new file mode 100644 index 0000000..ecbe3e5 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/PixelateModifier.php @@ -0,0 +1,26 @@ +native(), IMG_FILTER_PIXELATE, $this->size, true); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/PlaceModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/PlaceModifier.php new file mode 100644 index 0000000..44333c7 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/PlaceModifier.php @@ -0,0 +1,111 @@ +driver()->handleInput($this->element); + $position = $this->getPosition($image, $watermark); + + foreach ($image as $frame) { + imagealphablending($frame->native(), true); + + if ($this->opacity === 100) { + $this->placeOpaque($frame, $watermark, $position); + } else { + $this->placeTransparent($frame, $watermark, $position); + } + } + + return $image; + } + + /** + * Insert watermark with 100% opacity + * + * @throws RuntimeException + */ + private function placeOpaque(FrameInterface $frame, ImageInterface $watermark, PointInterface $position): void + { + imagecopy( + $frame->native(), + $watermark->core()->native(), + $position->x(), + $position->y(), + 0, + 0, + $watermark->width(), + $watermark->height() + ); + } + + /** + * Insert watermark transparent with current opacity + * + * Unfortunately, the original PHP function imagecopymerge does not work reliably. + * For example, any transparency of the image to be inserted is not applied correctly. + * For this reason, a new GDImage is created into which the original image is inserted + * in the first step and the watermark is inserted with 100% opacity in the second + * step. This combination is then transferred to the original image again with the + * respective opacity. + * + * Please note: Unfortunately, there is still an edge case, when a transparent image + * is placed on a transparent background, the "double" transparent areas appear opaque! + * + * @throws RuntimeException + */ + private function placeTransparent(FrameInterface $frame, ImageInterface $watermark, PointInterface $position): void + { + $cut = imagecreatetruecolor($watermark->width(), $watermark->height()); + + imagecopy( + $cut, + $frame->native(), + 0, + 0, + $position->x(), + $position->y(), + imagesx($cut), + imagesy($cut) + ); + + imagecopy( + $cut, + $watermark->core()->native(), + 0, + 0, + 0, + 0, + imagesx($cut), + imagesy($cut) + ); + + imagecopymerge( + $frame->native(), + $cut, + $position->x(), + $position->y(), + 0, + 0, + $watermark->width(), + $watermark->height(), + $this->opacity + ); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ProfileModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ProfileModifier.php new file mode 100644 index 0000000..a862395 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ProfileModifier.php @@ -0,0 +1,25 @@ +limit <= 0) { + throw new InputException('Quantization limit must be greater than 0.'); + } + + // no color reduction if the limit is higher than the colors in the img + $colorCount = imagecolorstotal($image->core()->native()); + if ($colorCount > 0 && $this->limit > $colorCount) { + return $image; + } + + $width = $image->width(); + $height = $image->height(); + + $background = $this->driver()->colorProcessor($image->colorspace())->colorToNative( + $this->driver()->handleInput($this->background) + ); + + $blendingColor = $this->driver()->handleInput( + $this->driver()->config()->blendingColor + ); + + foreach ($image as $frame) { + // create new image for color quantization + $reduced = Cloner::cloneEmpty($frame->native(), background: $blendingColor); + + // fill with background + imagefill($reduced, 0, 0, $background); + + // set transparency + imagecolortransparent($reduced, $background); + + // copy original image (colors are limited automatically in the copy process) + imagecopy($reduced, $frame->native(), 0, 0, 0, 0, $width, $height); + + // gd library does not support color quantization directly therefore the + // colors are decrease by transforming the image to a palette version + imagetruecolortopalette($reduced, true, $this->limit); + + $frame->setNative($reduced); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/RemoveAnimationModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/RemoveAnimationModifier.php new file mode 100644 index 0000000..2ef1d89 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/RemoveAnimationModifier.php @@ -0,0 +1,26 @@ +core()->setNative( + $this->selectedFrame($image)->native() + ); + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ResizeCanvasModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ResizeCanvasModifier.php new file mode 100644 index 0000000..7f73cc7 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ResizeCanvasModifier.php @@ -0,0 +1,32 @@ +cropSize($image); + + $image->modify(new CropModifier( + $cropSize->width(), + $cropSize->height(), + $cropSize->pivot()->x(), + $cropSize->pivot()->y(), + $this->background, + )); + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ResizeCanvasRelativeModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ResizeCanvasRelativeModifier.php new file mode 100644 index 0000000..53e375f --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ResizeCanvasRelativeModifier.php @@ -0,0 +1,16 @@ +size()->resizeDown($this->width, $this->height); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ResizeModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ResizeModifier.php new file mode 100644 index 0000000..cfaa295 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ResizeModifier.php @@ -0,0 +1,70 @@ +getAdjustedSize($image); + foreach ($image as $frame) { + $this->resizeFrame($frame, $resizeTo); + } + + return $image; + } + + /** + * @throws ColorException + */ + private function resizeFrame(FrameInterface $frame, SizeInterface $resizeTo): void + { + // create empty canvas in target size + $modified = Cloner::cloneEmpty($frame->native(), $resizeTo); + + // copy content from resource + imagecopyresampled( + $modified, + $frame->native(), + $resizeTo->pivot()->x(), + $resizeTo->pivot()->y(), + 0, + 0, + $resizeTo->width(), + $resizeTo->height(), + $frame->size()->width(), + $frame->size()->height() + ); + + // set new content as resource + $frame->setNative($modified); + } + + /** + * Return the size the modifier will resize to + * + * @throws RuntimeException + * @throws GeometryException + */ + protected function getAdjustedSize(ImageInterface $image): SizeInterface + { + return $image->size()->resize($this->width, $this->height); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ResolutionModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ResolutionModifier.php new file mode 100644 index 0000000..d6fd504 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ResolutionModifier.php @@ -0,0 +1,29 @@ +x)); + $y = intval(round($this->y)); + + foreach ($image as $frame) { + imageresolution($frame->native(), $x, $y); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/RotateModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/RotateModifier.php new file mode 100644 index 0000000..4db0750 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/RotateModifier.php @@ -0,0 +1,106 @@ +driver()->handleInput($this->background); + + foreach ($image as $frame) { + $this->modifyFrame($frame, $background); + } + + return $image; + } + + /** + * Apply rotation modification on given frame, given background + * color is used for newly create image areas + * + * @throws ColorException + */ + protected function modifyFrame(FrameInterface $frame, ColorInterface $background): void + { + // get transparent color from frame core + $transparent = match ($transparent = imagecolortransparent($frame->native())) { + -1 => imagecolorallocatealpha( + $frame->native(), + $background->channel(Red::class)->value(), + $background->channel(Green::class)->value(), + $background->channel(Blue::class)->value(), + 127 + ), + default => $transparent, + }; + + // rotate original image against transparent background + $rotated = imagerotate( + $frame->native(), + $this->rotationAngle(), + $transparent + ); + + // create size from original after rotation + $container = (new Rectangle( + imagesx($rotated), + imagesy($rotated), + ))->movePivot('center'); + + // create size from original and rotate points + $cutout = (new Rectangle( + imagesx($frame->native()), + imagesy($frame->native()), + $container->pivot() + ))->align('center') + ->valign('center') + ->rotate($this->rotationAngle() * -1); + + // create new gd image + $modified = Cloner::cloneEmpty($frame->native(), $container, $background); + + // draw the cutout on new gd image to have a transparent + // background where the rotated image will be placed + imagealphablending($modified, false); + imagefilledpolygon( + $modified, + $cutout->toArray(), + imagecolortransparent($modified) + ); + + // place rotated image on new gd image + imagealphablending($modified, true); + imagecopy( + $modified, + $rotated, + 0, + 0, + 0, + 0, + imagesx($rotated), + imagesy($rotated) + ); + + $frame->setNative($modified); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ScaleDownModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ScaleDownModifier.php new file mode 100644 index 0000000..15287e6 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ScaleDownModifier.php @@ -0,0 +1,21 @@ +size()->scaleDown($this->width, $this->height); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ScaleModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ScaleModifier.php new file mode 100644 index 0000000..2486cbb --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/ScaleModifier.php @@ -0,0 +1,16 @@ +size()->scale($this->width, $this->height); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/SharpenModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/SharpenModifier.php new file mode 100644 index 0000000..3943d2c --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/SharpenModifier.php @@ -0,0 +1,45 @@ +matrix(); + foreach ($image as $frame) { + imageconvolution($frame->native(), $matrix, 1, 0); + } + + return $image; + } + + /** + * Create matrix to be used by imageconvolution() + * + * @return array> + */ + private function matrix(): array + { + $min = $this->amount >= 10 ? $this->amount * -0.01 : 0; + $max = $this->amount * -0.025; + $abs = ((4 * $min + 4 * $max) * -1) + 1; + + return [ + [$min, $max, $min], + [$max, $abs, $max], + [$min, $max, $min] + ]; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/SliceAnimationModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/SliceAnimationModifier.php new file mode 100644 index 0000000..8986e7f --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/SliceAnimationModifier.php @@ -0,0 +1,29 @@ +offset >= $image->count()) { + throw new AnimationException('Offset is not in the range of frames.'); + } + + $image->core()->slice($this->offset, $this->length); + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/TextModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/TextModifier.php new file mode 100644 index 0000000..074f904 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/TextModifier.php @@ -0,0 +1,145 @@ +driver()->fontProcessor(); + $lines = $fontProcessor->textBlock($this->text, $this->font, $this->position); + + // decode text colors + $textColor = $this->gdTextColor($image); + $strokeColor = $this->gdStrokeColor($image); + + // build full path to font file to make sure to pass absolute path to imageftbbox() + // because of issues with different GD version behaving differently when passing + // relative paths to imagettftext() + $fontPath = $this->font->hasFilename() ? realpath($this->font->filename()) : false; + if ($this->font->hasFilename() && $fontPath === false) { + throw new FontException('Font file ' . $this->font->filename() . ' does not exist.'); + } + + foreach ($image as $frame) { + imagealphablending($frame->native(), true); + if ($this->font->hasFilename()) { + foreach ($lines as $line) { + foreach ($this->strokeOffsets($this->font) as $offset) { + imagettftext( + image: $frame->native(), + size: $fontProcessor->nativeFontSize($this->font), + angle: $this->font->angle() * -1, + x: $line->position()->x() + $offset->x(), + y: $line->position()->y() + $offset->y(), + color: $strokeColor, + font_filename: $fontPath, + text: (string) $line + ); + } + + imagettftext( + image: $frame->native(), + size: $fontProcessor->nativeFontSize($this->font), + angle: $this->font->angle() * -1, + x: $line->position()->x(), + y: $line->position()->y(), + color: $textColor, + font_filename: $fontPath, + text: (string) $line + ); + } + } else { + foreach ($lines as $line) { + foreach ($this->strokeOffsets($this->font) as $offset) { + imagestring( + $frame->native(), + $this->gdFont(), + $line->position()->x() + $offset->x(), + $line->position()->y() + $offset->y(), + (string) $line, + $strokeColor + ); + } + + imagestring( + $frame->native(), + $this->gdFont(), + $line->position()->x(), + $line->position()->y(), + (string) $line, + $textColor + ); + } + } + } + + return $image; + } + + /** + * Decode text color in GD compatible format + * + * @throws RuntimeException + * @throws ColorException + */ + protected function gdTextColor(ImageInterface $image): int + { + return $this + ->driver() + ->colorProcessor($image->colorspace()) + ->colorToNative(parent::textColor()); + } + + /** + * Decode color for stroke (outline) effect in GD compatible format + * + * @throws RuntimeException + * @throws ColorException + */ + protected function gdStrokeColor(ImageInterface $image): int + { + if (!$this->font->hasStrokeEffect()) { + return 0; + } + + $color = parent::strokeColor(); + + if ($color->isTransparent()) { + throw new ColorException( + 'The stroke color must be fully opaque.' + ); + } + + return $this + ->driver() + ->colorProcessor($image->colorspace()) + ->colorToNative($color); + } + + /** + * Return GD's internal font size (if no ttf file is set) + */ + private function gdFont(): int + { + if (is_numeric($this->font->filename())) { + return intval($this->font->filename()); + } + + return 1; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/TrimModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/TrimModifier.php new file mode 100644 index 0000000..ff86c8b --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Gd/Modifiers/TrimModifier.php @@ -0,0 +1,85 @@ +isAnimated()) { + throw new NotSupportedException('Trim modifier cannot be applied to animated images.'); + } + + // apply tolerance with a min. value of .5 because the default tolerance of '0' should + // already trim away similar colors which is not the case with imagecropauto. + $trimmed = imagecropauto( + $image->core()->native(), + IMG_CROP_THRESHOLD, + max([.5, $this->tolerance / 10]), + $this->trimColor($image) + ); + + // if the tolerance is very high, it is possible that no image is left. + // imagick returns a 1x1 pixel image in this case. this does the same. + if ($trimmed === false) { + $trimmed = $this->driver()->createImage(1, 1)->core()->native(); + } + + $image->core()->setNative($trimmed); + + return $image; + } + + /** + * Create an average color from the colors of the four corner points of the given image + * + * @throws RuntimeException + * @throws AnimationException + */ + private function trimColor(ImageInterface $image): int + { + // trim color base + $red = 0; + $green = 0; + $blue = 0; + + // corner coordinates + $size = $image->size(); + $cornerPoints = [ + new Point(0, 0), + new Point($size->width() - 1, 0), + new Point(0, $size->height() - 1), + new Point($size->width() - 1, $size->height() - 1), + ]; + + // create an average color to be used in trim operation + foreach ($cornerPoints as $pos) { + $cornerColor = imagecolorat($image->core()->native(), $pos->x(), $pos->y()); + $rgb = imagecolorsforindex($image->core()->native(), $cornerColor); + $red += round(round(($rgb['red'] / 51)) * 51); + $green += round(round(($rgb['green'] / 51)) * 51); + $blue += round(round(($rgb['blue'] / 51)) * 51); + } + + $red = (int) round($red / 4); + $green = (int) round($green / 4); + $blue = (int) round($blue / 4); + + return imagecolorallocate($image->core()->native(), $red, $green, $blue); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Analyzers/ColorspaceAnalyzer.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Analyzers/ColorspaceAnalyzer.php new file mode 100644 index 0000000..181b4e4 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Analyzers/ColorspaceAnalyzer.php @@ -0,0 +1,23 @@ +core()->native()->getImageColorspace()) { + Imagick::COLORSPACE_CMYK => new CmykColorspace(), + default => new RgbColorspace(), + }; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Analyzers/HeightAnalyzer.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Analyzers/HeightAnalyzer.php new file mode 100644 index 0000000..b3ab996 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Analyzers/HeightAnalyzer.php @@ -0,0 +1,17 @@ +core()->native()->getImageHeight(); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Analyzers/PixelColorAnalyzer.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Analyzers/PixelColorAnalyzer.php new file mode 100644 index 0000000..d060e34 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Analyzers/PixelColorAnalyzer.php @@ -0,0 +1,36 @@ +colorAt( + $image->colorspace(), + $image->core()->frame($this->frame_key)->native() + ); + } + + /** + * @throws ColorException + */ + protected function colorAt(ColorspaceInterface $colorspace, Imagick $imagick): ColorInterface + { + return $this->driver() + ->colorProcessor($colorspace) + ->nativeToColor( + $imagick->getImagePixelColor($this->x, $this->y) + ); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Analyzers/PixelColorsAnalyzer.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Analyzers/PixelColorsAnalyzer.php new file mode 100644 index 0000000..577b9c8 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Analyzers/PixelColorsAnalyzer.php @@ -0,0 +1,25 @@ +colorspace(); + + foreach ($image as $frame) { + $colors->push( + parent::colorAt($colorspace, $frame->native()) + ); + } + + return $colors; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Analyzers/ProfileAnalyzer.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Analyzers/ProfileAnalyzer.php new file mode 100644 index 0000000..61fef32 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Analyzers/ProfileAnalyzer.php @@ -0,0 +1,25 @@ +core()->native()->getImageProfiles('icc'); + + if (!array_key_exists('icc', $profiles)) { + throw new ColorException('No ICC profile found in image.'); + } + + return new Profile($profiles['icc']); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Analyzers/ResolutionAnalyzer.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Analyzers/ResolutionAnalyzer.php new file mode 100644 index 0000000..1a1b632 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Analyzers/ResolutionAnalyzer.php @@ -0,0 +1,25 @@ +core()->native(); + $imageResolution = $imagick->getImageResolution(); + + return new Resolution( + $imageResolution['x'], + $imageResolution['y'], + $imagick->getImageUnits(), + ); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Analyzers/WidthAnalyzer.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Analyzers/WidthAnalyzer.php new file mode 100644 index 0000000..77b1d50 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Analyzers/WidthAnalyzer.php @@ -0,0 +1,17 @@ +core()->native()->getImageWidth(); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/ColorProcessor.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/ColorProcessor.php new file mode 100644 index 0000000..4676ab1 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/ColorProcessor.php @@ -0,0 +1,45 @@ +convertTo($this->colorspace) + ); + } + + public function nativeToColor(mixed $native): ColorInterface + { + return match ($this->colorspace::class) { + CmykColorspace::class => $this->colorspace->colorFromNormalized([ + $native->getColorValue(Imagick::COLOR_CYAN), + $native->getColorValue(Imagick::COLOR_MAGENTA), + $native->getColorValue(Imagick::COLOR_YELLOW), + $native->getColorValue(Imagick::COLOR_BLACK), + ]), + default => $this->colorspace->colorFromNormalized([ + $native->getColorValue(Imagick::COLOR_RED), + $native->getColorValue(Imagick::COLOR_GREEN), + $native->getColorValue(Imagick::COLOR_BLUE), + $native->getColorValue(Imagick::COLOR_ALPHA), + ]), + }; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Core.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Core.php new file mode 100644 index 0000000..87dcf98 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Core.php @@ -0,0 +1,324 @@ + + */ +class Core implements CoreInterface, Iterator +{ + protected int $iteratorIndex = 0; + + /** + * Create new core instance + * + * @return void + */ + public function __construct(protected Imagick $imagick) + { + // + } + + /** + * {@inheritdoc} + * + * @see CollectionInterface::has() + */ + public function has(int|string $key): bool + { + try { + $result = $this->imagick->setIteratorIndex($key); + } catch (ImagickException) { + return false; + } + + return $result; + } + + /** + * {@inheritdoc} + * + * @see CollectionInterface::push() + */ + public function push(mixed $item): CollectionInterface + { + return $this->add($item); + } + + /** + * {@inheritdoc} + * + * @see CollectionInterface::get() + */ + public function get(int|string $key, mixed $default = null): mixed + { + try { + $this->imagick->setIteratorIndex($key); + } catch (ImagickException) { + return $default; + } + + return new Frame($this->imagick->current()); + } + + /** + * {@inheritdoc} + * + * @see CollectionInterface::getAtPosition() + */ + public function getAtPosition(int $key = 0, mixed $default = null): mixed + { + return $this->get($key, $default); + } + + /** + * {@inheritdoc} + * + * @see CollectionInterface::empty() + */ + public function empty(): CollectionInterface + { + $this->imagick->clear(); + + return $this; + } + + /** + * {@inheritdoc} + * + * @see CollectionInterface::slice() + */ + public function slice(int $offset, ?int $length = null): CollectionInterface + { + $allowed_indexes = []; + $length = is_null($length) ? $this->count() : $length; + for ($i = $offset; $i < $offset + $length; $i++) { + $allowed_indexes[] = $i; + } + + $sliced = new Imagick(); + foreach ($this->imagick as $key => $native) { + if (in_array($key, $allowed_indexes)) { + $sliced->addImage($native->getImage()); + } + } + + $sliced = $sliced->coalesceImages(); + $sliced->setImageIterations($this->imagick->getImageIterations()); + + $this->imagick = $sliced; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see CoreInterface::add() + */ + public function add(FrameInterface $frame): CoreInterface + { + $imagick = $frame->native(); + + $imagick->setImageDelay( + (int) round($frame->delay() * 100) + ); + + $imagick->setImageDispose($frame->dispose()); + + $size = $frame->size(); + $imagick->setImagePage( + $size->width(), + $size->height(), + $frame->offsetLeft(), + $frame->offsetTop() + ); + + $this->imagick->addImage($imagick); + + return $this; + } + + /** + * {@inheritdoc} + * + * @see CoreInterface::count() + */ + public function count(): int + { + return $this->imagick->getNumberImages(); + } + + /** + * {@inheritdoc} + * + * @see Iterator::rewind() + */ + public function current(): mixed + { + $this->imagick->setIteratorIndex($this->iteratorIndex); + + return new Frame($this->imagick->current()); + } + + /** + * {@inheritdoc} + * + * @see Iterator::rewind() + */ + public function next(): void + { + $this->iteratorIndex += 1; + } + + /** + * {@inheritdoc} + * + * @see Iterator::rewind() + */ + public function key(): mixed + { + return $this->iteratorIndex; + } + + /** + * {@inheritdoc} + * + * @see Iterator::rewind() + */ + public function valid(): bool + { + try { + $result = $this->imagick->setIteratorIndex($this->iteratorIndex); + } catch (ImagickException) { + return false; + } + + return $result; + } + + /** + * {@inheritdoc} + * + * @see Iterator::rewind() + */ + public function rewind(): void + { + $this->iteratorIndex = 0; + } + + /** + * {@inheritdoc} + * + * @see CoreInterface::native() + */ + public function native(): mixed + { + return $this->imagick; + } + + /** + * {@inheritdoc} + * + * @see CoreInterface::setNative() + */ + public function setNative(mixed $native): CoreInterface + { + $this->imagick = $native; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see CoreInterface::frame() + */ + public function frame(int $position): FrameInterface + { + foreach ($this->imagick as $core) { + if ($core->getIteratorIndex() === $position) { + return new Frame($core); + } + } + + throw new AnimationException('Frame #' . $position . ' could not be found in the image.'); + } + + /** + * {@inheritdoc} + * + * @see CoreInterface::loops() + */ + public function loops(): int + { + return $this->imagick->getImageIterations(); + } + + /** + * {@inheritdoc} + * + * @see CoreInterface::setLoops() + */ + public function setLoops(int $loops): CoreInterface + { + $this->imagick = $this->imagick->coalesceImages(); + $this->imagick->setImageIterations($loops); + + return $this; + } + + /** + * {@inheritdoc} + * + * @see CollectionInterface::first() + */ + public function first(): FrameInterface + { + return $this->frame(0); + } + + /** + * {@inheritdoc} + * + * @see CollectableInterface::last() + */ + public function last(): FrameInterface + { + return $this->frame($this->count() - 1); + } + + /** + * {@inheritdoc} + * + * @see CollectionInterface::toArray() + */ + public function toArray(): array + { + $frames = []; + + foreach ($this as $frame) { + $frames[] = $frame; + } + + return $frames; + } + + /** + * Clone instance + */ + public function __clone(): void + { + $this->imagick = clone $this->imagick; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Decoders/Base64ImageDecoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Decoders/Base64ImageDecoder.php new file mode 100644 index 0000000..ea15062 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Decoders/Base64ImageDecoder.php @@ -0,0 +1,26 @@ +isValidBase64($input)) { + throw new DecoderException('Unable to decode input'); + } + + return parent::decode(base64_decode((string) $input)); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Decoders/BinaryImageDecoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Decoders/BinaryImageDecoder.php new file mode 100644 index 0000000..96850b3 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Decoders/BinaryImageDecoder.php @@ -0,0 +1,47 @@ +readImageBlob($input); + } catch (ImagickException) { + throw new DecoderException('Unable to decode input'); + } + + // decode image + $image = parent::decode($imagick); + + // get media type enum from string media type + $format = Format::tryCreate($image->origin()->mediaType()); + + // extract exif data for appropriate formats + if (in_array($format, [Format::JPEG, Format::TIFF])) { + $image->setExif($this->extractExifData($input)); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Decoders/DataUriImageDecoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Decoders/DataUriImageDecoder.php new file mode 100644 index 0000000..f395cb0 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Decoders/DataUriImageDecoder.php @@ -0,0 +1,36 @@ +parseDataUri($input); + + if (!$uri->isValid()) { + throw new DecoderException('Unable to decode input'); + } + + if ($uri->isBase64Encoded()) { + return parent::decode(base64_decode($uri->data())); + } + + return parent::decode(urldecode($uri->data())); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Decoders/EncodedImageObjectDecoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Decoders/EncodedImageObjectDecoder.php new file mode 100644 index 0000000..2348a6b --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Decoders/EncodedImageObjectDecoder.php @@ -0,0 +1,27 @@ +toString()); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Decoders/FilePathImageDecoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Decoders/FilePathImageDecoder.php new file mode 100644 index 0000000..a418099 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Decoders/FilePathImageDecoder.php @@ -0,0 +1,46 @@ +isFile($input)) { + throw new DecoderException('Unable to decode input'); + } + + try { + $imagick = new Imagick(); + $imagick->readImage($input); + } catch (ImagickException) { + throw new DecoderException('Unable to decode input'); + } + + // decode image + $image = parent::decode($imagick); + + // set file path on origin + $image->origin()->setFilePath($input); + + // extract exif data for the appropriate formats + if (in_array($imagick->getImageFormat(), ['JPEG', 'TIFF', 'TIF'])) { + $image->setExif($this->extractExifData($input)); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Decoders/FilePointerImageDecoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Decoders/FilePointerImageDecoder.php new file mode 100644 index 0000000..08717e0 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Decoders/FilePointerImageDecoder.php @@ -0,0 +1,32 @@ +getImageFormat() !== 'JPEG') { + $input = $input->coalesceImages(); + } + + // turn images with colorspace 'GRAY' into 'SRGB' to avoid working on + // greyscale colorspace images as this results images loosing color + // information when placed into this image. + if ($input->getImageColorspace() == Imagick::COLORSPACE_GRAY) { + $input->setImageColorspace(Imagick::COLORSPACE_SRGB); + } + + // create image object + $image = new Image( + $this->driver(), + new Core($input) + ); + + // discard animation depending on config + if (!$this->driver()->config()->decodeAnimation) { + $image->modify(new RemoveAnimationModifier()); + } + + // adjust image rotatation + if ($this->driver()->config()->autoOrientation) { + $image->modify(new AlignRotationModifier()); + } + + // set media type on origin + $image->origin()->setMediaType($input->getImageMimeType()); + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Decoders/SplFileInfoImageDecoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Decoders/SplFileInfoImageDecoder.php new file mode 100644 index 0000000..8850123 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Decoders/SplFileInfoImageDecoder.php @@ -0,0 +1,27 @@ +getRealPath()); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Driver.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Driver.php new file mode 100644 index 0000000..61fd05f --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Driver.php @@ -0,0 +1,175 @@ +newImage($width, $height, $background, 'png'); + $imagick->setType(Imagick::IMGTYPE_UNDEFINED); + $imagick->setImageType(Imagick::IMGTYPE_UNDEFINED); + $imagick->setColorspace(Imagick::COLORSPACE_SRGB); + $imagick->setImageResolution(96, 96); + $imagick->setImageBackgroundColor($background); + + return new Image($this, new Core($imagick)); + } + + /** + * {@inheritdoc} + * + * @see DriverInterface::createAnimation() + * + * @throws RuntimeException + */ + public function createAnimation(callable $init): ImageInterface + { + $imagick = new Imagick(); + $imagick->setFormat('gif'); + + $animation = new class ($this, $imagick) + { + public function __construct( + protected DriverInterface $driver, + public Imagick $imagick + ) { + // + } + + /** + * @throws RuntimeException + */ + public function add(mixed $source, float $delay = 1): self + { + $native = $this->driver->handleInput($source)->core()->native(); + $native->setImageDelay(intval(round($delay * 100))); + + $this->imagick->addImage($native); + + return $this; + } + + /** + * @throws RuntimeException + */ + public function __invoke(): ImageInterface + { + return new Image( + $this->driver, + new Core($this->imagick) + ); + } + }; + + $init($animation); + + return call_user_func($animation); + } + + /** + * {@inheritdoc} + * + * @see DriverInterface::colorProcessor() + */ + public function colorProcessor(ColorspaceInterface $colorspace): ColorProcessorInterface + { + return new ColorProcessor($colorspace); + } + + /** + * {@inheritdoc} + * + * @see DriverInterface::fontProcessor() + */ + public function fontProcessor(): FontProcessorInterface + { + return new FontProcessor(); + } + + /** + * {@inheritdoc} + * + * @see DriverInterface::supports() + */ + public function supports(string|Format|FileExtension|MediaType $identifier): bool + { + try { + $format = Format::create($identifier); + } catch (NotSupportedException) { + return false; + } + + return count(Imagick::queryFormats($format->name)) >= 1; + } + + /** + * Return version of ImageMagick library + * + * @throws DriverException + */ + public static function version(): string + { + $pattern = '/^ImageMagick (?P(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)' . + '(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?' . + '(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)/'; + + if (preg_match($pattern, Imagick::getVersion()['versionString'], $matches) !== 1) { + throw new DriverException('Unable to read ImageMagick version number.'); + } + + return $matches['version']; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/AvifEncoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/AvifEncoder.php new file mode 100644 index 0000000..64cb4ae --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/AvifEncoder.php @@ -0,0 +1,37 @@ +strip || (is_null($this->strip) && $this->driver()->config()->strip)) { + $image->modify(new StripMetaModifier()); + } + + $imagick = $image->core()->native(); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + $imagick->setCompressionQuality($this->quality); + $imagick->setImageCompressionQuality($this->quality); + + return new EncodedImage($imagick->getImagesBlob(), 'image/avif'); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/BmpEncoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/BmpEncoder.php new file mode 100644 index 0000000..eede0f0 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/BmpEncoder.php @@ -0,0 +1,29 @@ +core()->native(); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + + return new EncodedImage($imagick->getImagesBlob(), 'image/bmp'); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/GifEncoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/GifEncoder.php new file mode 100644 index 0000000..f9c98b0 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/GifEncoder.php @@ -0,0 +1,34 @@ +core()->native(); + + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + + if ($this->interlaced) { + $imagick->setInterlaceScheme(Imagick::INTERLACE_LINE); + } + + return new EncodedImage($imagick->getImagesBlob(), 'image/gif'); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/HeicEncoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/HeicEncoder.php new file mode 100644 index 0000000..471edb1 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/HeicEncoder.php @@ -0,0 +1,33 @@ +strip || (is_null($this->strip) && $this->driver()->config()->strip)) { + $image->modify(new StripMetaModifier()); + } + + $imagick = $image->core()->native(); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompressionQuality($this->quality); + $imagick->setImageCompressionQuality($this->quality); + + return new EncodedImage($imagick->getImagesBlob(), 'image/heic'); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/Jpeg2000Encoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/Jpeg2000Encoder.php new file mode 100644 index 0000000..16f6593 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/Jpeg2000Encoder.php @@ -0,0 +1,39 @@ +strip || (is_null($this->strip) && $this->driver()->config()->strip)) { + $image->modify(new StripMetaModifier()); + } + + $imagick = $image->core()->native(); + $imagick->setImageBackgroundColor('white'); + $imagick->setBackgroundColor('white'); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + $imagick->setCompressionQuality($this->quality); + $imagick->setImageCompressionQuality($this->quality); + + return new EncodedImage($imagick->getImagesBlob(), 'image/jp2'); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/JpegEncoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/JpegEncoder.php new file mode 100644 index 0000000..e2365f3 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/JpegEncoder.php @@ -0,0 +1,57 @@ +driver()->handleInput( + $this->driver()->config()->blendingColor + ); + + // resolve blending color because jpeg has no transparency + $background = $this->driver() + ->colorProcessor($image->colorspace()) + ->colorToNative($blendingColor); + + // set alpha value to 1 because Imagick renders + // possible full transparent colors as black + $background->setColorValue(Imagick::COLOR_ALPHA, 1); + + // strip meta data + if ($this->strip || (is_null($this->strip) && $this->driver()->config()->strip)) { + $image->modify(new StripMetaModifier()); + } + + /** @var Imagick $imagick */ + $imagick = $image->core()->native(); + $imagick->setImageBackgroundColor($background); + $imagick->setBackgroundColor($background); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + $imagick->setCompressionQuality($this->quality); + $imagick->setImageCompressionQuality($this->quality); + $imagick->setImageAlphaChannel(Imagick::ALPHACHANNEL_REMOVE); + + if ($this->progressive) { + $imagick->setInterlaceScheme(Imagick::INTERLACE_PLANE); + } + + return new EncodedImage($imagick->getImagesBlob(), 'image/jpeg'); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/PngEncoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/PngEncoder.php new file mode 100644 index 0000000..cce49d5 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/PngEncoder.php @@ -0,0 +1,46 @@ +indexed) { + // reduce colors + $output = clone $image; + $output->reduceColors(256); + + $output = $output->core()->native(); + $output->setFormat('PNG'); + $output->setImageFormat('PNG'); + } else { + $output = clone $image->core()->native(); + $output->setFormat('PNG32'); + $output->setImageFormat('PNG32'); + } + + $output->setCompression(Imagick::COMPRESSION_ZIP); + $output->setImageCompression(Imagick::COMPRESSION_ZIP); + + if ($this->interlaced) { + $output->setInterlaceScheme(Imagick::INTERLACE_LINE); + } + + return new EncodedImage($output->getImagesBlob(), 'image/png'); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/TiffEncoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/TiffEncoder.php new file mode 100644 index 0000000..46e6653 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/TiffEncoder.php @@ -0,0 +1,35 @@ +strip || (is_null($this->strip) && $this->driver()->config()->strip)) { + $image->modify(new StripMetaModifier()); + } + + $imagick = $image->core()->native(); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($imagick->getImageCompression()); + $imagick->setImageCompression($imagick->getImageCompression()); + $imagick->setCompressionQuality($this->quality); + $imagick->setImageCompressionQuality($this->quality); + + return new EncodedImage($imagick->getImagesBlob(), 'image/tiff'); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/WebpEncoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/WebpEncoder.php new file mode 100644 index 0000000..b65be3b --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Encoders/WebpEncoder.php @@ -0,0 +1,47 @@ +strip || (is_null($this->strip) && $this->driver()->config()->strip)) { + $image->modify(new StripMetaModifier()); + } + + $imagick = $image->core()->native(); + $imagick->setImageBackgroundColor(new ImagickPixel('transparent')); + + if (!$image->isAnimated()) { + $imagick = $imagick->mergeImageLayers(Imagick::LAYERMETHOD_MERGE); + } + + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + $imagick->setImageCompressionQuality($this->quality); + + if ($this->quality === 100) { + $imagick->setOption('webp:lossless', 'true'); + } + + return new EncodedImage($imagick->getImagesBlob(), 'image/webp'); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/FontProcessor.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/FontProcessor.php new file mode 100644 index 0000000..16fc4c8 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/FontProcessor.php @@ -0,0 +1,69 @@ +toImagickDraw($font); + $dimensions = (new Imagick())->queryFontMetrics($draw, $text); + + return new Rectangle( + intval(round($dimensions['textWidth'])), + intval(round($dimensions['ascender'] + $dimensions['descender'])), + ); + } + + /** + * Imagick::annotateImage() needs an ImagickDraw object - this method takes + * the font object as the base and adds an optional passed color to the new + * ImagickDraw object. + * + * @throws FontException + * @throws ImagickDrawException + * @throws ImagickException + */ + public function toImagickDraw(FontInterface $font, ?ImagickPixel $color = null): ImagickDraw + { + if (!$font->hasFilename()) { + throw new FontException('No font file specified.'); + } + + $draw = new ImagickDraw(); + $draw->setStrokeAntialias(true); + $draw->setTextAntialias(true); + $draw->setFont($font->filename()); + $draw->setFontSize($this->nativeFontSize($font)); + $draw->setTextAlignment(Imagick::ALIGN_LEFT); + + if ($color instanceof ImagickPixel) { + $draw->setFillColor($color); + } + + return $draw; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Frame.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Frame.php new file mode 100644 index 0000000..269a8db --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Frame.php @@ -0,0 +1,185 @@ +native->setImageBackgroundColor($background); + $this->native->setBackgroundColor($background); + } + + /** + * {@inheritdoc} + * + * @see DriverInterface::toImage() + */ + public function toImage(DriverInterface $driver): ImageInterface + { + return new Image($driver, new Core($this->native())); + } + + /** + * {@inheritdoc} + * + * @see DriverInterface::setNative() + */ + public function setNative(mixed $native): FrameInterface + { + $this->native = $native; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see DriverInterface::native() + */ + public function native(): Imagick + { + return $this->native; + } + + /** + * {@inheritdoc} + * + * @see DriverInterface::size() + */ + public function size(): SizeInterface + { + return new Rectangle( + $this->native->getImageWidth(), + $this->native->getImageHeight() + ); + } + + /** + * {@inheritdoc} + * + * @see DriverInterface::delay() + */ + public function delay(): float + { + return $this->native->getImageDelay() / 100; + } + + /** + * {@inheritdoc} + * + * @see DriverInterface::setDelay() + */ + public function setDelay(float $delay): FrameInterface + { + $this->native->setImageDelay(intval(round($delay * 100))); + + return $this; + } + + /** + * {@inheritdoc} + * + * @see DriverInterface::dispose() + */ + public function dispose(): int + { + return $this->native->getImageDispose(); + } + + /** + * {@inheritdoc} + * + * @see DriverInterface::setDispose() + * + * @throws InputException + */ + public function setDispose(int $dispose): FrameInterface + { + if (!in_array($dispose, [0, 1, 2, 3])) { + throw new InputException('Value for argument $dispose must be 0, 1, 2 or 3.'); + } + + $this->native->setImageDispose($dispose); + + return $this; + } + + /** + * {@inheritdoc} + * + * @see DriverInterface::setOffset() + */ + public function setOffset(int $left, int $top): FrameInterface + { + $this->native->setImagePage( + $this->native->getImageWidth(), + $this->native->getImageHeight(), + $left, + $top + ); + + return $this; + } + + /** + * {@inheritdoc} + * + * @see DriverInterface::offsetLeft() + */ + public function offsetLeft(): int + { + return $this->native->getImagePage()['x']; + } + + /** + * {@inheritdoc} + * + * @see DriverInterface::setOffsetLeft() + */ + public function setOffsetLeft(int $offset): FrameInterface + { + return $this->setOffset($offset, $this->offsetTop()); + } + + /** + * {@inheritdoc} + * + * @see DriverInterface::offsetTop() + */ + public function offsetTop(): int + { + return $this->native->getImagePage()['y']; + } + + /** + * {@inheritdoc} + * + * @see DriverInterface::setOffsetTop() + */ + public function setOffsetTop(int $offset): FrameInterface + { + return $this->setOffset($this->offsetLeft(), $offset); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/AlignRotationModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/AlignRotationModifier.php new file mode 100644 index 0000000..6b84b30 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/AlignRotationModifier.php @@ -0,0 +1,54 @@ +core()->native()->getImageOrientation()) { + case Imagick::ORIENTATION_TOPRIGHT: // 2 + $image->core()->native()->flopImage(); + break; + + case Imagick::ORIENTATION_BOTTOMRIGHT: // 3 + $image->core()->native()->rotateImage("#000", 180); + break; + + case Imagick::ORIENTATION_BOTTOMLEFT: // 4 + $image->core()->native()->rotateImage("#000", 180); + $image->core()->native()->flopImage(); + break; + + case Imagick::ORIENTATION_LEFTTOP: // 5 + $image->core()->native()->rotateImage("#000", -270); + $image->core()->native()->flopImage(); + break; + + case Imagick::ORIENTATION_RIGHTTOP: // 6 + $image->core()->native()->rotateImage("#000", -270); + break; + + case Imagick::ORIENTATION_RIGHTBOTTOM: // 7 + $image->core()->native()->rotateImage("#000", -90); + $image->core()->native()->flopImage(); + break; + + case Imagick::ORIENTATION_LEFTBOTTOM: // 8 + $image->core()->native()->rotateImage("#000", -90); + break; + } + + // set new orientation in image + $image->core()->native()->setImageOrientation(Imagick::ORIENTATION_TOPLEFT); + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/BlendTransparencyModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/BlendTransparencyModifier.php new file mode 100644 index 0000000..8fdc0b3 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/BlendTransparencyModifier.php @@ -0,0 +1,32 @@ +blendingColor($this->driver()); + + // get imagickpixel from blending color + $pixel = $this->driver() + ->colorProcessor($image->colorspace()) + ->colorToNative($blendingColor); + + // merge transparent areas with the background color + foreach ($image as $frame) { + $frame->native()->setImageBackgroundColor($pixel); + $frame->native()->setImageAlphaChannel(Imagick::ALPHACHANNEL_REMOVE); + $frame->native()->mergeImageLayers(Imagick::LAYERMETHOD_FLATTEN); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/BlurModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/BlurModifier.php new file mode 100644 index 0000000..94c52d1 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/BlurModifier.php @@ -0,0 +1,21 @@ +native()->blurImage($this->amount, 0.5 * $this->amount); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/BrightnessModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/BrightnessModifier.php new file mode 100644 index 0000000..80fd9df --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/BrightnessModifier.php @@ -0,0 +1,21 @@ +native()->modulateImage(100 + $this->level, 100, 100); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ColorizeModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ColorizeModifier.php new file mode 100644 index 0000000..c4abc30 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ColorizeModifier.php @@ -0,0 +1,34 @@ +normalizeLevel($this->red); + $green = $this->normalizeLevel($this->green); + $blue = $this->normalizeLevel($this->blue); + + foreach ($image as $frame) { + $qrange = $frame->native()->getQuantumRange(); + $frame->native()->levelImage(0, $red, $qrange['quantumRangeLong'], Imagick::CHANNEL_RED); + $frame->native()->levelImage(0, $green, $qrange['quantumRangeLong'], Imagick::CHANNEL_GREEN); + $frame->native()->levelImage(0, $blue, $qrange['quantumRangeLong'], Imagick::CHANNEL_BLUE); + } + + return $image; + } + + private function normalizeLevel(int $level): int + { + return $level > 0 ? intval(round($level / 5)) : intval(round(($level + 100) / 100)); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ColorspaceModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ColorspaceModifier.php new file mode 100644 index 0000000..37e1020 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ColorspaceModifier.php @@ -0,0 +1,51 @@ + + */ + protected static array $mapping = [ + RgbColorspace::class => Imagick::COLORSPACE_SRGB, + CmykColorspace::class => Imagick::COLORSPACE_CMYK, + ]; + + public function apply(ImageInterface $image): ImageInterface + { + $colorspace = $this->targetColorspace(); + + $imagick = $image->core()->native(); + $imagick->transformImageColorspace( + $this->getImagickColorspace($colorspace) + ); + + return $image; + } + + /** + * @throws NotSupportedException + */ + private function getImagickColorspace(ColorspaceInterface $colorspace): int + { + if (!array_key_exists($colorspace::class, self::$mapping)) { + throw new NotSupportedException('Given colorspace is not supported.'); + } + + return self::$mapping[$colorspace::class]; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ContainModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ContainModifier.php new file mode 100644 index 0000000..b01bfd3 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ContainModifier.php @@ -0,0 +1,95 @@ +getCropSize($image); + $resize = $this->getResizeSize($image); + $transparent = new ImagickPixel('transparent'); + $background = $this->driver()->colorProcessor($image->colorspace())->colorToNative( + $this->driver()->handleInput($this->background) + ); + + foreach ($image as $frame) { + $frame->native()->scaleImage( + $crop->width(), + $crop->height(), + ); + + $frame->native()->setBackgroundColor($transparent); + $frame->native()->setImageBackgroundColor($transparent); + + $frame->native()->extentImage( + $resize->width(), + $resize->height(), + $crop->pivot()->x() * -1, + $crop->pivot()->y() * -1 + ); + + if ($resize->width() > $crop->width()) { + // fill new emerged background + $draw = new ImagickDraw(); + $draw->setFillColor($background); + + $delta = abs($crop->pivot()->x()); + + if ($delta > 0) { + $draw->rectangle( + 0, + 0, + $delta - 1, + $resize->height() + ); + } + + $draw->rectangle( + $crop->width() + $delta, + 0, + $resize->width(), + $resize->height() + ); + + $frame->native()->drawImage($draw); + } + + if ($resize->height() > $crop->height()) { + // fill new emerged background + $draw = new ImagickDraw(); + $draw->setFillColor($background); + + $delta = abs($crop->pivot()->y()); + + if ($delta > 0) { + $draw->rectangle( + 0, + 0, + $resize->width(), + $delta - 1 + ); + } + + $draw->rectangle( + 0, + $crop->height() + $delta, + $resize->width(), + $resize->height() + ); + + $frame->native()->drawImage($draw); + } + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ContrastModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ContrastModifier.php new file mode 100644 index 0000000..72083fa --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ContrastModifier.php @@ -0,0 +1,21 @@ +native()->sigmoidalContrastImage($this->level > 0, abs($this->level / 4), 0); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/CoverDownModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/CoverDownModifier.php new file mode 100644 index 0000000..44ab79e --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/CoverDownModifier.php @@ -0,0 +1,19 @@ +resizeDown($this->width, $this->height); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/CoverModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/CoverModifier.php new file mode 100644 index 0000000..835c4de --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/CoverModifier.php @@ -0,0 +1,36 @@ +getCropSize($image); + $resize = $this->getResizeSize($crop); + + foreach ($image as $frame) { + $frame->native()->cropImage( + $crop->width(), + $crop->height(), + $crop->pivot()->x(), + $crop->pivot()->y() + ); + + $frame->native()->scaleImage( + $resize->width(), + $resize->height() + ); + + $frame->native()->setImagePage(0, 0, 0, 0); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/CropModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/CropModifier.php new file mode 100644 index 0000000..6a2e8d3 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/CropModifier.php @@ -0,0 +1,75 @@ +driver()->colorProcessor($image->colorspace())->colorToNative( + $this->driver()->handleInput($this->background) + ); + + // create empty container imagick to rebuild core + $imagick = new Imagick(); + + // save resolution to add it later + $resolution = $image->resolution()->perInch(); + + // define position of the image on the new canvas + $crop = $this->crop($image); + $position = [ + ($crop->pivot()->x() + $this->offset_x) * -1, + ($crop->pivot()->y() + $this->offset_y) * -1, + ]; + + foreach ($image as $frame) { + // create new frame canvas with modifiers background + $canvas = new Imagick(); + $canvas->newImage($crop->width(), $crop->height(), $background, 'png'); + $canvas->setImageResolution($resolution->x(), $resolution->y()); + $canvas->setImageAlphaChannel(Imagick::ALPHACHANNEL_SET); // or ALPHACHANNEL_ACTIVATE? + + // set animation details + if ($image->isAnimated()) { + $canvas->setImageDelay($frame->native()->getImageDelay()); + $canvas->setImageIterations($frame->native()->getImageIterations()); + $canvas->setImageDispose($frame->native()->getImageDispose()); + } + + // make the rectangular position of the original image transparent + // so that we can later place the original on top. this preserves + // the transparency of the original and shows the background color + // of the modifier in the other areas. if the original image has no + // transparent area the rectangular transparency will be covered by + // the original. + $clearer = new Imagick(); + $clearer->newImage( + $frame->native()->getImageWidth(), + $frame->native()->getImageHeight(), + new ImagickPixel('black'), + ); + $canvas->compositeImage($clearer, Imagick::COMPOSITE_DSTOUT, ...$position); + + // place original frame content onto prepared frame canvas + $canvas->compositeImage($frame->native(), Imagick::COMPOSITE_DEFAULT, ...$position); + + // add newly built frame to container imagick + $imagick->addImage($canvas); + } + + // replace imagick in the original image + $image->core()->setNative($imagick); + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/DrawBezierModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/DrawBezierModifier.php new file mode 100644 index 0000000..fda3ec4 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/DrawBezierModifier.php @@ -0,0 +1,77 @@ +drawable->count() !== 3 && $this->drawable->count() !== 4) { + throw new GeometryException('You must specify either 3 or 4 points to create a bezier curve'); + } + + $drawing = new ImagickDraw(); + + if ($this->drawable->hasBackgroundColor()) { + $background_color = $this->driver()->colorProcessor($image->colorspace())->colorToNative( + $this->backgroundColor() + ); + } else { + $background_color = 'transparent'; + } + + $drawing->setFillColor($background_color); + + if ($this->drawable->hasBorder() && $this->drawable->borderSize() > 0) { + $border_color = $this->driver()->colorProcessor($image->colorspace())->colorToNative( + $this->borderColor() + ); + + $drawing->setStrokeColor($border_color); + $drawing->setStrokeWidth($this->drawable->borderSize()); + } + + $drawing->pathStart(); + $drawing->pathMoveToAbsolute( + $this->drawable->first()->x(), + $this->drawable->first()->y() + ); + if ($this->drawable->count() === 3) { + $drawing->pathCurveToQuadraticBezierAbsolute( + $this->drawable->second()->x(), + $this->drawable->second()->y(), + $this->drawable->last()->x(), + $this->drawable->last()->y() + ); + } elseif ($this->drawable->count() === 4) { + $drawing->pathCurveToAbsolute( + $this->drawable->second()->x(), + $this->drawable->second()->y(), + $this->drawable->third()->x(), + $this->drawable->third()->y(), + $this->drawable->last()->x(), + $this->drawable->last()->y() + ); + } + $drawing->pathFinish(); + + foreach ($image as $frame) { + $frame->native()->drawImage($drawing); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/DrawEllipseModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/DrawEllipseModifier.php new file mode 100644 index 0000000..1508f91 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/DrawEllipseModifier.php @@ -0,0 +1,51 @@ +driver()->colorProcessor($image->colorspace())->colorToNative( + $this->backgroundColor() + ); + + $border_color = $this->driver()->colorProcessor($image->colorspace())->colorToNative( + $this->borderColor() + ); + + foreach ($image as $frame) { + $drawing = new ImagickDraw(); + $drawing->setFillColor($background_color); + + if ($this->drawable->hasBorder()) { + $drawing->setStrokeWidth($this->drawable->borderSize()); + $drawing->setStrokeColor($border_color); + } + + $drawing->ellipse( + $this->drawable->position()->x(), + $this->drawable->position()->y(), + $this->drawable->width() / 2, + $this->drawable->height() / 2, + 0, + 360 + ); + + $frame->native()->drawImage($drawing); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/DrawLineModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/DrawLineModifier.php new file mode 100644 index 0000000..ac09e51 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/DrawLineModifier.php @@ -0,0 +1,42 @@ +setStrokeWidth($this->drawable->width()); + $drawing->setFillOpacity(0); + $drawing->setStrokeColor( + $this->driver()->colorProcessor($image->colorspace())->colorToNative( + $this->backgroundColor() + ) + ); + + $drawing->line( + $this->drawable->start()->x(), + $this->drawable->start()->y(), + $this->drawable->end()->x(), + $this->drawable->end()->y(), + ); + + foreach ($image as $frame) { + $frame->native()->drawImage($drawing); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/DrawPixelModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/DrawPixelModifier.php new file mode 100644 index 0000000..e69ecc2 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/DrawPixelModifier.php @@ -0,0 +1,30 @@ +driver()->colorProcessor($image->colorspace())->colorToNative( + $this->driver()->handleInput($this->color) + ); + + $pixel = new ImagickDraw(); + $pixel->setFillColor($color); + $pixel->point($this->position->x(), $this->position->y()); + + foreach ($image as $frame) { + $frame->native()->drawImage($pixel); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/DrawPolygonModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/DrawPolygonModifier.php new file mode 100644 index 0000000..003d88c --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/DrawPolygonModifier.php @@ -0,0 +1,64 @@ +setFillColor(new ImagickPixel('transparent')); // defaults to no backgroundColor + + if ($this->drawable->hasBackgroundColor()) { + $background_color = $this->driver()->colorProcessor($image->colorspace())->colorToNative( + $this->backgroundColor() + ); + + $drawing->setFillColor($background_color); + } + + if ($this->drawable->hasBorder()) { + $border_color = $this->driver()->colorProcessor($image->colorspace())->colorToNative( + $this->borderColor() + ); + + $drawing->setStrokeColor($border_color); + $drawing->setStrokeWidth($this->drawable->borderSize()); + } + + $drawing->polygon($this->points()); + + foreach ($image as $frame) { + $frame->native()->drawImage($drawing); + } + + return $image; + } + + /** + * Return points of drawable in processable form for ImagickDraw + * + * @return array> + */ + private function points(): array + { + $points = []; + foreach ($this->drawable as $point) { + $points[] = ['x' => $point->x(), 'y' => $point->y()]; + } + + return $points; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/DrawRectangleModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/DrawRectangleModifier.php new file mode 100644 index 0000000..8f8e79e --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/DrawRectangleModifier.php @@ -0,0 +1,50 @@ +driver()->colorProcessor($image->colorspace())->colorToNative( + $this->backgroundColor() + ); + + $border_color = $this->driver()->colorProcessor($image->colorspace())->colorToNative( + $this->borderColor() + ); + + $drawing->setFillColor($background_color); + if ($this->drawable->hasBorder()) { + $drawing->setStrokeColor($border_color); + $drawing->setStrokeWidth($this->drawable->borderSize()); + } + + // build rectangle + $drawing->rectangle( + $this->drawable->position()->x(), + $this->drawable->position()->y(), + $this->drawable->position()->x() + $this->drawable->width(), + $this->drawable->position()->y() + $this->drawable->height() + ); + + foreach ($image as $frame) { + $frame->native()->drawImage($drawing); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/FillModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/FillModifier.php new file mode 100644 index 0000000..274745f --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/FillModifier.php @@ -0,0 +1,63 @@ +driver()->colorProcessor($image->colorspace())->colorToNative( + $this->driver()->handleInput($this->color) + ); + + foreach ($image->core()->native() as $frame) { + if ($this->hasPosition()) { + $this->floodFillWithColor($frame, $pixel); + } else { + $this->fillAllWithColor($frame, $pixel); + } + } + + return $image; + } + + private function floodFillWithColor(Imagick $frame, ImagickPixel $pixel): void + { + $target = $frame->getImagePixelColor( + $this->position->x(), + $this->position->y() + ); + + $frame->floodfillPaintImage( + $pixel, + 100, + $target, + $this->position->x(), + $this->position->y(), + false, + Imagick::CHANNEL_ALL + ); + } + + private function fillAllWithColor(Imagick $frame, ImagickPixel $pixel): void + { + $draw = new ImagickDraw(); + $draw->setFillColor($pixel); + $draw->rectangle(0, 0, $frame->getImageWidth(), $frame->getImageHeight()); + $frame->drawImage($draw); + + // deactive alpha channel when image was filled with opaque color + if ($pixel->getColorValue(Imagick::COLOR_ALPHA) == 1) { + $frame->setImageAlphaChannel(Imagick::ALPHACHANNEL_DEACTIVATE); + } + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/FlipModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/FlipModifier.php new file mode 100644 index 0000000..edfa124 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/FlipModifier.php @@ -0,0 +1,21 @@ +native()->flipImage(); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/FlopModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/FlopModifier.php new file mode 100644 index 0000000..d05c239 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/FlopModifier.php @@ -0,0 +1,21 @@ +native()->flopImage(); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/GammaModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/GammaModifier.php new file mode 100644 index 0000000..f8b1c7c --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/GammaModifier.php @@ -0,0 +1,21 @@ +native()->gammaImage($this->gamma); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/GreyscaleModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/GreyscaleModifier.php new file mode 100644 index 0000000..4bc2f28 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/GreyscaleModifier.php @@ -0,0 +1,21 @@ +native()->modulateImage(100, 0, 100); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/InvertModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/InvertModifier.php new file mode 100644 index 0000000..d504ecb --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/InvertModifier.php @@ -0,0 +1,21 @@ +native()->negateImage(false); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/PadModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/PadModifier.php new file mode 100644 index 0000000..40499d9 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/PadModifier.php @@ -0,0 +1,24 @@ +size() + ->containMax( + $this->width, + $this->height + ) + ->alignPivotTo( + $this->getResizeSize($image), + $this->position + ); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/PixelateModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/PixelateModifier.php new file mode 100644 index 0000000..e79eb42 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/PixelateModifier.php @@ -0,0 +1,34 @@ +pixelateFrame($frame); + } + + return $image; + } + + protected function pixelateFrame(FrameInterface $frame): void + { + $size = $frame->size(); + + $frame->native()->scaleImage( + (int) round(max(1, $size->width() / $this->size)), + (int) round(max(1, $size->height() / $this->size)) + ); + + $frame->native()->scaleImage($size->width(), $size->height()); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/PlaceModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/PlaceModifier.php new file mode 100644 index 0000000..eb5b722 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/PlaceModifier.php @@ -0,0 +1,40 @@ +driver()->handleInput($this->element); + $position = $this->getPosition($image, $watermark); + + // set opacity of watermark + if ($this->opacity < 100) { + $watermark->core()->native()->setImageAlphaChannel(Imagick::ALPHACHANNEL_SET); + $watermark->core()->native()->evaluateImage( + Imagick::EVALUATE_DIVIDE, + $this->opacity > 0 ? 100 / $this->opacity : 1000, + Imagick::CHANNEL_ALPHA, + ); + } + + foreach ($image as $frame) { + $frame->native()->compositeImage( + $watermark->core()->native(), + Imagick::COMPOSITE_DEFAULT, + $position->x(), + $position->y() + ); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ProfileModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ProfileModifier.php new file mode 100644 index 0000000..22212d9 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ProfileModifier.php @@ -0,0 +1,25 @@ +core()->native(); + $result = $imagick->profileImage('icc', (string) $this->profile); + + if ($result === false) { + throw new ColorException('ICC color profile could not be set.'); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ProfileRemovalModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ProfileRemovalModifier.php new file mode 100644 index 0000000..ef4a2ab --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ProfileRemovalModifier.php @@ -0,0 +1,25 @@ +core()->native(); + $result = $imagick->profileImage('icc', null); + + if ($result === false) { + throw new ColorException('ICC color profile could not be removed.'); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/QuantizeColorsModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/QuantizeColorsModifier.php new file mode 100644 index 0000000..6a93482 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/QuantizeColorsModifier.php @@ -0,0 +1,37 @@ +limit <= 0) { + throw new InputException('Quantization limit must be greater than 0.'); + } + + // no color reduction if the limit is higher than the colors in the img + if ($this->limit > $image->core()->native()->getImageColors()) { + return $image; + } + + foreach ($image as $frame) { + $frame->native()->quantizeImage( + $this->limit, + $frame->native()->getImageColorspace(), + 0, + false, + false + ); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/RemoveAnimationModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/RemoveAnimationModifier.php new file mode 100644 index 0000000..61c884c --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/RemoveAnimationModifier.php @@ -0,0 +1,26 @@ +selectedFrame($image); + $imagick->addImage($frame->native()->getImage()); + + // set new imagick to image + $image->core()->setNative($imagick); + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ResizeCanvasModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ResizeCanvasModifier.php new file mode 100644 index 0000000..4459f32 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ResizeCanvasModifier.php @@ -0,0 +1,27 @@ +cropSize($image); + + $image->modify(new CropModifier( + $cropSize->width(), + $cropSize->height(), + $cropSize->pivot()->x(), + $cropSize->pivot()->y(), + $this->background, + )); + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ResizeCanvasRelativeModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ResizeCanvasRelativeModifier.php new file mode 100644 index 0000000..e1fcb74 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ResizeCanvasRelativeModifier.php @@ -0,0 +1,16 @@ +size()->resizeDown($this->width, $this->height); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ResizeModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ResizeModifier.php new file mode 100644 index 0000000..459aad0 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ResizeModifier.php @@ -0,0 +1,36 @@ +getAdjustedSize($image); + + foreach ($image as $frame) { + $frame->native()->scaleImage( + $resizeTo->width(), + $resizeTo->height() + ); + } + + return $image; + } + + /** + * @throws RuntimeException + */ + protected function getAdjustedSize(ImageInterface $image): SizeInterface + { + return $image->size()->resize($this->width, $this->height); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ResolutionModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ResolutionModifier.php new file mode 100644 index 0000000..426e683 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ResolutionModifier.php @@ -0,0 +1,20 @@ +core()->native(); + $imagick->setImageResolution($this->x, $this->y); + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/RotateModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/RotateModifier.php new file mode 100644 index 0000000..19ad228 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/RotateModifier.php @@ -0,0 +1,28 @@ +driver()->colorProcessor($image->colorspace())->colorToNative( + $this->driver()->handleInput($this->background) + ); + + foreach ($image as $frame) { + $frame->native()->rotateImage( + $background, + $this->rotationAngle() * -1 + ); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ScaleDownModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ScaleDownModifier.php new file mode 100644 index 0000000..ae874bb --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ScaleDownModifier.php @@ -0,0 +1,16 @@ +size()->scaleDown($this->width, $this->height); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ScaleModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ScaleModifier.php new file mode 100644 index 0000000..da8c2c4 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/ScaleModifier.php @@ -0,0 +1,16 @@ +size()->scale($this->width, $this->height); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/SharpenModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/SharpenModifier.php new file mode 100644 index 0000000..120d3c8 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/SharpenModifier.php @@ -0,0 +1,21 @@ +native()->unsharpMaskImage(1, 1, $this->amount / 6.25, 0); + } + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/SliceAnimationModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/SliceAnimationModifier.php new file mode 100644 index 0000000..1669107 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/SliceAnimationModifier.php @@ -0,0 +1,24 @@ +offset >= $image->count()) { + throw new AnimationException('Offset is not in the range of frames.'); + } + + $image->core()->slice($this->offset, $this->length); + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/StripMetaModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/StripMetaModifier.php new file mode 100644 index 0000000..58d1e7a --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/StripMetaModifier.php @@ -0,0 +1,34 @@ +core()->native()->getImageProfiles('icc'); + + // remove meta data + $image->core()->native()->stripImage(); + $image->setExif(new Collection()); + + if ($profiles !== []) { + // re-apply icc profiles + $image->core()->native()->profileImage("icc", $profiles['icc']); + } + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/TextModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/TextModifier.php new file mode 100644 index 0000000..69ff34c --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/TextModifier.php @@ -0,0 +1,139 @@ +processor()->textBlock($this->text, $this->font, $this->position); + $drawText = $this->imagickDrawText($image, $this->font); + $drawStroke = $this->imagickDrawStroke($image, $this->font); + + foreach ($image as $frame) { + foreach ($lines as $line) { + foreach ($this->strokeOffsets($this->font) as $offset) { + // Draw the stroke outline under the actual text + $this->maybeDrawTextline($frame, $line, $drawStroke, $offset); + } + + // Draw the actual text + $this->maybeDrawTextline($frame, $line, $drawText); + } + } + + return $image; + } + + /** + * Create an ImagickDraw object to draw text on the image + * + * @throws RuntimeException + * @throws ColorException + * @throws FontException + * @throws ImagickDrawException + * @throws ImagickException + */ + private function imagickDrawText(ImageInterface $image, FontInterface $font): ImagickDraw + { + $color = $this->driver()->handleInput($font->color()); + + if ($font->hasStrokeEffect() && $color->isTransparent()) { + throw new ColorException( + 'The text color must be fully opaque when using the stroke effect.' + ); + } + + $color = $this->driver()->colorProcessor($image->colorspace())->colorToNative($color); + + return $this->processor()->toImagickDraw($font, $color); + } + + /** + * Create a ImagickDraw object to draw the outline stroke effect on the Image + * + * @throws RuntimeException + * @throws ColorException + * @throws FontException + * @throws ImagickDrawException + * @throws ImagickException + */ + private function imagickDrawStroke(ImageInterface $image, FontInterface $font): ?ImagickDraw + { + if (!$font->hasStrokeEffect()) { + return null; + } + + $color = $this->driver()->handleInput($font->strokeColor()); + + if ($color->isTransparent()) { + throw new ColorException( + 'The stroke color must be fully opaque.' + ); + } + + $color = $this->driver()->colorProcessor($image->colorspace())->colorToNative($color); + + return $this->processor()->toImagickDraw($font, $color); + } + + /** + * Maybe draw given line of text on frame instance depending on given + * ImageDraw instance. Optionally move line position by given offset. + */ + private function maybeDrawTextline( + FrameInterface $frame, + Line $textline, + ?ImagickDraw $draw = null, + PointInterface $offset = new Point(), + ): void { + if ($draw instanceof ImagickDraw) { + $frame->native()->annotateImage( + $draw, + $textline->position()->x() + $offset->x(), + $textline->position()->y() + $offset->y(), + $this->font->angle(), + (string) $textline + ); + } + } + + /** + * Return imagick font processor + * + * @throws FontException + */ + private function processor(): FontProcessor + { + $processor = $this->driver()->fontProcessor(); + + if (!($processor instanceof FontProcessor)) { + throw new FontException('Font processor does not match the driver.'); + } + + return $processor; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/TrimModifier.php b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/TrimModifier.php new file mode 100644 index 0000000..88bc46a --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Imagick/Modifiers/TrimModifier.php @@ -0,0 +1,26 @@ +isAnimated()) { + throw new NotSupportedException('Trim modifier cannot be applied to animated images.'); + } + + $imagick = $image->core()->native(); + $imagick->trimImage(($this->tolerance / 100 * $imagick->getQuantum()) / 1.5); + $imagick->setImagePage(0, 0, 0, 0); + + return $image; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/Specializable.php b/upLoadImage/vendor/intervention/image/src/Drivers/Specializable.php new file mode 100644 index 0000000..30a1c3f --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/Specializable.php @@ -0,0 +1,13 @@ +analyze($this); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Drivers/SpecializableDecoder.php b/upLoadImage/vendor/intervention/image/src/Drivers/SpecializableDecoder.php new file mode 100644 index 0000000..9b0bf8b --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Drivers/SpecializableDecoder.php @@ -0,0 +1,26 @@ +modify($this); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/EncodedImage.php b/upLoadImage/vendor/intervention/image/src/EncodedImage.php new file mode 100644 index 0000000..e8c767a --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/EncodedImage.php @@ -0,0 +1,65 @@ +mediaType; + } + + /** + * {@inheritdoc} + * + * @see EncodedImageInterface::mimetype() + */ + public function mimetype(): string + { + return $this->mediaType(); + } + + /** + * {@inheritdoc} + * + * @see EncodedImageInterface::toDataUri() + */ + public function toDataUri(): string + { + return sprintf('data:%s;base64,%s', $this->mediaType(), base64_encode((string) $this)); + } + + /** + * Show debug info for the current image + * + * @return array + */ + public function __debugInfo(): array + { + return [ + 'mediaType' => $this->mediaType(), + 'size' => $this->size(), + ]; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Encoders/AutoEncoder.php b/upLoadImage/vendor/intervention/image/src/Encoders/AutoEncoder.php new file mode 100644 index 0000000..0c909d1 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Encoders/AutoEncoder.php @@ -0,0 +1,25 @@ +encode( + $this->encoderByMediaType( + $image->origin()->mediaType() + ) + ); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Encoders/AvifEncoder.php b/upLoadImage/vendor/intervention/image/src/Encoders/AvifEncoder.php new file mode 100644 index 0000000..2cf708d --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Encoders/AvifEncoder.php @@ -0,0 +1,23 @@ + + */ + protected array $options = []; + + /** + * Create new encoder instance to encode to format of given file extension + * + * @param null|string|FileExtension $extension Target file extension for example "png" + * @return void + */ + public function __construct(public null|string|FileExtension $extension = null, mixed ...$options) + { + $this->options = $options; + } + + /** + * {@inheritdoc} + * + * @see EncoderInterface::encode() + */ + public function encode(ImageInterface $image): EncodedImageInterface + { + $extension = is_null($this->extension) ? $image->origin()->fileExtension() : $this->extension; + + return $image->encode( + $this->encoderByFileExtension( + $extension + ) + ); + } + + /** + * Create matching encoder for given file extension + * + * @throws EncoderException + */ + protected function encoderByFileExtension(null|string|FileExtension $extension): EncoderInterface + { + if (empty($extension)) { + throw new EncoderException('No encoder found for empty file extension.'); + } + + try { + $extension = is_string($extension) ? FileExtension::from(strtolower($extension)) : $extension; + } catch (Error) { + throw new EncoderException('No encoder found for file extension (' . $extension . ').'); + } + + return $extension->format()->encoder(...$this->options); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Encoders/FilePathEncoder.php b/upLoadImage/vendor/intervention/image/src/Encoders/FilePathEncoder.php new file mode 100644 index 0000000..62c496d --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Encoders/FilePathEncoder.php @@ -0,0 +1,38 @@ +encode( + $this->encoderByFileExtension( + is_null($this->path) ? $image->origin()->fileExtension() : pathinfo($this->path, PATHINFO_EXTENSION) + ) + ); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Encoders/GifEncoder.php b/upLoadImage/vendor/intervention/image/src/Encoders/GifEncoder.php new file mode 100644 index 0000000..0ee950a --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Encoders/GifEncoder.php @@ -0,0 +1,20 @@ + + */ + protected array $options = []; + + /** + * Create new encoder instance + * + * @param null|string|MediaType $mediaType Target media type for example "image/jpeg" + * @return void + */ + public function __construct(public null|string|MediaType $mediaType = null, mixed ...$options) + { + $this->options = $options; + } + + /** + * {@inheritdoc} + * + * @see EncoderInterface::encode() + */ + public function encode(ImageInterface $image): EncodedImageInterface + { + $mediaType = is_null($this->mediaType) ? $image->origin()->mediaType() : $this->mediaType; + + return $image->encode( + $this->encoderByMediaType($mediaType) + ); + } + + /** + * Return new encoder by given media (MIME) type + * + * @throws EncoderException + */ + protected function encoderByMediaType(string|MediaType $mediaType): EncoderInterface + { + try { + $mediaType = is_string($mediaType) ? MediaType::from($mediaType) : $mediaType; + } catch (Error) { + throw new EncoderException('No encoder found for media type (' . $mediaType . ').'); + } + + return $mediaType->format()->encoder(...$this->options); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Encoders/PngEncoder.php b/upLoadImage/vendor/intervention/image/src/Encoders/PngEncoder.php new file mode 100644 index 0000000..f542073 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Encoders/PngEncoder.php @@ -0,0 +1,20 @@ +pointer = $this->buildFilePointer($data); + } + + /** + * Create file object from path in file system + * + * @throws RuntimeException + */ + public static function fromPath(string $path): self + { + return new self(fopen($path, 'r')); + } + + /** + * {@inheritdoc} + * + * @see FileInterface::save() + */ + public function save(string $filepath): void + { + $dir = pathinfo($filepath, PATHINFO_DIRNAME); + + if (!is_dir($dir)) { + throw new NotWritableException( + "Can't write image to path. Directory does not exist." + ); + } + + if (!is_writable($dir)) { + throw new NotWritableException( + "Can't write image to path. Directory is not writable." + ); + } + + if (is_file($filepath) && !is_writable($filepath)) { + throw new NotWritableException( + sprintf("Can't write image. Path (%s) is not writable.", $filepath) + ); + } + + // write data + $saved = @file_put_contents($filepath, $this->toFilePointer()); + if ($saved === false) { + throw new NotWritableException( + sprintf("Can't write image data to path (%s).", $filepath) + ); + } + } + + /** + * {@inheritdoc} + * + * @see FileInterface::toString() + */ + public function toString(): string + { + return stream_get_contents($this->toFilePointer(), offset: 0); + } + + /** + * {@inheritdoc} + * + * @see FileInterface::toFilePointer() + */ + public function toFilePointer() + { + rewind($this->pointer); + + return $this->pointer; + } + + /** + * {@inheritdoc} + * + * @see FileInterface::size() + */ + public function size(): int + { + $info = fstat($this->toFilePointer()); + + return intval($info['size']); + } + + /** + * {@inheritdoc} + * + * @see FileInterface::__toString() + */ + public function __toString(): string + { + return $this->toString(); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/FileExtension.php b/upLoadImage/vendor/intervention/image/src/FileExtension.php new file mode 100644 index 0000000..dce24c5 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/FileExtension.php @@ -0,0 +1,127 @@ +fileExtension(); + } + + if ($identifier instanceof MediaType) { + return $identifier->fileExtension(); + } + + try { + $extension = self::from(strtolower($identifier)); + } catch (Error) { + try { + $extension = MediaType::from(strtolower($identifier))->fileExtension(); + } catch (Error) { + throw new NotSupportedException('Unable to create file extension from "' . $identifier . '".'); + } + } + + return $extension; + } + + /** + * Try to create media type from given identifier and return null on failure + * + * @param string|Format|MediaType|FileExtension $identifier + * @return FileExtension|null + */ + public static function tryCreate(string|self|Format|MediaType $identifier): ?self + { + try { + return self::create($identifier); + } catch (NotSupportedException) { + return null; + } + } + + /** + * Return the matching format for the current file extension + */ + public function format(): Format + { + return match ($this) { + self::JPEG, + self::JPG => Format::JPEG, + self::WEBP => Format::WEBP, + self::GIF => Format::GIF, + self::PNG => Format::PNG, + self::AVIF => Format::AVIF, + self::BMP => Format::BMP, + self::TIF, + self::TIFF => Format::TIFF, + self::JP2, + self::JP2K, + self::J2K, + self::JPF, + self::JPM, + self::JPG2, + self::J2C, + self::JPC, + self::JPX => Format::JP2, + self::HEIC, + self::HEIF => Format::HEIC, + }; + } + + /** + * Return media types for the current format + * + * @return array + */ + public function mediaTypes(): array + { + return $this->format()->mediaTypes(); + } + + /** + * Return the first found media type for the current format + */ + public function mediaType(): MediaType + { + return $this->format()->mediaType(); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Format.php b/upLoadImage/vendor/intervention/image/src/Format.php new file mode 100644 index 0000000..09be895 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Format.php @@ -0,0 +1,165 @@ +format(); + } + + if ($identifier instanceof FileExtension) { + return $identifier->format(); + } + + try { + $format = MediaType::from(strtolower($identifier))->format(); + } catch (Error) { + try { + $format = FileExtension::from(strtolower($identifier))->format(); + } catch (Error) { + throw new NotSupportedException('Unable to create format from "' . $identifier . '".'); + } + } + + return $format; + } + + /** + * Try to create format from given identifier and return null on failure + * + * @param string|Format|MediaType|FileExtension $identifier + * @return Format|null + */ + public static function tryCreate(string|self|MediaType|FileExtension $identifier): ?self + { + try { + return self::create($identifier); + } catch (NotSupportedException) { + return null; + } + } + + /** + * Return the possible media (MIME) types for the current format + * + * @return array + */ + public function mediaTypes(): array + { + return array_filter( + MediaType::cases(), + fn(MediaType $mediaType): bool => $mediaType->format() === $this + ); + } + + /** + * Return the first found media type for the current format + */ + public function mediaType(): MediaType + { + $types = $this->mediaTypes(); + + return reset($types); + } + + /** + * Return the possible file extension for the current format + * + * @return array + */ + public function fileExtensions(): array + { + return array_filter( + FileExtension::cases(), + fn(FileExtension $fileExtension): bool => $fileExtension->format() === $this + ); + } + + /** + * Return the first found file extension for the current format + */ + public function fileExtension(): FileExtension + { + $extensions = $this->fileExtensions(); + + return reset($extensions); + } + + /** + * Create an encoder instance with given options that matches the format + */ + public function encoder(mixed ...$options): EncoderInterface + { + // get classname of target encoder from current format + $classname = match ($this) { + self::AVIF => AvifEncoder::class, + self::BMP => BmpEncoder::class, + self::GIF => GifEncoder::class, + self::HEIC => HeicEncoder::class, + self::JP2 => Jpeg2000Encoder::class, + self::JPEG => JpegEncoder::class, + self::PNG => PngEncoder::class, + self::TIFF => TiffEncoder::class, + self::WEBP => WebpEncoder::class, + }; + + // get parameters of target encoder + $parameters = []; + $reflectionClass = new ReflectionClass($classname); + if ($constructor = $reflectionClass->getConstructor()) { + $parameters = array_map( + fn(ReflectionParameter $parameter): string => $parameter->getName(), + $constructor->getParameters(), + ); + } + + // filter out unavailable options of target encoder + $options = array_filter( + $options, + fn(mixed $key): bool => in_array($key, $parameters), + ARRAY_FILTER_USE_KEY, + ); + + return new $classname(...$options); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Geometry/Bezier.php b/upLoadImage/vendor/intervention/image/src/Geometry/Bezier.php new file mode 100644 index 0000000..27dbba1 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Geometry/Bezier.php @@ -0,0 +1,202 @@ + + * @implements ArrayAccess + */ +class Bezier implements IteratorAggregate, Countable, ArrayAccess, DrawableInterface +{ + use HasBorder; + use HasBackgroundColor; + + /** + * Create new bezier instance + * + * @param array $points + * @return void + */ + public function __construct( + protected array $points = [], + protected PointInterface $pivot = new Point() + ) { + // + } + + /** + * {@inheritdoc} + * + * @see DrawableInterface::position() + */ + public function position(): PointInterface + { + return $this->pivot; + } + + /** + * {@inheritdoc} + * + * @see DrawableInterface::setPosition() + */ + public function setPosition(PointInterface $position): DrawableInterface + { + $this->pivot = $position; + + return $this; + } + + /** + * Implement iteration through all points of bezier + * + * @return Traversable + */ + public function getIterator(): Traversable + { + return new ArrayIterator($this->points); + } + + /** + * Return current pivot point + */ + public function pivot(): PointInterface + { + return $this->pivot; + } + + /** + * Change pivot point to given point + */ + public function setPivot(PointInterface $pivot): self + { + $this->pivot = $pivot; + + return $this; + } + + /** + * Return first control point of bezier + */ + public function first(): ?PointInterface + { + if ($point = reset($this->points)) { + return $point; + } + + return null; + } + + /** + * Return second control point of bezier + */ + public function second(): ?PointInterface + { + if (array_key_exists(1, $this->points)) { + return $this->points[1]; + } + + return null; + } + + /** + * Return third control point of bezier + */ + public function third(): ?PointInterface + { + if (array_key_exists(2, $this->points)) { + return $this->points[2]; + } + + return null; + } + + /** + * Return last control point of bezier + */ + public function last(): ?PointInterface + { + if ($point = end($this->points)) { + return $point; + } + + return null; + } + + /** + * Return bezier's point count + */ + public function count(): int + { + return count($this->points); + } + + /** + * Determine if point exists at given offset + */ + public function offsetExists(mixed $offset): bool + { + return array_key_exists($offset, $this->points); + } + + /** + * Return point at given offset + */ + public function offsetGet(mixed $offset): mixed + { + return $this->points[$offset]; + } + + /** + * Set point at given offset + */ + public function offsetSet(mixed $offset, mixed $value): void + { + $this->points[$offset] = $value; + } + + /** + * Unset offset at given offset + */ + public function offsetUnset(mixed $offset): void + { + unset($this->points[$offset]); + } + + /** + * Add given point to bezier + */ + public function addPoint(PointInterface $point): self + { + $this->points[] = $point; + + return $this; + } + + /** + * Return array of all x/y values of all points of bezier + * + * @return array + */ + public function toArray(): array + { + $coordinates = []; + foreach ($this->points as $point) { + $coordinates[] = $point->x(); + $coordinates[] = $point->y(); + } + + return $coordinates; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Geometry/Circle.php b/upLoadImage/vendor/intervention/image/src/Geometry/Circle.php new file mode 100644 index 0000000..dc2e28b --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Geometry/Circle.php @@ -0,0 +1,57 @@ +setWidth($diameter); + $this->setHeight($diameter); + + return $this; + } + + /** + * Get diameter of circle + */ + public function diameter(): int + { + return $this->width(); + } + + /** + * Set radius of circle + */ + public function setRadius(int $radius): self + { + return $this->setDiameter(intval($radius * 2)); + } + + /** + * Get radius of circle + */ + public function radius(): int + { + return intval(round($this->diameter() / 2)); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Geometry/Ellipse.php b/upLoadImage/vendor/intervention/image/src/Geometry/Ellipse.php new file mode 100644 index 0000000..e27c9d8 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Geometry/Ellipse.php @@ -0,0 +1,103 @@ +pivot; + } + + /** + * {@inheritdoc} + * + * @see DrawableInterface::setPosition() + */ + public function setPosition(PointInterface $position): self + { + $this->pivot = $position; + + return $this; + } + + /** + * Return pivot point of Ellipse + */ + public function pivot(): PointInterface + { + return $this->pivot; + } + + /** + * Set size of Ellipse + */ + public function setSize(int $width, int $height): self + { + return $this->setWidth($width)->setHeight($height); + } + + /** + * Set width of Ellipse + */ + public function setWidth(int $width): self + { + $this->width = $width; + + return $this; + } + + /** + * Set height of Ellipse + */ + public function setHeight(int $height): self + { + $this->height = $height; + + return $this; + } + + /** + * Get width of Ellipse + */ + public function width(): int + { + return $this->width; + } + + /** + * Get height of Ellipse + */ + public function height(): int + { + return $this->height; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Geometry/Factories/BezierFactory.php b/upLoadImage/vendor/intervention/image/src/Geometry/Factories/BezierFactory.php new file mode 100644 index 0000000..2d8410b --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Geometry/Factories/BezierFactory.php @@ -0,0 +1,88 @@ +bezier = is_a($init, Bezier::class) ? $init : new Bezier([]); + + if (is_callable($init)) { + $init($this); + } + } + + /** + * {@inheritdoc} + * + * @see DrawableFactoryInterface::init() + */ + public static function init(null|Closure|DrawableInterface $init = null): self + { + return new self($init); + } + + /** + * {@inheritdoc} + * + * @see DrawableFactoryInterface::create() + */ + public function create(): DrawableInterface + { + return $this->bezier; + } + + /** + * Add a point to the bezier to be produced + */ + public function point(int $x, int $y): self + { + $this->bezier->addPoint(new Point($x, $y)); + + return $this; + } + + /** + * Set the background color of the bezier to be produced + */ + public function background(mixed $color): self + { + $this->bezier->setBackgroundColor($color); + + return $this; + } + + /** + * Set the border color & border size of the bezier to be produced + */ + public function border(mixed $color, int $size = 1): self + { + $this->bezier->setBorder($color, $size); + + return $this; + } + + /** + * Produce the bezier + */ + public function __invoke(): Bezier + { + return $this->bezier; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Geometry/Factories/CircleFactory.php b/upLoadImage/vendor/intervention/image/src/Geometry/Factories/CircleFactory.php new file mode 100644 index 0000000..f45b581 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Geometry/Factories/CircleFactory.php @@ -0,0 +1,102 @@ +circle = is_a($init, Circle::class) ? $init : new Circle(0); + $this->circle->setPosition($pivot); + + if (is_callable($init)) { + $init($this); + } + } + + /** + * {@inheritdoc} + * + * @see DrawableFactoryInterface::init() + */ + public static function init(null|Closure|DrawableInterface $init = null): self + { + return new self(init: $init); + } + + /** + * {@inheritdoc} + * + * @see DrawableFactoryInterface::create() + */ + public function create(): DrawableInterface + { + return $this->circle; + } + + /** + * Set the radius of the circle to be produced + */ + public function radius(int $radius): self + { + $this->circle->setSize($radius * 2, $radius * 2); + + return $this; + } + + /** + * Set the diameter of the circle to be produced + */ + public function diameter(int $diameter): self + { + $this->circle->setSize($diameter, $diameter); + + return $this; + } + + /** + * Set the background color of the circle to be produced + */ + public function background(mixed $color): self + { + $this->circle->setBackgroundColor($color); + + return $this; + } + + /** + * Set the border color & border size of the ellipse to be produced + */ + public function border(mixed $color, int $size = 1): self + { + $this->circle->setBorder($color, $size); + + return $this; + } + + /** + * Produce the circle + */ + public function __invoke(): Circle + { + return $this->circle; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Geometry/Factories/Drawable.php b/upLoadImage/vendor/intervention/image/src/Geometry/Factories/Drawable.php new file mode 100644 index 0000000..e7f14ba --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Geometry/Factories/Drawable.php @@ -0,0 +1,56 @@ +ellipse = is_a($init, Ellipse::class) ? $init : new Ellipse(0, 0); + $this->ellipse->setPosition($pivot); + + if (is_callable($init)) { + $init($this); + } + } + + /** + * {@inheritdoc} + * + * @see DrawableFactoryInterface::init() + */ + public static function init(null|Closure|DrawableInterface $init = null): self + { + return new self(init: $init); + } + + /** + * {@inheritdoc} + * + * @see DrawableFactoryInterface::create() + */ + public function create(): DrawableInterface + { + return $this->ellipse; + } + + /** + * Set the size of the ellipse to be produced + */ + public function size(int $width, int $height): self + { + $this->ellipse->setSize($width, $height); + + return $this; + } + + /** + * Set the width of the ellipse to be produced + */ + public function width(int $width): self + { + $this->ellipse->setWidth($width); + + return $this; + } + + /** + * Set the height of the ellipse to be produced + */ + public function height(int $height): self + { + $this->ellipse->setHeight($height); + + return $this; + } + + /** + * Set the background color of the ellipse to be produced + */ + public function background(mixed $color): self + { + $this->ellipse->setBackgroundColor($color); + + return $this; + } + + /** + * Set the border color & border size of the ellipse to be produced + */ + public function border(mixed $color, int $size = 1): self + { + $this->ellipse->setBorder($color, $size); + + return $this; + } + + /** + * Produce the ellipse + */ + public function __invoke(): Ellipse + { + return $this->ellipse; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Geometry/Factories/LineFactory.php b/upLoadImage/vendor/intervention/image/src/Geometry/Factories/LineFactory.php new file mode 100644 index 0000000..ce65433 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Geometry/Factories/LineFactory.php @@ -0,0 +1,122 @@ +line = is_a($init, Line::class) ? $init : new Line(new Point(), new Point()); + + if (is_callable($init)) { + $init($this); + } + } + + /** + * {@inheritdoc} + * + * @see DrawableFactoryInterface::init() + */ + public static function init(null|Closure|DrawableInterface $init = null): self + { + return new self($init); + } + + /** + * {@inheritdoc} + * + * @see DrawableFactoryInterface::create() + */ + public function create(): DrawableInterface + { + return $this->line; + } + + /** + * Set the color of the line to be produced + */ + public function color(mixed $color): self + { + $this->line->setBackgroundColor($color); + $this->line->setBorderColor($color); + + return $this; + } + + /** + * Set the (background) color of the line to be produced + */ + public function background(mixed $color): self + { + $this->line->setBackgroundColor($color); + $this->line->setBorderColor($color); + + return $this; + } + + /** + * Set the border size & border color of the line to be produced + */ + public function border(mixed $color, int $size = 1): self + { + $this->line->setBackgroundColor($color); + $this->line->setBorderColor($color); + $this->line->setWidth($size); + + return $this; + } + + /** + * Set the width of the line to be produced + */ + public function width(int $size): self + { + $this->line->setWidth($size); + + return $this; + } + + /** + * Set the coordinates of the starting point of the line to be produced + */ + public function from(int $x, int $y): self + { + $this->line->setStart(new Point($x, $y)); + + return $this; + } + + /** + * Set the coordinates of the end point of the line to be produced + */ + public function to(int $x, int $y): self + { + $this->line->setEnd(new Point($x, $y)); + + return $this; + } + + /** + * Produce the line + */ + public function __invoke(): Line + { + return $this->line; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Geometry/Factories/PolygonFactory.php b/upLoadImage/vendor/intervention/image/src/Geometry/Factories/PolygonFactory.php new file mode 100644 index 0000000..d065eb8 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Geometry/Factories/PolygonFactory.php @@ -0,0 +1,88 @@ +polygon = is_a($init, Polygon::class) ? $init : new Polygon([]); + + if (is_callable($init)) { + $init($this); + } + } + + /** + * {@inheritdoc} + * + * @see DrawableFactoryInterface::init() + */ + public static function init(null|Closure|DrawableInterface $init = null): self + { + return new self($init); + } + + /** + * {@inheritdoc} + * + * @see DrawableFactoryInterface::create() + */ + public function create(): DrawableInterface + { + return $this->polygon; + } + + /** + * Add a point to the polygon to be produced + */ + public function point(int $x, int $y): self + { + $this->polygon->addPoint(new Point($x, $y)); + + return $this; + } + + /** + * Set the background color of the polygon to be produced + */ + public function background(mixed $color): self + { + $this->polygon->setBackgroundColor($color); + + return $this; + } + + /** + * Set the border color & border size of the polygon to be produced + */ + public function border(mixed $color, int $size = 1): self + { + $this->polygon->setBorder($color, $size); + + return $this; + } + + /** + * Produce the polygon + */ + public function __invoke(): Polygon + { + return $this->polygon; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Geometry/Factories/RectangleFactory.php b/upLoadImage/vendor/intervention/image/src/Geometry/Factories/RectangleFactory.php new file mode 100644 index 0000000..34732f2 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Geometry/Factories/RectangleFactory.php @@ -0,0 +1,112 @@ +rectangle = is_a($init, Rectangle::class) ? $init : new Rectangle(0, 0, $pivot); + $this->rectangle->setPosition($pivot); + + if (is_callable($init)) { + $init($this); + } + } + + /** + * {@inheritdoc} + * + * @see DrawableFactoryInterface::init() + */ + public static function init(null|Closure|DrawableInterface $init = null): self + { + return new self(init: $init); + } + + /** + * {@inheritdoc} + * + * @see DrawableFactoryInterface::create() + */ + public function create(): DrawableInterface + { + return $this->rectangle; + } + + /** + * Set the size of the rectangle to be produced + */ + public function size(int $width, int $height): self + { + $this->rectangle->setSize($width, $height); + + return $this; + } + + /** + * Set the width of the rectangle to be produced + */ + public function width(int $width): self + { + $this->rectangle->setWidth($width); + + return $this; + } + + /** + * Set the height of the rectangle to be produced + */ + public function height(int $height): self + { + $this->rectangle->setHeight($height); + + return $this; + } + + /** + * Set the background color of the rectangle to be produced + */ + public function background(mixed $color): self + { + $this->rectangle->setBackgroundColor($color); + + return $this; + } + + /** + * Set the border color & border size of the rectangle to be produced + */ + public function border(mixed $color, int $size = 1): self + { + $this->rectangle->setBorder($color, $size); + + return $this; + } + + /** + * Produce the rectangle + */ + public function __invoke(): Rectangle + { + return $this->rectangle; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Geometry/Line.php b/upLoadImage/vendor/intervention/image/src/Geometry/Line.php new file mode 100644 index 0000000..14dd062 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Geometry/Line.php @@ -0,0 +1,127 @@ +start; + } + + /** + * {@inheritdoc} + * + * @see DrawableInterface::setPosition() + */ + public function setPosition(PointInterface $position): DrawableInterface + { + $this->start = $position; + + return $this; + } + + /** + * Return line width + */ + public function width(): int + { + return $this->width; + } + + /** + * Set line width + */ + public function setWidth(int $width): self + { + $this->width = $width; + + return $this; + } + + /** + * Get starting point of line + */ + public function start(): PointInterface + { + return $this->start; + } + + /** + * get end point of line + */ + public function end(): PointInterface + { + return $this->end; + } + + /** + * Set starting point of line + */ + public function setStart(PointInterface $start): self + { + $this->start = $start; + + return $this; + } + + /** + * Set starting point of line by coordinates + */ + public function from(int $x, int $y): self + { + $this->start()->setX($x); + $this->start()->setY($y); + + return $this; + } + + /** + * Set end point of line by coordinates + */ + public function to(int $x, int $y): self + { + $this->end()->setX($x); + $this->end()->setY($y); + + return $this; + } + + /** + * Set end point of line + */ + public function setEnd(PointInterface $end): self + { + $this->end = $end; + + return $this; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Geometry/Pixel.php b/upLoadImage/vendor/intervention/image/src/Geometry/Pixel.php new file mode 100644 index 0000000..dc5c580 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Geometry/Pixel.php @@ -0,0 +1,45 @@ +background = $background; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see DrawableInterface::backgroundColor() + */ + public function backgroundColor(): ColorInterface + { + return $this->background; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Geometry/Point.php b/upLoadImage/vendor/intervention/image/src/Geometry/Point.php new file mode 100644 index 0000000..f23cd56 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Geometry/Point.php @@ -0,0 +1,145 @@ + + */ +class Point implements PointInterface, IteratorAggregate +{ + /** + * Create new point instance + * + * @return void + */ + public function __construct( + protected int $x = 0, + protected int $y = 0 + ) { + // + } + + /** + * {@inheritdoc} + * + * @see IteratorAggregate::getIterator() + */ + public function getIterator(): Traversable + { + return new ArrayIterator([$this->x, $this->y]); + } + + /** + * {@inheritdoc} + * + * @see PointInterface::setX() + */ + public function setX(int $x): self + { + $this->x = $x; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see PointInterface::x() + */ + public function x(): int + { + return $this->x; + } + + /** + * {@inheritdoc} + * + * @see PointInterface::setY() + */ + public function setY(int $y): self + { + $this->y = $y; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see PointInterface::y() + */ + public function y(): int + { + return $this->y; + } + + /** + * {@inheritdoc} + * + * @see PointInterface::moveX() + */ + public function moveX(int $value): self + { + $this->x += $value; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see PointInterface::moveY() + */ + public function moveY(int $value): self + { + $this->y += $value; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see PointInterface::move() + */ + public function move(int $x, int $y): self + { + return $this->moveX($x)->moveY($y); + } + + /** + * {@inheritdoc} + * + * @see PointInterface::setPosition() + */ + public function setPosition(int $x, int $y): self + { + $this->setX($x); + $this->setY($y); + + return $this; + } + + /** + * {@inheritdoc} + * + * @see PointInterface::rotate() + */ + public function rotate(float $angle, PointInterface $pivot): self + { + $sin = round(sin(deg2rad($angle)), 6); + $cos = round(cos(deg2rad($angle)), 6); + + return $this->setPosition( + intval($cos * ($this->x() - $pivot->x()) - $sin * ($this->y() - $pivot->y()) + $pivot->x()), + intval($sin * ($this->x() - $pivot->x()) + $cos * ($this->y() - $pivot->y()) + $pivot->y()) + ); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Geometry/Polygon.php b/upLoadImage/vendor/intervention/image/src/Geometry/Polygon.php new file mode 100644 index 0000000..c416d39 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Geometry/Polygon.php @@ -0,0 +1,390 @@ + + * @implements ArrayAccess + */ +class Polygon implements IteratorAggregate, Countable, ArrayAccess, DrawableInterface +{ + use HasBorder; + use HasBackgroundColor; + + /** + * Create new polygon instance + * + * @param array $points + * @return void + */ + public function __construct( + protected array $points = [], + protected PointInterface $pivot = new Point() + ) { + // + } + + /** + * {@inheritdoc} + * + * @see DrawableInterface::position() + */ + public function position(): PointInterface + { + return $this->pivot; + } + + /** + * {@inheritdoc} + * + * @see DrawableInterface::setPosition() + */ + public function setPosition(PointInterface $position): self + { + $this->pivot = $position; + + return $this; + } + + /** + * Implement iteration through all points of polygon + * + * @return Traversable + */ + public function getIterator(): Traversable + { + return new ArrayIterator($this->points); + } + + /** + * Return current pivot point + */ + public function pivot(): PointInterface + { + return $this->pivot; + } + + /** + * Change pivot point to given point + */ + public function setPivot(PointInterface $pivot): self + { + $this->pivot = $pivot; + + return $this; + } + + /** + * Return first point of polygon + */ + public function first(): ?PointInterface + { + if ($point = reset($this->points)) { + return $point; + } + + return null; + } + + /** + * Return last point of polygon + */ + public function last(): ?PointInterface + { + if ($point = end($this->points)) { + return $point; + } + + return null; + } + + /** + * Return polygon's point count + */ + public function count(): int + { + return count($this->points); + } + + /** + * Determine if point exists at given offset + */ + public function offsetExists(mixed $offset): bool + { + return array_key_exists($offset, $this->points); + } + + /** + * Return point at given offset + */ + public function offsetGet(mixed $offset): mixed + { + return $this->points[$offset]; + } + + /** + * Set point at given offset + */ + public function offsetSet(mixed $offset, mixed $value): void + { + $this->points[$offset] = $value; + } + + /** + * Unset offset at given offset + */ + public function offsetUnset(mixed $offset): void + { + unset($this->points[$offset]); + } + + /** + * Add given point to polygon + */ + public function addPoint(PointInterface $point): self + { + $this->points[] = $point; + + return $this; + } + + /** + * Calculate total horizontal span of polygon + */ + public function width(): int + { + return abs($this->mostLeftPoint()->x() - $this->mostRightPoint()->x()); + } + + /** + * Calculate total vertical span of polygon + */ + public function height(): int + { + return abs($this->mostBottomPoint()->y() - $this->mostTopPoint()->y()); + } + + /** + * Return most left point of all points in polygon + */ + public function mostLeftPoint(): PointInterface + { + $points = $this->points; + + usort($points, function (PointInterface $a, PointInterface $b): int { + if ($a->x() === $b->x()) { + return 0; + } + return $a->x() < $b->x() ? -1 : 1; + }); + + return $points[0]; + } + + /** + * Return most right point in polygon + */ + public function mostRightPoint(): PointInterface + { + $points = $this->points; + + usort($points, function (PointInterface $a, PointInterface $b): int { + if ($a->x() === $b->x()) { + return 0; + } + return $a->x() > $b->x() ? -1 : 1; + }); + + return $points[0]; + } + + /** + * Return most top point in polygon + */ + public function mostTopPoint(): PointInterface + { + $points = $this->points; + + usort($points, function (PointInterface $a, PointInterface $b): int { + if ($a->y() === $b->y()) { + return 0; + } + return $a->y() > $b->y() ? -1 : 1; + }); + + return $points[0]; + } + + /** + * Return most bottom point in polygon + */ + public function mostBottomPoint(): PointInterface + { + $points = $this->points; + + usort($points, function (PointInterface $a, PointInterface $b): int { + if ($a->y() === $b->y()) { + return 0; + } + return $a->y() < $b->y() ? -1 : 1; + }); + + return $points[0]; + } + + /** + * Return point in absolute center of the polygon + */ + public function centerPoint(): PointInterface + { + return new Point( + $this->mostRightPoint()->x() - (intval(round($this->width() / 2))), + $this->mostTopPoint()->y() - (intval(round($this->height() / 2))) + ); + } + + /** + * Align all points of polygon horizontally to given position around pivot point + */ + public function align(string $position): self + { + switch (strtolower($position)) { + case 'center': + case 'middle': + $diff = $this->centerPoint()->x() - $this->pivot()->x(); + break; + + case 'right': + $diff = $this->mostRightPoint()->x() - $this->pivot()->x(); + break; + + default: + case 'left': + $diff = $this->mostLeftPoint()->x() - $this->pivot()->x(); + break; + } + + foreach ($this->points as $point) { + $point->setX( + intval($point->x() - $diff) + ); + } + + return $this; + } + + /** + * Align all points of polygon vertically to given position around pivot point + */ + public function valign(string $position): self + { + switch (strtolower($position)) { + case 'center': + case 'middle': + $diff = $this->centerPoint()->y() - $this->pivot()->y(); + break; + + case 'top': + $diff = $this->mostTopPoint()->y() - $this->pivot()->y() - $this->height(); + break; + + default: + case 'bottom': + $diff = $this->mostBottomPoint()->y() - $this->pivot()->y() + $this->height(); + break; + } + + foreach ($this->points as $point) { + $point->setY( + intval($point->y() - $diff), + ); + } + + return $this; + } + + /** + * Rotate points of polygon around pivot point with given angle + */ + public function rotate(float $angle): self + { + $sin = sin(deg2rad($angle)); + $cos = cos(deg2rad($angle)); + + foreach ($this->points as $point) { + // translate point to pivot + $point->setX( + intval($point->x() - $this->pivot()->x()), + ); + $point->setY( + intval($point->y() - $this->pivot()->y()), + ); + + // rotate point + $x = $point->x() * $cos - $point->y() * $sin; + $y = $point->x() * $sin + $point->y() * $cos; + + // translate point back + $point->setX( + intval($x + $this->pivot()->x()), + ); + $point->setY( + intval($y + $this->pivot()->y()), + ); + } + + return $this; + } + + /** + * Move all points by given amount on the x-axis + */ + public function movePointsX(int $amount): self + { + foreach ($this->points as $point) { + $point->moveX($amount); + } + + return $this; + } + + /** + * Move all points by given amount on the y-axis + */ + public function movePointsY(int $amount): self + { + foreach ($this->points as $point) { + $point->moveY($amount); + } + + return $this; + } + + /** + * Return array of all x/y values of all points of polygon + * + * @return array + */ + public function toArray(): array + { + $coordinates = []; + foreach ($this->points as $point) { + $coordinates[] = $point->x(); + $coordinates[] = $point->y(); + } + + return $coordinates; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Geometry/Rectangle.php b/upLoadImage/vendor/intervention/image/src/Geometry/Rectangle.php new file mode 100644 index 0000000..01e57f9 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Geometry/Rectangle.php @@ -0,0 +1,335 @@ +addPoint(new Point($this->pivot->x(), $this->pivot->y())); + $this->addPoint(new Point($this->pivot->x() + $width, $this->pivot->y())); + $this->addPoint(new Point($this->pivot->x() + $width, $this->pivot->y() - $height)); + $this->addPoint(new Point($this->pivot->x(), $this->pivot->y() - $height)); + } + + /** + * Set size of rectangle + */ + public function setSize(int $width, int $height): self + { + return $this->setWidth($width)->setHeight($height); + } + + /** + * Set width of rectangle + */ + public function setWidth(int $width): self + { + $this[1]->setX($this[0]->x() + $width); + $this[2]->setX($this[3]->x() + $width); + + return $this; + } + + /** + * Set height of rectangle + */ + public function setHeight(int $height): self + { + $this[2]->setY($this[1]->y() + $height); + $this[3]->setY($this[0]->y() + $height); + + return $this; + } + + /** + * Return pivot point of rectangle + */ + public function pivot(): PointInterface + { + return $this->pivot; + } + + /** + * Set pivot point of rectangle + */ + public function setPivot(PointInterface $pivot): self + { + $this->pivot = $pivot; + + return $this; + } + + /** + * Move pivot to the given position in the rectangle and adjust the new + * position by given offset values. + */ + public function movePivot(string $position, int $offset_x = 0, int $offset_y = 0): self + { + switch (strtolower($position)) { + case 'top': + case 'top-center': + case 'top-middle': + case 'center-top': + case 'middle-top': + $x = intval(round($this->width() / 2)) + $offset_x; + $y = $offset_y; + break; + + case 'top-right': + case 'right-top': + $x = $this->width() - $offset_x; + $y = $offset_y; + break; + + case 'left': + case 'left-center': + case 'left-middle': + case 'center-left': + case 'middle-left': + $x = $offset_x; + $y = intval(round($this->height() / 2)) + $offset_y; + break; + + case 'right': + case 'right-center': + case 'right-middle': + case 'center-right': + case 'middle-right': + $x = $this->width() - $offset_x; + $y = intval(round($this->height() / 2)) + $offset_y; + break; + + case 'bottom-left': + case 'left-bottom': + $x = $offset_x; + $y = $this->height() - $offset_y; + break; + + case 'bottom': + case 'bottom-center': + case 'bottom-middle': + case 'center-bottom': + case 'middle-bottom': + $x = intval(round($this->width() / 2)) + $offset_x; + $y = $this->height() - $offset_y; + break; + + case 'bottom-right': + case 'right-bottom': + $x = $this->width() - $offset_x; + $y = $this->height() - $offset_y; + break; + + case 'center': + case 'middle': + case 'center-center': + case 'middle-middle': + $x = intval(round($this->width() / 2)) + $offset_x; + $y = intval(round($this->height() / 2)) + $offset_y; + break; + + default: + case 'top-left': + case 'left-top': + $x = $offset_x; + $y = $offset_y; + break; + } + + $this->pivot->setPosition($x, $y); + + return $this; + } + + /** + * Align pivot relative to given size at given position + */ + public function alignPivotTo(SizeInterface $size, string $position): self + { + $reference = new self($size->width(), $size->height()); + $reference->movePivot($position); + + $this->movePivot($position)->setPivot( + $reference->relativePositionTo($this) + ); + + return $this; + } + + /** + * Return relative position to given rectangle + */ + public function relativePositionTo(SizeInterface $rectangle): PointInterface + { + return new Point( + $this->pivot()->x() - $rectangle->pivot()->x(), + $this->pivot()->y() - $rectangle->pivot()->y() + ); + } + + /** + * Return aspect ration of rectangle + */ + public function aspectRatio(): float + { + return $this->width() / $this->height(); + } + + /** + * Determine if rectangle fits into given rectangle + */ + public function fitsInto(SizeInterface $size): bool + { + if ($this->width() > $size->width()) { + return false; + } + + if ($this->height() > $size->height()) { + return false; + } + + return true; + } + + /** + * Determine if rectangle has landscape format + */ + public function isLandscape(): bool + { + return $this->width() > $this->height(); + } + + /** + * Determine if rectangle has landscape format + */ + public function isPortrait(): bool + { + return $this->width() < $this->height(); + } + + /** + * Return most top left point of rectangle + */ + public function topLeftPoint(): PointInterface + { + return $this->points[0]; + } + + /** + * Return bottom right point of rectangle + */ + public function bottomRightPoint(): PointInterface + { + return $this->points[2]; + } + + /** + * @see SizeInterface::resize() + * + * @throws GeometryException + */ + public function resize(?int $width = null, ?int $height = null): SizeInterface + { + return $this->resizer($width, $height)->resize($this); + } + + /** + * @see SizeInterface::resizeDown() + * + * @throws GeometryException + */ + public function resizeDown(?int $width = null, ?int $height = null): SizeInterface + { + return $this->resizer($width, $height)->resizeDown($this); + } + + /** + * @see SizeInterface::scale() + * + * @throws GeometryException + */ + public function scale(?int $width = null, ?int $height = null): SizeInterface + { + return $this->resizer($width, $height)->scale($this); + } + + /** + * @see SizeInterface::scaleDown() + * + * @throws GeometryException + */ + public function scaleDown(?int $width = null, ?int $height = null): SizeInterface + { + return $this->resizer($width, $height)->scaleDown($this); + } + + /** + * @see SizeInterface::cover() + * + * @throws GeometryException + */ + public function cover(int $width, int $height): SizeInterface + { + return $this->resizer($width, $height)->cover($this); + } + + /** + * @see SizeInterface::contain() + * + * @throws GeometryException + */ + public function contain(int $width, int $height): SizeInterface + { + return $this->resizer($width, $height)->contain($this); + } + + /** + * @see SizeInterface::containMax() + * + * @throws GeometryException + */ + public function containMax(int $width, int $height): SizeInterface + { + return $this->resizer($width, $height)->containDown($this); + } + + /** + * Create resizer instance with given target size + * + * @throws GeometryException + */ + protected function resizer(?int $width = null, ?int $height = null): RectangleResizer + { + return new RectangleResizer($width, $height); + } + + /** + * Show debug info for the current rectangle + * + * @return array + */ + public function __debugInfo(): array + { + return [ + 'width' => $this->width(), + 'height' => $this->height(), + 'pivot' => $this->pivot, + ]; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Geometry/Tools/RectangleResizer.php b/upLoadImage/vendor/intervention/image/src/Geometry/Tools/RectangleResizer.php new file mode 100644 index 0000000..7136b36 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Geometry/Tools/RectangleResizer.php @@ -0,0 +1,341 @@ +width); + } + + /** + * Return target width of resizer if available + */ + protected function getTargetWidth(): ?int + { + return $this->hasTargetWidth() ? $this->width : null; + } + + /** + * Determine if resize has target height + */ + protected function hasTargetHeight(): bool + { + return is_int($this->height); + } + + /** + * Return target width of resizer if available + */ + protected function getTargetHeight(): ?int + { + return $this->hasTargetHeight() ? $this->height : null; + } + + /** + * Return target size object + * + * @throws GeometryException + */ + protected function getTargetSize(): SizeInterface + { + if (!$this->hasTargetWidth() || !$this->hasTargetHeight()) { + throw new GeometryException('Target size needs width and height.'); + } + + return new Rectangle($this->width, $this->height); + } + + /** + * Set target width of resizer + */ + public function toWidth(int $width): self + { + $this->width = $width; + + return $this; + } + + /** + * Set target height of resizer + */ + public function toHeight(int $height): self + { + $this->height = $height; + + return $this; + } + + /** + * Set target size to given size object + */ + public function toSize(SizeInterface $size): self + { + $this->width = $size->width(); + $this->height = $size->height(); + + return $this; + } + + /** + * Get proportinal width + */ + protected function getProportionalWidth(SizeInterface $size): int + { + if (!$this->hasTargetHeight()) { + return $size->width(); + } + + return max([1, (int) round($this->height * $size->aspectRatio())]); + } + + /** + * Get proportinal height + */ + protected function getProportionalHeight(SizeInterface $size): int + { + if (!$this->hasTargetWidth()) { + return $size->height(); + } + + return max([1, (int) round($this->width / $size->aspectRatio())]); + } + + /** + * Resize given size to target size of the resizer + */ + public function resize(SizeInterface $size): SizeInterface + { + $resized = new Rectangle($size->width(), $size->height()); + + if ($width = $this->getTargetWidth()) { + $resized->setWidth($width); + } + + if ($height = $this->getTargetHeight()) { + $resized->setHeight($height); + } + + return $resized; + } + + /** + * Resize given size to target size of the resizer but do not exceed original size + */ + public function resizeDown(SizeInterface $size): SizeInterface + { + $resized = new Rectangle($size->width(), $size->height()); + + if ($width = $this->getTargetWidth()) { + $resized->setWidth( + min($width, $size->width()) + ); + } + + if ($height = $this->getTargetHeight()) { + $resized->setHeight( + min($height, $size->height()) + ); + } + + return $resized; + } + + /** + * Resize given size to target size proportinally + */ + public function scale(SizeInterface $size): SizeInterface + { + $resized = new Rectangle($size->width(), $size->height()); + + if ($this->hasTargetWidth() && $this->hasTargetHeight()) { + $resized->setWidth(min( + $this->getProportionalWidth($size), + $this->getTargetWidth() + )); + $resized->setHeight(min( + $this->getProportionalHeight($size), + $this->getTargetHeight() + )); + } elseif ($this->hasTargetWidth()) { + $resized->setWidth($this->getTargetWidth()); + $resized->setHeight($this->getProportionalHeight($size)); + } elseif ($this->hasTargetHeight()) { + $resized->setWidth($this->getProportionalWidth($size)); + $resized->setHeight($this->getTargetHeight()); + } + + return $resized; + } + + /** + * Resize given size to target size proportinally but do not exceed original size + */ + public function scaleDown(SizeInterface $size): SizeInterface + { + $resized = new Rectangle($size->width(), $size->height()); + + if ($this->hasTargetWidth() && $this->hasTargetHeight()) { + $resized->setWidth(min( + $this->getProportionalWidth($size), + $this->getTargetWidth(), + $size->width() + )); + $resized->setHeight(min( + $this->getProportionalHeight($size), + $this->getTargetHeight(), + $size->height() + )); + } elseif ($this->hasTargetWidth()) { + $resized->setWidth(min( + $this->getTargetWidth(), + $size->width() + )); + $resized->setHeight(min( + $this->getProportionalHeight($size), + $size->height() + )); + } elseif ($this->hasTargetHeight()) { + $resized->setWidth(min( + $this->getProportionalWidth($size), + $size->width() + )); + $resized->setHeight(min( + $this->getTargetHeight(), + $size->height() + )); + } + + return $resized; + } + + /** + * Scale given size to cover target size + * + * @param SizeInterface $size Size to be resized + * @throws GeometryException + */ + public function cover(SizeInterface $size): SizeInterface + { + $resized = new Rectangle($size->width(), $size->height()); + + // auto height + $resized->setWidth($this->getTargetWidth()); + $resized->setHeight($this->getProportionalHeight($size)); + + if ($resized->fitsInto($this->getTargetSize())) { + // auto width + $resized->setWidth($this->getProportionalWidth($size)); + $resized->setHeight($this->getTargetHeight()); + } + + return $resized; + } + + /** + * Scale given size to contain target size + * + * @param SizeInterface $size Size to be resized + * @throws GeometryException + */ + public function contain(SizeInterface $size): SizeInterface + { + $resized = new Rectangle($size->width(), $size->height()); + + // auto height + $resized->setWidth($this->getTargetWidth()); + $resized->setHeight($this->getProportionalHeight($size)); + + if (!$resized->fitsInto($this->getTargetSize())) { + // auto width + $resized->setWidth($this->getProportionalWidth($size)); + $resized->setHeight($this->getTargetHeight()); + } + + return $resized; + } + + /** + * Scale given size to contain target size but prevent upsizing + * + * @param SizeInterface $size Size to be resized + * @throws GeometryException + */ + public function containDown(SizeInterface $size): SizeInterface + { + $resized = new Rectangle($size->width(), $size->height()); + + // auto height + $resized->setWidth( + min($size->width(), $this->getTargetWidth()) + ); + + $resized->setHeight( + min($size->height(), $this->getProportionalHeight($size)) + ); + + if (!$resized->fitsInto($this->getTargetSize())) { + // auto width + $resized->setWidth( + min($size->width(), $this->getProportionalWidth($size)) + ); + $resized->setHeight( + min($size->height(), $this->getTargetHeight()) + ); + } + + return $resized; + } + + /** + * Crop target size out of given size at given position (i.e. move the pivot point) + */ + public function crop(SizeInterface $size, string $position = 'top-left'): SizeInterface + { + return $this->resize($size)->alignPivotTo( + $size->movePivot($position), + $position + ); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Geometry/Traits/HasBackgroundColor.php b/upLoadImage/vendor/intervention/image/src/Geometry/Traits/HasBackgroundColor.php new file mode 100644 index 0000000..a18c8b4 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Geometry/Traits/HasBackgroundColor.php @@ -0,0 +1,42 @@ +backgroundColor = $color; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see DrawableInterface::backgroundColor() + */ + public function backgroundColor(): mixed + { + return $this->backgroundColor; + } + + /** + * {@inheritdoc} + * + * @see DrawableInterface::hasBackgroundColor() + */ + public function hasBackgroundColor(): bool + { + return !empty($this->backgroundColor); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Geometry/Traits/HasBorder.php b/upLoadImage/vendor/intervention/image/src/Geometry/Traits/HasBorder.php new file mode 100644 index 0000000..57ff83a --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Geometry/Traits/HasBorder.php @@ -0,0 +1,75 @@ +setBorderSize($size)->setBorderColor($color); + } + + /** + * {@inheritdoc} + * + * @see DrawableInterface::setBorderSize() + */ + public function setBorderSize(int $size): self + { + $this->borderSize = $size; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see DrawableInterface::borderSize() + */ + public function borderSize(): int + { + return $this->borderSize; + } + + /** + * {@inheritdoc} + * + * @see DrawableInterface::setBorderColor() + */ + public function setBorderColor(mixed $color): self + { + $this->borderColor = $color; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see DrawableInterface::borderColor() + */ + public function borderColor(): mixed + { + return $this->borderColor; + } + + /** + * {@inheritdoc} + * + * @see DrawableInterface::hasBorder() + */ + public function hasBorder(): bool + { + return $this->borderSize > 0 && !is_null($this->borderColor); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Image.php b/upLoadImage/vendor/intervention/image/src/Image.php new file mode 100644 index 0000000..738d0fe --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Image.php @@ -0,0 +1,1082 @@ +origin = new Origin(); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::driver() + */ + public function driver(): DriverInterface + { + return $this->driver; + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::core() + */ + public function core(): CoreInterface + { + return $this->core; + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::origin() + */ + public function origin(): Origin + { + return $this->origin; + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::setOrigin() + */ + public function setOrigin(Origin $origin): ImageInterface + { + $this->origin = $origin; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::count() + */ + public function count(): int + { + return $this->core->count(); + } + + /** + * Implementation of IteratorAggregate + * + * @return Traversable + */ + public function getIterator(): Traversable + { + return $this->core; + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::isAnimated() + */ + public function isAnimated(): bool + { + return $this->count() > 1; + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::removeAnimation( + */ + public function removeAnimation(int|string $position = 0): ImageInterface + { + return $this->modify(new RemoveAnimationModifier($position)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::sliceAnimation() + */ + public function sliceAnimation(int $offset = 0, ?int $length = null): ImageInterface + { + return $this->modify(new SliceAnimationModifier($offset, $length)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::loops() + */ + public function loops(): int + { + return $this->core->loops(); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::setLoops() + */ + public function setLoops(int $loops): ImageInterface + { + $this->core->setLoops($loops); + + return $this; + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::exif() + */ + public function exif(?string $query = null): mixed + { + return is_null($query) ? $this->exif : $this->exif->get($query); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::setExif() + */ + public function setExif(CollectionInterface $exif): ImageInterface + { + $this->exif = $exif; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::modify() + */ + public function modify(ModifierInterface $modifier): ImageInterface + { + return $this->driver->specialize($modifier)->apply($this); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::analyze() + */ + public function analyze(AnalyzerInterface $analyzer): mixed + { + return $this->driver->specialize($analyzer)->analyze($this); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::encode() + */ + public function encode(EncoderInterface $encoder = new AutoEncoder()): EncodedImageInterface + { + return $this->driver->specialize($encoder)->encode($this); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::save() + */ + public function save(?string $path = null, mixed ...$options): ImageInterface + { + $path = is_null($path) ? $this->origin()->filePath() : $path; + + if (is_null($path)) { + throw new EncoderException('Could not determine file path to save.'); + } + + try { + // try to determine encoding format by file extension of the path + $encoded = $this->encodeByPath($path, ...$options); + } catch (EncoderException) { + // fallback to encoding format by media type + $encoded = $this->encodeByMediaType(null, ...$options); + } + + $encoded->save($path); + + return $this; + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::width() + */ + public function width(): int + { + return $this->analyze(new WidthAnalyzer()); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::height() + */ + public function height(): int + { + return $this->analyze(new HeightAnalyzer()); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::size() + */ + public function size(): SizeInterface + { + return new Rectangle($this->width(), $this->height()); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::colorspace() + */ + public function colorspace(): ColorspaceInterface + { + return $this->analyze(new ColorspaceAnalyzer()); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::setColorspace() + */ + public function setColorspace(string|ColorspaceInterface $colorspace): ImageInterface + { + return $this->modify(new ColorspaceModifier($colorspace)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::resolution() + */ + public function resolution(): ResolutionInterface + { + return $this->analyze(new ResolutionAnalyzer()); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::setResolution() + */ + public function setResolution(float $x, float $y): ImageInterface + { + return $this->modify(new ResolutionModifier($x, $y)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::pickColor() + */ + public function pickColor(int $x, int $y, int $frame_key = 0): ColorInterface + { + return $this->analyze(new PixelColorAnalyzer($x, $y, $frame_key)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::pickColors() + */ + public function pickColors(int $x, int $y): CollectionInterface + { + return $this->analyze(new PixelColorsAnalyzer($x, $y)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::blendingColor() + */ + public function blendingColor(): ColorInterface + { + return $this->driver()->handleInput( + $this->driver()->config()->blendingColor + ); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::setBlendingColor() + */ + public function setBlendingColor(mixed $color): ImageInterface + { + $this->driver()->config()->setOptions( + blendingColor: $this->driver()->handleInput($color) + ); + + return $this; + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::blendTransparency() + */ + public function blendTransparency(mixed $color = null): ImageInterface + { + return $this->modify(new BlendTransparencyModifier($color)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::profile() + */ + public function profile(): ProfileInterface + { + return $this->analyze(new ProfileAnalyzer()); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::setProfile() + */ + public function setProfile(ProfileInterface $profile): ImageInterface + { + return $this->modify(new ProfileModifier($profile)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::removeProfile() + */ + public function removeProfile(): ImageInterface + { + return $this->modify(new ProfileRemovalModifier()); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::reduceColors() + */ + public function reduceColors(int $limit, mixed $background = 'transparent'): ImageInterface + { + return $this->modify(new QuantizeColorsModifier($limit, $background)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::sharpen() + */ + public function sharpen(int $amount = 10): ImageInterface + { + return $this->modify(new SharpenModifier($amount)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::invert() + */ + public function invert(): ImageInterface + { + return $this->modify(new InvertModifier()); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::pixelate() + */ + public function pixelate(int $size): ImageInterface + { + return $this->modify(new PixelateModifier($size)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::greyscale() + */ + public function greyscale(): ImageInterface + { + return $this->modify(new GreyscaleModifier()); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::brightness() + */ + public function brightness(int $level): ImageInterface + { + return $this->modify(new BrightnessModifier($level)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::contrast() + */ + public function contrast(int $level): ImageInterface + { + return $this->modify(new ContrastModifier($level)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::gamma() + */ + public function gamma(float $gamma): ImageInterface + { + return $this->modify(new GammaModifier($gamma)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::colorize() + */ + public function colorize(int $red = 0, int $green = 0, int $blue = 0): ImageInterface + { + return $this->modify(new ColorizeModifier($red, $green, $blue)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::flip() + */ + public function flip(): ImageInterface + { + return $this->modify(new FlipModifier()); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::flop() + */ + public function flop(): ImageInterface + { + return $this->modify(new FlopModifier()); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::blur() + */ + public function blur(int $amount = 5): ImageInterface + { + return $this->modify(new BlurModifier($amount)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::rotate() + */ + public function rotate(float $angle, mixed $background = 'ffffff'): ImageInterface + { + return $this->modify(new RotateModifier($angle, $background)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::orient() + */ + public function orient(): ImageInterface + { + return $this->modify(new AlignRotationModifier()); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::text() + */ + public function text(string $text, int $x, int $y, callable|Closure|FontInterface $font): ImageInterface + { + return $this->modify( + new TextModifier( + $text, + new Point($x, $y), + call_user_func(new FontFactory($font)), + ), + ); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::resize() + */ + public function resize(?int $width = null, ?int $height = null): ImageInterface + { + return $this->modify(new ResizeModifier($width, $height)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::resizeDown() + */ + public function resizeDown(?int $width = null, ?int $height = null): ImageInterface + { + return $this->modify(new ResizeDownModifier($width, $height)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::scale() + */ + public function scale(?int $width = null, ?int $height = null): ImageInterface + { + return $this->modify(new ScaleModifier($width, $height)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::scaleDown() + */ + public function scaleDown(?int $width = null, ?int $height = null): ImageInterface + { + return $this->modify(new ScaleDownModifier($width, $height)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::cover() + */ + public function cover(int $width, int $height, string $position = 'center'): ImageInterface + { + return $this->modify(new CoverModifier($width, $height, $position)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::coverDown() + */ + public function coverDown(int $width, int $height, string $position = 'center'): ImageInterface + { + return $this->modify(new CoverDownModifier($width, $height, $position)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::resizeCanvas() + */ + public function resizeCanvas( + ?int $width = null, + ?int $height = null, + mixed $background = 'ffffff', + string $position = 'center' + ): ImageInterface { + return $this->modify(new ResizeCanvasModifier($width, $height, $background, $position)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::resizeCanvasRelative() + */ + public function resizeCanvasRelative( + ?int $width = null, + ?int $height = null, + mixed $background = 'ffffff', + string $position = 'center' + ): ImageInterface { + return $this->modify(new ResizeCanvasRelativeModifier($width, $height, $background, $position)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::padDown() + */ + public function pad( + int $width, + int $height, + mixed $background = 'ffffff', + string $position = 'center' + ): ImageInterface { + return $this->modify(new PadModifier($width, $height, $background, $position)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::pad() + */ + public function contain( + int $width, + int $height, + mixed $background = 'ffffff', + string $position = 'center' + ): ImageInterface { + return $this->modify(new ContainModifier($width, $height, $background, $position)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::crop() + */ + public function crop( + int $width, + int $height, + int $offset_x = 0, + int $offset_y = 0, + mixed $background = 'ffffff', + string $position = 'top-left' + ): ImageInterface { + return $this->modify(new CropModifier($width, $height, $offset_x, $offset_y, $background, $position)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::trim() + */ + public function trim(int $tolerance = 0): ImageInterface + { + return $this->modify(new TrimModifier($tolerance)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::place() + */ + public function place( + mixed $element, + string $position = 'top-left', + int $offset_x = 0, + int $offset_y = 0, + int $opacity = 100 + ): ImageInterface { + return $this->modify(new PlaceModifier($element, $position, $offset_x, $offset_y, $opacity)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::fill() + */ + public function fill(mixed $color, ?int $x = null, ?int $y = null): ImageInterface + { + return $this->modify( + new FillModifier( + $color, + is_null($x) || is_null($y) ? null : new Point($x, $y), + ), + ); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::drawPixel() + */ + public function drawPixel(int $x, int $y, mixed $color): ImageInterface + { + return $this->modify(new DrawPixelModifier(new Point($x, $y), $color)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::drawRectangle() + */ + public function drawRectangle(int $x, int $y, callable|Closure|Rectangle $init): ImageInterface + { + return $this->modify( + new DrawRectangleModifier( + call_user_func(new RectangleFactory(new Point($x, $y), $init)), + ), + ); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::drawEllipse() + */ + public function drawEllipse(int $x, int $y, callable|Closure|Ellipse $init): ImageInterface + { + return $this->modify( + new DrawEllipseModifier( + call_user_func(new EllipseFactory(new Point($x, $y), $init)), + ), + ); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::drawCircle() + */ + public function drawCircle(int $x, int $y, callable|Closure|Circle $init): ImageInterface + { + return $this->modify( + new DrawEllipseModifier( + call_user_func(new CircleFactory(new Point($x, $y), $init)), + ), + ); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::drawPolygon() + */ + public function drawPolygon(callable|Closure|Polygon $init): ImageInterface + { + return $this->modify( + new DrawPolygonModifier( + call_user_func(new PolygonFactory($init)), + ), + ); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::drawLine() + */ + public function drawLine(callable|Closure|Line $init): ImageInterface + { + return $this->modify( + new DrawLineModifier( + call_user_func(new LineFactory($init)), + ), + ); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::drawBezier() + */ + public function drawBezier(callable|Closure|Bezier $init): ImageInterface + { + return $this->modify( + new DrawBezierModifier( + call_user_func(new BezierFactory($init)), + ), + ); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::encodeByMediaType() + */ + public function encodeByMediaType(null|string|MediaType $type = null, mixed ...$options): EncodedImageInterface + { + return $this->encode(new MediaTypeEncoder($type, ...$options)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::encodeByExtension() + */ + public function encodeByExtension( + null|string|FileExtension $extension = null, + mixed ...$options + ): EncodedImageInterface { + return $this->encode(new FileExtensionEncoder($extension, ...$options)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::encodeByPath() + */ + public function encodeByPath(?string $path = null, mixed ...$options): EncodedImageInterface + { + return $this->encode(new FilePathEncoder($path, ...$options)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::toJpeg() + */ + public function toJpeg(mixed ...$options): EncodedImageInterface + { + return $this->encode(new JpegEncoder(...$options)); + } + + /** + * Alias of self::toJpeg() + * + * @throws RuntimeException + */ + public function toJpg(mixed ...$options): EncodedImageInterface + { + return $this->toJpeg(...$options); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::toJpeg() + */ + public function toJpeg2000(mixed ...$options): EncodedImageInterface + { + return $this->encode(new Jpeg2000Encoder(...$options)); + } + + /** + * ALias of self::toJpeg2000() + * + * @throws RuntimeException + */ + public function toJp2(mixed ...$options): EncodedImageInterface + { + return $this->toJpeg2000(...$options); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::toPng() + */ + public function toPng(mixed ...$options): EncodedImageInterface + { + return $this->encode(new PngEncoder(...$options)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::toGif() + */ + public function toGif(mixed ...$options): EncodedImageInterface + { + return $this->encode(new GifEncoder(...$options)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::toWebp() + */ + public function toWebp(mixed ...$options): EncodedImageInterface + { + return $this->encode(new WebpEncoder(...$options)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::toBitmap() + */ + public function toBitmap(mixed ...$options): EncodedImageInterface + { + return $this->encode(new BmpEncoder(...$options)); + } + + /** + * Alias if self::toBitmap() + * + * @throws RuntimeException + */ + public function toBmp(mixed ...$options): EncodedImageInterface + { + return $this->toBitmap(...$options); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::toAvif() + */ + public function toAvif(mixed ...$options): EncodedImageInterface + { + return $this->encode(new AvifEncoder(...$options)); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::toTiff() + */ + public function toTiff(mixed ...$options): EncodedImageInterface + { + return $this->encode(new TiffEncoder(...$options)); + } + + /** + * Alias of self::toTiff() + * + * @throws RuntimeException + */ + public function toTif(mixed ...$options): EncodedImageInterface + { + return $this->toTiff(...$options); + } + + /** + * {@inheritdoc} + * + * @see ImageInterface::toHeic() + */ + public function toHeic(mixed ...$options): EncodedImageInterface + { + return $this->encode(new HeicEncoder(...$options)); + } + + /** + * Show debug info for the current image + * + * @return array + */ + public function __debugInfo(): array + { + try { + return [ + 'width' => $this->width(), + 'height' => $this->height(), + ]; + } catch (RuntimeException) { + return []; + } + } + + /** + * Clone image + */ + public function __clone(): void + { + $this->driver = clone $this->driver; + $this->core = clone $this->core; + $this->exif = clone $this->exif; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/ImageManager.php b/upLoadImage/vendor/intervention/image/src/ImageManager.php new file mode 100644 index 0000000..16e608b --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/ImageManager.php @@ -0,0 +1,143 @@ +driver = $this->resolveDriver($driver, ...$options); + } + + /** + * Create image manager with given driver + * + * @link https://image.intervention.io/v3/basics/configuration-drivers#static-constructor + * + * @throws DriverException + * @throws InputException + */ + public static function withDriver(string|DriverInterface $driver, mixed ...$options): self + { + return new self(self::resolveDriver($driver, ...$options)); + } + + /** + * Create image manager with GD driver + * + * @link https://image.intervention.io/v3/basics/configuration-drivers#static-gd-driver-constructor + * + * @throws DriverException + * @throws InputException + */ + public static function gd(mixed ...$options): self + { + return self::withDriver(new GdDriver(), ...$options); + } + + /** + * Create image manager with Imagick driver + * + * @link https://image.intervention.io/v3/basics/configuration-drivers#static-imagick-driver-constructor + * + * @throws DriverException + * @throws InputException + */ + public static function imagick(mixed ...$options): self + { + return self::withDriver(new ImagickDriver(), ...$options); + } + + /** + * {@inheritdoc} + * + * @see ImageManagerInterface::create() + */ + public function create(int $width, int $height): ImageInterface + { + return $this->driver->createImage($width, $height); + } + + /** + * {@inheritdoc} + * + * @see ImageManagerInterface::read() + */ + public function read(mixed $input, string|array|DecoderInterface $decoders = []): ImageInterface + { + return $this->driver->handleInput( + $input, + match (true) { + is_string($decoders), is_a($decoders, DecoderInterface::class) => [$decoders], + default => $decoders, + } + ); + } + + /** + * {@inheritdoc} + * + * @see ImageManagerInterface::animate() + */ + public function animate(callable $init): ImageInterface + { + return $this->driver->createAnimation($init); + } + + /** + * {@inheritdoc} + * + * @see ImageManagerInterface::driver() + */ + public function driver(): DriverInterface + { + return $this->driver; + } + + /** + * Return driver object from given input which might be driver classname or instance of DriverInterface + * + * @throws DriverException + * @throws InputException + */ + private static function resolveDriver(string|DriverInterface $driver, mixed ...$options): DriverInterface + { + $driver = match (true) { + $driver instanceof DriverInterface => $driver, + class_exists($driver) => new $driver(), + default => throw new DriverException( + 'Unable to resolve driver. Argment must be either an instance of ' . + DriverInterface::class . '::class or a qualified namespaced name of the driver class.', + ), + }; + + if (!$driver instanceof DriverInterface) { + throw new DriverException( + 'Unable to resolve driver. Driver object must implement ' . DriverInterface::class . '.', + ); + } + + $driver->config()->setOptions(...$options); + + return $driver; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/InputHandler.php b/upLoadImage/vendor/intervention/image/src/InputHandler.php new file mode 100644 index 0000000..9189aad --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/InputHandler.php @@ -0,0 +1,132 @@ + + */ + protected array $decoders = [ + NativeObjectDecoder::class, + ImageObjectDecoder::class, + ColorObjectDecoder::class, + RgbHexColorDecoder::class, + RgbStringColorDecoder::class, + CmykStringColorDecoder::class, + HsvStringColorDecoder::class, + HslStringColorDecoder::class, + TransparentColorDecoder::class, + HtmlColornameDecoder::class, + FilePointerImageDecoder::class, + FilePathImageDecoder::class, + SplFileInfoImageDecoder::class, + BinaryImageDecoder::class, + DataUriImageDecoder::class, + Base64ImageDecoder::class, + EncodedImageObjectDecoder::class, + ]; + + /** + * Driver with which the decoder classes are specialized + */ + protected ?DriverInterface $driver = null; + + /** + * Create new input handler instance with given decoder classnames + * + * @param array $decoders + * @return void + */ + public function __construct(array $decoders = [], ?DriverInterface $driver = null) + { + $this->decoders = count($decoders) ? $decoders : $this->decoders; + $this->driver = $driver; + } + + /** + * Static factory method + * + * @param array $decoders + */ + public static function withDecoders(array $decoders, ?DriverInterface $driver = null): self + { + return new self($decoders, $driver); + } + + /** + * {@inheritdoc} + * + * @see InputHandlerInterface::handle() + */ + public function handle(mixed $input): ImageInterface|ColorInterface + { + foreach ($this->decoders as $decoder) { + try { + // decode with driver specialized decoder + return $this->resolve($decoder)->decode($input); + } catch (DecoderException | NotSupportedException $e) { + // try next decoder + } + } + + if (isset($e)) { + throw new ($e::class)($e->getMessage()); + } + + throw new DecoderException('Unable to decode input.'); + } + + /** + * Resolve the given classname to an decoder object + * + * @throws DriverException + * @throws NotSupportedException + */ + private function resolve(string|DecoderInterface $decoder): DecoderInterface + { + if (($decoder instanceof DecoderInterface) && empty($this->driver)) { + return $decoder; + } + + if (($decoder instanceof DecoderInterface) && !empty($this->driver)) { + return $this->driver->specialize($decoder); + } + + if (empty($this->driver)) { + return new $decoder(); + } + + return $this->driver->specialize(new $decoder()); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Interfaces/AnalyzerInterface.php b/upLoadImage/vendor/intervention/image/src/Interfaces/AnalyzerInterface.php new file mode 100644 index 0000000..d11d874 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Interfaces/AnalyzerInterface.php @@ -0,0 +1,17 @@ + + */ +interface CollectionInterface extends Traversable +{ + /** + * Determine if the collection has item at given key + */ + public function has(int|string $key): bool; + + /** + * Add item to collection + * + * @return CollectionInterface + */ + public function push(mixed $item): self; + + /** + * Return item for given key or return default is key does not exist + */ + public function get(int|string $key, mixed $default = null): mixed; + + /** + * Return item at given numeric position starting at 0 + */ + public function getAtPosition(int $key = 0, mixed $default = null): mixed; + + /** + * Return first item in collection + */ + public function first(): mixed; + + /** + * Return last item in collection + */ + public function last(): mixed; + + /** + * Return item count of collection + */ + public function count(): int; + + /** + * Empty collection + * + * @return CollectionInterface + */ + public function empty(): self; + + /** + * Transform collection as array + * + * @return array + */ + public function toArray(): array; + + /** + * Extract items based on given values and discard the rest. + * + * @return CollectionInterface + */ + public function slice(int $offset, ?int $length = 0): self; +} diff --git a/upLoadImage/vendor/intervention/image/src/Interfaces/ColorChannelInterface.php b/upLoadImage/vendor/intervention/image/src/Interfaces/ColorChannelInterface.php new file mode 100644 index 0000000..ed70557 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Interfaces/ColorChannelInterface.php @@ -0,0 +1,57 @@ + + */ + public function toArray(): array; + + /** + * Cast color object to hex encoded web color + */ + public function toHex(string $prefix = ''): string; + + /** + * Return array of all color channels + * + * @return array + */ + public function channels(): array; + + /** + * Return array of normalized color channel values + * + * @return array + */ + public function normalize(): array; + + /** + * Retrieve the color channel by its classname + * + * @throws ColorException + */ + public function channel(string $classname): ColorChannelInterface; + + /** + * Convert color to given colorspace + */ + public function convertTo(string|ColorspaceInterface $colorspace): self; + + /** + * Determine if the current color is gray + */ + public function isGreyscale(): bool; + + /** + * Determine if the current color is (semi) transparent + */ + public function isTransparent(): bool; + + /** + * Determine whether the current color is completely transparent + */ + public function isClear(): bool; + + /** + * Cast color object to string + */ + public function __toString(): string; +} diff --git a/upLoadImage/vendor/intervention/image/src/Interfaces/ColorProcessorInterface.php b/upLoadImage/vendor/intervention/image/src/Interfaces/ColorProcessorInterface.php new file mode 100644 index 0000000..cd1d7ec --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Interfaces/ColorProcessorInterface.php @@ -0,0 +1,24 @@ + $normalized + */ + public function colorFromNormalized(array $normalized): ColorInterface; +} diff --git a/upLoadImage/vendor/intervention/image/src/Interfaces/CoreInterface.php b/upLoadImage/vendor/intervention/image/src/Interfaces/CoreInterface.php new file mode 100644 index 0000000..4082984 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Interfaces/CoreInterface.php @@ -0,0 +1,70 @@ + + */ + public function setNative(mixed $native): self; + + /** + * Count number of frames of animated image core + */ + public function count(): int; + + /** + * Return frame of given position in an animated image + * + * @throws AnimationException + */ + public function frame(int $position): FrameInterface; + + /** + * Add new frame to core + * + * @return CoreInterface + */ + public function add(FrameInterface $frame): self; + + /** + * Return number of repetitions of an animated image + */ + public function loops(): int; + + /** + * Set the number of repetitions for an animation. Where a + * value of 0 means infinite repetition. + * + * @return CoreInterface + */ + public function setLoops(int $loops): self; + + /** + * Get first frame in core + * + * @throws AnimationException + */ + public function first(): FrameInterface; + + /** + * Get last frame in core + * + * @throws AnimationException + */ + public function last(): FrameInterface; +} diff --git a/upLoadImage/vendor/intervention/image/src/Interfaces/DecoderInterface.php b/upLoadImage/vendor/intervention/image/src/Interfaces/DecoderInterface.php new file mode 100644 index 0000000..3383269 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Interfaces/DecoderInterface.php @@ -0,0 +1,17 @@ + $objects + * @throws NotSupportedException + * @throws DriverException + * @return array + */ + public function specializeMultiple(array $objects): array; + + /** + * Create new image instance with the current driver in given dimensions + * + * @throws RuntimeException + */ + public function createImage(int $width, int $height): ImageInterface; + + /** + * Create new animated image + * + * @throws RuntimeException + */ + public function createAnimation(callable $init): ImageInterface; + + /** + * Handle given input by decoding it to ImageInterface or ColorInterface + * + * @param array $decoders + * @throws RuntimeException + */ + public function handleInput(mixed $input, array $decoders = []): ImageInterface|ColorInterface; + + /** + * Return color processor for the given colorspace + */ + public function colorProcessor(ColorspaceInterface $colorspace): ColorProcessorInterface; + + /** + * Return font processor of the current driver + */ + public function fontProcessor(): FontProcessorInterface; + + /** + * Check whether all requirements for operating the driver are met and + * throw exception if the check fails. + * + * @throws DriverException + */ + public function checkHealth(): void; + + /** + * Check if the current driver supports the given format and if the + * underlying PHP extension was built with support for the format. + */ + public function supports(string|Format|FileExtension|MediaType $identifier): bool; +} diff --git a/upLoadImage/vendor/intervention/image/src/Interfaces/EncodedImageInterface.php b/upLoadImage/vendor/intervention/image/src/Interfaces/EncodedImageInterface.php new file mode 100644 index 0000000..d521d8e --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Interfaces/EncodedImageInterface.php @@ -0,0 +1,23 @@ + + */ +interface ImageInterface extends IteratorAggregate, Countable +{ + /** + * Return driver of current image + */ + public function driver(): DriverInterface; + + /** + * Return core of current image + */ + public function core(): CoreInterface; + + /** + * Return the origin of the image + */ + public function origin(): Origin; + + /** + * Set the origin of the image + */ + public function setOrigin(Origin $origin): self; + + /** + * Return width of current image + * + * @link https://image.intervention.io/v3/basics/meta-information#read-the-pixel-width + * + * @throws RuntimeException + */ + public function width(): int; + + /** + * Return height of current image + * + * @link https://image.intervention.io/v3/basics/meta-information#read-the-pixel-height + * + * @throws RuntimeException + */ + public function height(): int; + + /** + * Return size of current image + * + * @link https://image.intervention.io/v3/basics/meta-information#read-the-image-size-as-an-object + * + * @throws RuntimeException + */ + public function size(): SizeInterface; + + /** + * Encode image with given encoder + * + * @link https://image.intervention.io/v3/basics/image-output#encode-images + * + * @throws RuntimeException + */ + public function encode(EncoderInterface $encoder = new AutoEncoder()): EncodedImageInterface; + + /** + * Save the image to the specified path in the file system. If no path is + * given, the image will be saved at its original location. + * + * @link https://image.intervention.io/v3/basics/image-output#encode--save-combined + * + * @throws RuntimeException + */ + public function save(?string $path = null, mixed ...$options): self; + + /** + * Apply given modifier to current image + * + * @link https://image.intervention.io/v3/modifying-images/custom-modifiers + * + * @throws RuntimeException + */ + public function modify(ModifierInterface $modifier): self; + + /** + * Analyzer current image with given analyzer + * + * @throws RuntimeException + */ + public function analyze(AnalyzerInterface $analyzer): mixed; + + /** + * Determine if current image is animated + * + * @link https://image.intervention.io/v3/modifying-images/animations#check-the-current-image-instance-for-animation + */ + public function isAnimated(): bool; + + /** + * Remove all frames but keep the one at the specified position + * + * It is possible to specify the position as integer or string values. + * With the former, the exact position passed is searched for, while + * string values must represent a percentage value between '0%' and '100%' + * and the respective frame position is only determined approximately. + * + * @link https://image.intervention.io/v3/modifying-images/animations#remove-animation + * + * @throws RuntimeException + */ + public function removeAnimation(int|string $position = 0): self; + + /** + * Extract animation frames based on given values and discard the rest + * + * @link https://image.intervention.io/v3/modifying-images/animations#change-the-animation-iteration-count + * + * @throws RuntimeException + */ + public function sliceAnimation(int $offset = 0, ?int $length = null): self; + + /** + * Return loop count of animated image + * + * @link https://image.intervention.io/v3/modifying-images/animations#read-the-animation-iteration-count + */ + public function loops(): int; + + /** + * Set loop count of animated image + * + * @link https://image.intervention.io/v3/modifying-images/animations#change-the-animation-iteration-count + */ + public function setLoops(int $loops): self; + + /** + * Return exif data of current image + * + * @link https://image.intervention.io/v3/basics/meta-information#exif-information + */ + public function exif(?string $query = null): mixed; + + /** + * Set exif data for the image object + */ + public function setExif(CollectionInterface $exif): self; + + /** + * Return image resolution/density + * + * @link https://image.intervention.io/v3/basics/meta-information#image-resolution + * + * @throws RuntimeException + */ + public function resolution(): ResolutionInterface; + + /** + * Set image resolution + * + * @link https://image.intervention.io/v3/basics/meta-information#image-resolution + * + * @throws RuntimeException + */ + public function setResolution(float $x, float $y): self; + + /** + * Get the colorspace of the image + * + * @link https://image.intervention.io/v3/basics/colors#read-the-image-colorspace + * + * @throws RuntimeException + */ + public function colorspace(): ColorspaceInterface; + + /** + * Transform image to given colorspace + * + * @link https://image.intervention.io/v3/basics/colors#change-the-image-colorspace + * + * @throws RuntimeException + */ + public function setColorspace(string|ColorspaceInterface $colorspace): self; + + /** + * Return color of pixel at given position on given frame position + * + * @link https://image.intervention.io/v3/basics/colors#color-information + * + * @throws RuntimeException + */ + public function pickColor(int $x, int $y, int $frame_key = 0): ColorInterface; + + /** + * Return all colors of pixel at given position for all frames of image + * + * @link https://image.intervention.io/v3/basics/colors#color-information + * + * @throws RuntimeException + */ + public function pickColors(int $x, int $y): CollectionInterface; + + /** + * Return color that is mixed with transparent areas when converting to a format which + * does not support transparency. + * + * @throws RuntimeException + */ + public function blendingColor(): ColorInterface; + + /** + * Set blending color will have no effect unless image is converted into a format + * which does not support transparency. + * + * @throws RuntimeException + */ + public function setBlendingColor(mixed $color): self; + + /** + * Replace transparent areas of the image with given color + * + * @throws RuntimeException + */ + public function blendTransparency(mixed $color = null): self; + + /** + * Retrieve ICC color profile of image + * + * @link https://image.intervention.io/v3/basics/colors#color-profiles + * + * @throws RuntimeException + */ + public function profile(): ProfileInterface; + + /** + * Set given icc color profile to image + * + * @link https://image.intervention.io/v3/basics/colors#color-profiles + * + * @throws RuntimeException + */ + public function setProfile(ProfileInterface $profile): self; + + /** + * Remove ICC color profile from the current image + * + * @link https://image.intervention.io/v3/basics/colors#color-profiles + * + * @throws RuntimeException + */ + public function removeProfile(): self; + + /** + * Apply color quantization to the current image + * + * @link https://image.intervention.io/v3/modifying-images/effects#reduce-colors + * + * @throws RuntimeException + */ + public function reduceColors(int $limit, mixed $background = 'transparent'): self; + + /** + * Sharpen the current image with given strength + * + * @link https://image.intervention.io/v3/modifying-images/effects#sharpening-effect + * + * @throws RuntimeException + */ + public function sharpen(int $amount = 10): self; + + /** + * Turn image into a greyscale version + * + * @link https://image.intervention.io/v3/modifying-images/effects#convert-image-to-a-greyscale-version + * + * @throws RuntimeException + */ + public function greyscale(): self; + + /** + * Adjust brightness of the current image + * + * @link https://image.intervention.io/v3/modifying-images/effects#change-the-image-brightness + * + * @throws RuntimeException + */ + public function brightness(int $level): self; + + /** + * Adjust color contrast of the current image + * + * @link https://image.intervention.io/v3/modifying-images/effects#change-the-image-contrast + * + * @throws RuntimeException + */ + public function contrast(int $level): self; + + /** + * Apply gamma correction on the current image + * + * @link https://image.intervention.io/v3/modifying-images/effects#gamma-correction + * + * @throws RuntimeException + */ + public function gamma(float $gamma): self; + + /** + * Adjust the intensity of the RGB color channels + * + * @link https://image.intervention.io/v3/modifying-images/effects#color-correction + * + * @throws RuntimeException + */ + public function colorize(int $red = 0, int $green = 0, int $blue = 0): self; + + /** + * Mirror the current image vertically by swapping top and bottom + * + * @link https://image.intervention.io/v3/modifying-images/effects#mirror-image-vertically + * + * @throws RuntimeException + */ + public function flip(): self; + + /** + * Mirror the current image horizontally by swapping left and right + * + * @link https://image.intervention.io/v3/modifying-images/effects#mirror-image-horizontally + * + * @throws RuntimeException + */ + public function flop(): self; + + /** + * Blur current image by given strength + * + * @link https://image.intervention.io/v3/modifying-images/effects#blur-effect + * + * @throws RuntimeException + */ + public function blur(int $amount = 5): self; + + /** + * Invert the colors of the current image + * + * @link https://image.intervention.io/v3/modifying-images/effects#invert-colors + * + * @throws RuntimeException + */ + public function invert(): self; + + /** + * Apply pixelation filter effect on current image + * + * @link https://image.intervention.io/v3/modifying-images/effects#pixelation-effect + * + * @throws RuntimeException + */ + public function pixelate(int $size): self; + + /** + * Rotate current image by given angle + * + * @link https://image.intervention.io/v3/modifying-images/effects#image-rotation + * + * @param string $background + * @throws RuntimeException + */ + public function rotate(float $angle, mixed $background = 'ffffff'): self; + + /** + * Rotate the image to be upright according to exif information + * + * @link https://image.intervention.io/v3/modifying-images/effects#image-orientation-according-to-exif-data + * + * @throws RuntimeException + */ + public function orient(): self; + + /** + * Draw text on image + * + * @link https://image.intervention.io/v3/modifying-images/text-fonts + * + * @throws RuntimeException + */ + public function text(string $text, int $x, int $y, callable|Closure|FontInterface $font): self; + + /** + * Resize image to the given width and/or height + * + * @link https://image.intervention.io/v3/modifying-images/resizing#simple-image-resizing + * + * @throws RuntimeException + */ + public function resize(?int $width = null, ?int $height = null): self; + + /** + * Resize image to the given width and/or height without exceeding the original dimensions + * + * @link https://image.intervention.io/v3/modifying-images/resizing#resize-without-exceeding-the-original-size + * + * @throws RuntimeException + */ + public function resizeDown(?int $width = null, ?int $height = null): self; + + /** + * Resize image to the given width and/or height and keep the original aspect ratio + * + * @link https://image.intervention.io/v3/modifying-images/resizing#resize-images-proportionally + * + * @throws RuntimeException + */ + public function scale(?int $width = null, ?int $height = null): self; + + /** + * Resize image to the given width and/or height, keep the original aspect ratio + * and do not exceed the original image width or height + * + * @link https://image.intervention.io/v3/modifying-images/resizing#scale-images-but-do-not-exceed-the-original-size + * + * @throws RuntimeException + */ + public function scaleDown(?int $width = null, ?int $height = null): self; + + /** + * Takes the specified width and height and scales them to the largest + * possible size that fits within the original size. This scaled size is + * then positioned on the original and cropped, before this result is resized + * to the desired size using the arguments + * + * @link https://image.intervention.io/v3/modifying-images/resizing#cropping--resizing-combined + * + * @throws RuntimeException + */ + public function cover(int $width, int $height, string $position = 'center'): self; + + /** + * Same as cover() but do not exceed the original image size + * + * @link https://image.intervention.io/v3/modifying-images/resizing#fitted-resizing-without-exceeding-the-original-size + * + * @throws RuntimeException + */ + public function coverDown(int $width, int $height, string $position = 'center'): self; + + /** + * Resize the boundaries of the current image to given width and height. + * An anchor position can be defined to determine where the original image + * is fixed. A background color can be passed to define the color of the + * new emerging areas. + * + * @link https://image.intervention.io/v3/modifying-images/resizing#resize-image-boundaries-without-resampling-the-original-image + * + * @throws RuntimeException + */ + public function resizeCanvas( + ?int $width = null, + ?int $height = null, + mixed $background = 'ffffff', + string $position = 'center' + ): self; + + /** + * Resize canvas in the same way as resizeCanvas() but takes relative values + * for the width and height, which will be added or subtracted to the + * original image size. + * + * @link https://image.intervention.io/v3/modifying-images/resizing#resize-image-boundaries-relative-to-the-original + * + * @throws RuntimeException + */ + public function resizeCanvasRelative( + ?int $width = null, + ?int $height = null, + mixed $background = 'ffffff', + string $position = 'center' + ): self; + + /** + * Padded resizing means that the original image is scaled until it fits the + * defined target size with unchanged aspect ratio. The original image is + * not scaled up but only down. + * + * Compared to the cover() method, this method does not create cropped areas, + * but possibly new empty areas on the sides of the result image. These are + * filled with the specified background color. + * + * @link https://image.intervention.io/v3/modifying-images/resizing#resizing--padding-combined + * + * @param string $background + * @throws RuntimeException + */ + public function pad( + int $width, + int $height, + mixed $background = 'ffffff', + string $position = 'center' + ): self; + + /** + * This method does the same as pad(), but the original image is also scaled + * up if the target size exceeds the original size. + * + * @link https://image.intervention.io/v3/modifying-images/resizing#padded-resizing-with-upscaling + * + * @param string $background + * @throws RuntimeException + */ + public function contain( + int $width, + int $height, + mixed $background = 'ffffff', + string $position = 'center' + ): self; + + /** + * Cut out a rectangular part of the current image with given width and + * height at a given position. Define optional x,y offset coordinates + * to move the cutout by the given amount of pixels. + * + * @link https://image.intervention.io/v3/modifying-images/resizing#cut-out-a-rectangular-part + * + * @throws RuntimeException + */ + public function crop( + int $width, + int $height, + int $offset_x = 0, + int $offset_y = 0, + mixed $background = 'ffffff', + string $position = 'top-left' + ): self; + + /** + * Trim the image by removing border areas of similar color within a the given tolerance + * + * @link https://image.intervention.io/v3/modifying-images/resizing#remove-border-areas-in-similar-color + * + * @throws RuntimeException + * @throws AnimationException + */ + public function trim(int $tolerance = 0): self; + + /** + * Place another image into the current image instance + * + * @link https://image.intervention.io/v3/modifying-images/inserting#insert-images + * + * @throws RuntimeException + */ + public function place( + mixed $element, + string $position = 'top-left', + int $offset_x = 0, + int $offset_y = 0, + int $opacity = 100 + ): self; + + /** + * Fill image with given color + * + * If an optional position is specified for the filling process ln the form + * of x and y coordinates, the process is executed as flood fill. This means + * that the color at the specified position is taken as a reference and all + * adjacent pixels are also filled with the filling color. + * + * If no coordinates are specified, the entire image area is filled. + * + * @link https://image.intervention.io/v3/modifying-images/drawing#fill-images-with-color + * + * @throws RuntimeException + */ + public function fill(mixed $color, ?int $x = null, ?int $y = null): self; + + /** + * Draw a single pixel at given position defined by the coordinates x and y in a given color. + * + * @link https://image.intervention.io/v3/modifying-images/drawing#draw-pixels + * + * @throws RuntimeException + */ + public function drawPixel(int $x, int $y, mixed $color): self; + + /** + * Draw a rectangle on the current image + * + * @link https://image.intervention.io/v3/modifying-images/drawing#draw-a-rectangle + * + * @throws RuntimeException + */ + public function drawRectangle(int $x, int $y, callable|Closure|Rectangle $init): self; + + /** + * Draw ellipse on the current image + * + * @link https://image.intervention.io/v3/modifying-images/drawing#draw-ellipses + * + * @throws RuntimeException + */ + public function drawEllipse(int $x, int $y, callable|Closure|Ellipse $init): self; + + /** + * Draw circle on the current image + * + * @link https://image.intervention.io/v3/modifying-images/drawing#draw-a-circle + * + * @throws RuntimeException + */ + public function drawCircle(int $x, int $y, callable|Closure|Circle $init): self; + + /** + * Draw a polygon on the current image + * + * @link https://image.intervention.io/v3/modifying-images/drawing#draw-a-polygon + * + * @throws RuntimeException + */ + public function drawPolygon(callable|Closure|Polygon $init): self; + + /** + * Draw a line on the current image + * + * @link https://image.intervention.io/v3/modifying-images/drawing#draw-a-line + * + * @throws RuntimeException + */ + public function drawLine(callable|Closure|Line $init): self; + + /** + * Draw a bezier curve on the current image + * + * @link https://image.intervention.io/v3/modifying-images/drawing#draw-bezier-curves + * + * @throws RuntimeException + */ + public function drawBezier(callable|Closure|Bezier $init): self; + + /** + * Encode image to given media (mime) type. If no type is given the image + * will be encoded to the format of the originally read image. + * + * @link https://image.intervention.io/v3/basics/image-output#encode-images-by-media-mime-type + * + * @throws RuntimeException + */ + public function encodeByMediaType(null|string|MediaType $type = null, mixed ...$options): EncodedImageInterface; + + /** + * Encode the image into the format represented by the given extension. If no + * extension is given the image will be encoded to the format of the + * originally read image. + * + * @link https://image.intervention.io/v3/basics/image-output#encode-images-by-file-extension + * + * @throws RuntimeException + */ + public function encodeByExtension( + null|string|FileExtension $extension = null, + mixed ...$options + ): EncodedImageInterface; + + /** + * Encode the image into the format represented by the given extension of + * the given file path extension is given the image will be encoded to + * the format of the originally read image. + * + * @link https://image.intervention.io/v3/basics/image-output#encode-images-by-file-path + * + * @throws RuntimeException + */ + public function encodeByPath(?string $path = null, mixed ...$options): EncodedImageInterface; + + /** + * Encode image to JPEG format + * + * @link https://image.intervention.io/v3/basics/image-output#encode-jpeg-format + * + * @throws RuntimeException + */ + public function toJpeg(mixed ...$options): EncodedImageInterface; + + /** + * Encode image to Jpeg2000 format + * + * @link https://image.intervention.io/v3/basics/image-output#encode-jpeg-2000-format + * + * @throws RuntimeException + */ + public function toJpeg2000(mixed ...$options): EncodedImageInterface; + + /** + * Encode image to Webp format + * + * @link https://image.intervention.io/v3/basics/image-output#encode-webp-format + * + * @throws RuntimeException + */ + public function toWebp(mixed ...$options): EncodedImageInterface; + + /** + * Encode image to PNG format + * + * @link https://image.intervention.io/v3/basics/image-output#encode-png-format + * + * @throws RuntimeException + */ + public function toPng(mixed ...$options): EncodedImageInterface; + + /** + * Encode image to GIF format + * + * @link https://image.intervention.io/v3/basics/image-output#encode-gif-format + * + * @throws RuntimeException + */ + public function toGif(mixed ...$options): EncodedImageInterface; + + /** + * Encode image to Bitmap format + * + * @link https://image.intervention.io/v3/basics/image-output#encode-windows-bitmap-format + * + * @throws RuntimeException + */ + public function toBitmap(mixed ...$options): EncodedImageInterface; + + /** + * Encode image to AVIF format + * + * @link https://image.intervention.io/v3/basics/image-output#encode-av1-image-file-format-avif + * + * @throws RuntimeException + */ + public function toAvif(mixed ...$options): EncodedImageInterface; + + /** + * Encode image to TIFF format + * + * @link https://image.intervention.io/v3/basics/image-output#encode-tiff-format + * + * @throws RuntimeException + */ + public function toTiff(mixed ...$options): EncodedImageInterface; + + /** + * Encode image to HEIC format + * + * @link https://image.intervention.io/v3/basics/image-output#encode-heic-format + * + * @throws RuntimeException + */ + public function toHeic(mixed ...$options): EncodedImageInterface; +} diff --git a/upLoadImage/vendor/intervention/image/src/Interfaces/ImageManagerInterface.php b/upLoadImage/vendor/intervention/image/src/Interfaces/ImageManagerInterface.php new file mode 100644 index 0000000..92652ec --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Interfaces/ImageManagerInterface.php @@ -0,0 +1,63 @@ +|DecoderInterface $decoders + * @throws RuntimeException + */ + public function read(mixed $input, string|array|DecoderInterface $decoders = []): ImageInterface; + + /** + * Create new animated image by given callback + * + * @link https://image.intervention.io/v3/basics/instantiation#create-animations + * + * @throws RuntimeException + */ + public function animate(callable $init): ImageInterface; + + /** + * Return currently used driver + */ + public function driver(): DriverInterface; +} diff --git a/upLoadImage/vendor/intervention/image/src/Interfaces/InputHandlerInterface.php b/upLoadImage/vendor/intervention/image/src/Interfaces/InputHandlerInterface.php new file mode 100644 index 0000000..f6c6c3d --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Interfaces/InputHandlerInterface.php @@ -0,0 +1,17 @@ + + */ + public function specializable(): array; + + /** + * Set the driver for which the object is specialized + * + * @throws DriverException + */ + public function setDriver(DriverInterface $driver): self; + + /** + * Return the driver for which the object was specialized + */ + public function driver(): DriverInterface; +} diff --git a/upLoadImage/vendor/intervention/image/src/Interfaces/SpecializedInterface.php b/upLoadImage/vendor/intervention/image/src/Interfaces/SpecializedInterface.php new file mode 100644 index 0000000..5d23bab --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Interfaces/SpecializedInterface.php @@ -0,0 +1,10 @@ +mediaType(); + } + + if ($identifier instanceof FileExtension) { + return $identifier->mediaType(); + } + + try { + $type = self::from(strtolower($identifier)); + } catch (Error) { + try { + $type = FileExtension::from(strtolower($identifier))->mediaType(); + } catch (Error) { + throw new NotSupportedException('Unable to create media type from "' . $identifier . '".'); + } + } + + return $type; + } + + /** + * Try to create media type from given identifier and return null on failure + * + * @param string|Format|MediaType|FileExtension $identifier + * @return MediaType|null + */ + public static function tryCreate(string|self|Format|FileExtension $identifier): ?self + { + try { + return self::create($identifier); + } catch (NotSupportedException) { + return null; + } + } + + /** + * Return the matching format for the current media (MIME) type + */ + public function format(): Format + { + return match ($this) { + self::IMAGE_JPEG, + self::IMAGE_JPG, + self::IMAGE_PJPEG, + self::IMAGE_X_JPEG => Format::JPEG, + self::IMAGE_WEBP, + self::IMAGE_X_WEBP => Format::WEBP, + self::IMAGE_GIF => Format::GIF, + self::IMAGE_PNG, + self::IMAGE_X_PNG => Format::PNG, + self::IMAGE_AVIF, + self::IMAGE_X_AVIF => Format::AVIF, + self::IMAGE_BMP, + self::IMAGE_MS_BMP, + self::IMAGE_X_BITMAP, + self::IMAGE_X_BMP, + self::IMAGE_X_MS_BMP, + self::IMAGE_X_XBITMAP, + self::IMAGE_X_WINDOWS_BMP, + self::IMAGE_X_BMP3, + self::IMAGE_X_WIN_BITMAP => Format::BMP, + self::IMAGE_TIFF => Format::TIFF, + self::IMAGE_JP2, + self::IMAGE_JPX, + self::IMAGE_X_JP2_CODESTREAM, + self::IMAGE_JPM => Format::JP2, + self::IMAGE_HEIF, + self::IMAGE_HEIC, + self::IMAGE_X_HEIC => Format::HEIC, + }; + } + + /** + * Return the possible file extension for the current media type + * + * @return array + */ + public function fileExtensions(): array + { + return $this->format()->fileExtensions(); + } + + /** + * Return the first file extension for the current media type + */ + public function fileExtension(): FileExtension + { + return $this->format()->fileExtension(); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/ModifierStack.php b/upLoadImage/vendor/intervention/image/src/ModifierStack.php new file mode 100644 index 0000000..aacfa15 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/ModifierStack.php @@ -0,0 +1,44 @@ + $modifiers + * @return void + */ + public function __construct(protected array $modifiers) + { + // + } + + /** + * Apply all modifiers in stack to the given image + */ + public function apply(ImageInterface $image): ImageInterface + { + foreach ($this->modifiers as $modifier) { + $modifier->apply($image); + } + + return $image; + } + + /** + * Append new modifier to the stack + */ + public function push(ModifierInterface $modifier): self + { + $this->modifiers[] = $modifier; + + return $this; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Modifiers/AbstractDrawModifier.php b/upLoadImage/vendor/intervention/image/src/Modifiers/AbstractDrawModifier.php new file mode 100644 index 0000000..123b163 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Modifiers/AbstractDrawModifier.php @@ -0,0 +1,47 @@ +driver()->handleInput($this->drawable()->backgroundColor()); + } catch (DecoderException) { + return $this->driver()->handleInput('transparent'); + } + + return $color; + } + + /** + * @throws RuntimeException + */ + public function borderColor(): ColorInterface + { + try { + $color = $this->driver()->handleInput($this->drawable()->borderColor()); + } catch (DecoderException) { + return $this->driver()->handleInput('transparent'); + } + + return $color; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Modifiers/AlignRotationModifier.php b/upLoadImage/vendor/intervention/image/src/Modifiers/AlignRotationModifier.php new file mode 100644 index 0000000..0faaa76 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Modifiers/AlignRotationModifier.php @@ -0,0 +1,12 @@ +handleInput( + $this->color ?: $driver->config()->blendingColor + ); + + // replace alpha channel value with opaque value + if ($color->isTransparent()) { + return new Color( + $color->channel(Red::class)->value(), + $color->channel(Green::class)->value(), + $color->channel(Blue::class)->value(), + ); + } + + return $color; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Modifiers/BlurModifier.php b/upLoadImage/vendor/intervention/image/src/Modifiers/BlurModifier.php new file mode 100644 index 0000000..4ae60d3 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Modifiers/BlurModifier.php @@ -0,0 +1,15 @@ +target)) { + return $this->target; + } + + if (in_array($this->target, ['rgb', 'RGB', RgbColorspace::class])) { + return new RgbColorspace(); + } + + if (in_array($this->target, ['cmyk', 'CMYK', CmykColorspace::class])) { + return new CmykColorspace(); + } + + throw new NotSupportedException('Given colorspace is not supported.'); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Modifiers/ContainModifier.php b/upLoadImage/vendor/intervention/image/src/Modifiers/ContainModifier.php new file mode 100644 index 0000000..90da85d --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Modifiers/ContainModifier.php @@ -0,0 +1,44 @@ +size() + ->contain( + $this->width, + $this->height + ) + ->alignPivotTo( + $this->getResizeSize($image), + $this->position + ); + } + + public function getResizeSize(ImageInterface $image): SizeInterface + { + return new Rectangle($this->width, $this->height); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Modifiers/ContrastModifier.php b/upLoadImage/vendor/intervention/image/src/Modifiers/ContrastModifier.php new file mode 100644 index 0000000..77f7b17 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Modifiers/ContrastModifier.php @@ -0,0 +1,20 @@ +size(); + $crop = new Rectangle($this->width, $this->height); + + return $crop->contain( + $imagesize->width(), + $imagesize->height() + )->alignPivotTo($imagesize, $this->position); + } + + /** + * @throws RuntimeException + */ + public function getResizeSize(SizeInterface $size): SizeInterface + { + return $size->resize($this->width, $this->height); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Modifiers/CropModifier.php b/upLoadImage/vendor/intervention/image/src/Modifiers/CropModifier.php new file mode 100644 index 0000000..c9aa585 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Modifiers/CropModifier.php @@ -0,0 +1,44 @@ +width, $this->height); + $crop->align($this->position); + + return $crop->alignPivotTo( + $image->size(), + $this->position + ); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Modifiers/DrawBezierModifier.php b/upLoadImage/vendor/intervention/image/src/Modifiers/DrawBezierModifier.php new file mode 100644 index 0000000..d4e14e3 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Modifiers/DrawBezierModifier.php @@ -0,0 +1,29 @@ +drawable; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Modifiers/DrawEllipseModifier.php b/upLoadImage/vendor/intervention/image/src/Modifiers/DrawEllipseModifier.php new file mode 100644 index 0000000..b32d5e0 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Modifiers/DrawEllipseModifier.php @@ -0,0 +1,21 @@ +drawable; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Modifiers/DrawLineModifier.php b/upLoadImage/vendor/intervention/image/src/Modifiers/DrawLineModifier.php new file mode 100644 index 0000000..26a86e3 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Modifiers/DrawLineModifier.php @@ -0,0 +1,29 @@ +drawable; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Modifiers/DrawPixelModifier.php b/upLoadImage/vendor/intervention/image/src/Modifiers/DrawPixelModifier.php new file mode 100644 index 0000000..3faeabc --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Modifiers/DrawPixelModifier.php @@ -0,0 +1,23 @@ +drawable; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Modifiers/DrawRectangleModifier.php b/upLoadImage/vendor/intervention/image/src/Modifiers/DrawRectangleModifier.php new file mode 100644 index 0000000..005b79a --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Modifiers/DrawRectangleModifier.php @@ -0,0 +1,29 @@ +drawable; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Modifiers/FillModifier.php b/upLoadImage/vendor/intervention/image/src/Modifiers/FillModifier.php new file mode 100644 index 0000000..d3f334d --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Modifiers/FillModifier.php @@ -0,0 +1,23 @@ +position instanceof PointInterface; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Modifiers/FlipModifier.php b/upLoadImage/vendor/intervention/image/src/Modifiers/FlipModifier.php new file mode 100644 index 0000000..8862f1d --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Modifiers/FlipModifier.php @@ -0,0 +1,12 @@ +size() + ->containMax( + $this->width, + $this->height + ) + ->alignPivotTo( + $this->getResizeSize($image), + $this->position + ); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Modifiers/PixelateModifier.php b/upLoadImage/vendor/intervention/image/src/Modifiers/PixelateModifier.php new file mode 100644 index 0000000..768fcce --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Modifiers/PixelateModifier.php @@ -0,0 +1,15 @@ +size()->movePivot( + $this->position, + $this->offset_x, + $this->offset_y + ); + + $watermark_size = $watermark->size()->movePivot( + $this->position + ); + + return $image_size->relativePositionTo($watermark_size); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Modifiers/ProfileModifier.php b/upLoadImage/vendor/intervention/image/src/Modifiers/ProfileModifier.php new file mode 100644 index 0000000..f784c95 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Modifiers/ProfileModifier.php @@ -0,0 +1,16 @@ +core()->frame($this->normalizePosition($image)); + } + + /** + * Return the position of the selected frame as integer + * + * @throws InputException + */ + protected function normalizePosition(ImageInterface $image): int + { + if (is_int($this->position)) { + return $this->position; + } + + if (is_numeric($this->position)) { + return (int) $this->position; + } + + // calculate position from percentage value + if (preg_match("/^(?P[0-9]{1,3})%$/", $this->position, $matches) != 1) { + throw new InputException( + 'Position must be either integer or a percent value as string.' + ); + } + + $total = count($image); + $position = intval(round($total / 100 * intval($matches['percent']))); + + return $position == $total ? $position - 1 : $position; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Modifiers/ResizeCanvasModifier.php b/upLoadImage/vendor/intervention/image/src/Modifiers/ResizeCanvasModifier.php new file mode 100644 index 0000000..ae42b7a --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Modifiers/ResizeCanvasModifier.php @@ -0,0 +1,49 @@ + new Rectangle( + is_null($this->width) ? $image->width() : $image->width() + $this->width, + is_null($this->height) ? $image->height() : $image->height() + $this->height, + ), + default => new Rectangle( + is_null($this->width) ? $image->width() : $this->width, + is_null($this->height) ? $image->height() : $this->height, + ), + }; + + return $size->alignPivotTo($image->size(), $this->position); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Modifiers/ResizeCanvasRelativeModifier.php b/upLoadImage/vendor/intervention/image/src/Modifiers/ResizeCanvasRelativeModifier.php new file mode 100644 index 0000000..bcc5fa8 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Modifiers/ResizeCanvasRelativeModifier.php @@ -0,0 +1,10 @@ +angle, 360); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Modifiers/ScaleDownModifier.php b/upLoadImage/vendor/intervention/image/src/Modifiers/ScaleDownModifier.php new file mode 100644 index 0000000..8fdfa9b --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Modifiers/ScaleDownModifier.php @@ -0,0 +1,10 @@ +driver()->handleInput($this->font->color()); + + if ($this->font->hasStrokeEffect() && $color->isTransparent()) { + throw new ColorException( + 'The text color must be fully opaque when using the stroke effect.' + ); + } + + return $color; + } + + /** + * Decode outline stroke color + * + * @throws RuntimeException + * @throws ColorException + */ + protected function strokeColor(): ColorInterface + { + $color = $this->driver()->handleInput($this->font->strokeColor()); + + if ($color->isTransparent()) { + throw new ColorException( + 'The stroke color must be fully opaque.' + ); + } + + return $color; + } + + /** + * Return array of offset points to draw text stroke effect below the actual text + * + * @return array + */ + protected function strokeOffsets(FontInterface $font): array + { + $offsets = []; + + if ($font->strokeWidth() <= 0) { + return $offsets; + } + + for ($x = $font->strokeWidth() * -1; $x <= $font->strokeWidth(); $x++) { + for ($y = $font->strokeWidth() * -1; $y <= $font->strokeWidth(); $y++) { + $offsets[] = new Point($x, $y); + } + } + + return $offsets; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Modifiers/TrimModifier.php b/upLoadImage/vendor/intervention/image/src/Modifiers/TrimModifier.php new file mode 100644 index 0000000..6d7959b --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Modifiers/TrimModifier.php @@ -0,0 +1,20 @@ +mediaType; + } + + /** + * Alias of self::mediaType() + */ + public function mimetype(): string + { + return $this->mediaType(); + } + + /** + * Set media type of current instance + */ + public function setMediaType(string|MediaType $type): self + { + $this->mediaType = match (true) { + is_string($type) => $type, + default => $type->value, + }; + + return $this; + } + + /** + * Return file path of origin + */ + public function filePath(): ?string + { + return $this->filePath; + } + + /** + * Set file path for origin + */ + public function setFilePath(string $path): self + { + $this->filePath = $path; + + return $this; + } + + /** + * Return file extension if origin was created from file path + */ + public function fileExtension(): ?string + { + return pathinfo($this->filePath ?: '', PATHINFO_EXTENSION) ?: null; + } + + /** + * Show debug info for the current image + * + * @return array + */ + public function __debugInfo(): array + { + return [ + 'mediaType' => $this->mediaType(), + 'filePath' => $this->filePath(), + ]; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Resolution.php b/upLoadImage/vendor/intervention/image/src/Resolution.php new file mode 100644 index 0000000..64ab07c --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Resolution.php @@ -0,0 +1,162 @@ + + */ +class Resolution implements ResolutionInterface, Stringable, IteratorAggregate +{ + public const PER_INCH = 1; + public const PER_CM = 2; + + /** + * Create new instance + */ + public function __construct( + protected float $x, + protected float $y, + protected int $per_unit = self::PER_INCH + ) { + // + } + + /** + * {@inheritdoc} + * + * @see IteratorAggregate::getIterator() + */ + public function getIterator(): Traversable + { + return new ArrayIterator([$this->x, $this->y]); + } + + /** + * {@inheritdoc} + * + * @see ResolutionInterface::x() + */ + public function x(): float + { + return $this->x; + } + + /** + * {@inheritdoc} + * + * @see ResolutionInterface::setX() + */ + public function setX(float $x): self + { + $this->x = $x; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see ResolutionInterface::y() + */ + public function y(): float + { + return $this->y; + } + + /** + * {@inheritdoc} + * + * @see ResolutionInterface::setY() + */ + public function setY(float $y): self + { + $this->y = $y; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see ResolutionInterface::setPerUnit() + */ + protected function setPerUnit(int $per_unit): self + { + $this->per_unit = $per_unit; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see ResolutionInterface::unit() + */ + public function unit(): string + { + return match ($this->per_unit) { + self::PER_CM => 'dpcm', + default => 'dpi', + }; + } + + /** + * {@inheritdoc} + * + * @see ResolutionInterface::perInch() + */ + public function perInch(): self + { + return match ($this->per_unit) { + self::PER_CM => $this + ->setPerUnit(self::PER_INCH) + ->setX($this->x * 2.54) + ->setY($this->y * 2.54), + default => $this + }; + } + + /** + * {@inheritdoc} + * + * @see ResolutionInterface::perCm() + */ + public function perCm(): self + { + return match ($this->per_unit) { + self::PER_INCH => $this + ->setPerUnit(self::PER_CM) + ->setX($this->x / 2.54) + ->setY($this->y / 2.54), + default => $this, + }; + } + + /** + * {@inheritdoc} + * + * @see ResolutionInterface::toString() + */ + public function toString(): string + { + return sprintf("%1\$.2f x %2\$.2f %3\$s", $this->x, $this->y, $this->unit()); + } + + /** + * {@inheritdoc} + * + * @see ResolutionInterface::__toString() + */ + public function __toString(): string + { + return $this->toString(); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Traits/CanBeDriverSpecialized.php b/upLoadImage/vendor/intervention/image/src/Traits/CanBeDriverSpecialized.php new file mode 100644 index 0000000..efa5622 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Traits/CanBeDriverSpecialized.php @@ -0,0 +1,77 @@ +getConstructor()) { + foreach ($constructor->getParameters() as $parameter) { + $specializable[$parameter->getName()] = $this->{$parameter->getName()}; + } + } + + return $specializable; + } + + /** + * {@inheritdoc} + * + * @see SpecializableInterface::driver() + */ + public function driver(): DriverInterface + { + return $this->driver; + } + + /** + * {@inheritdoc} + * + * @see SpecializableInterface::setDriver() + */ + public function setDriver(DriverInterface $driver): SpecializableInterface + { + if (!$this->belongsToDriver($driver)) { + throw new DriverException( + "Class '" . $this::class . "' can not be used with " . $driver->id() . " driver." + ); + } + + $this->driver = $driver; + + return $this; + } + + /** + * Determine if the current object belongs to the given driver's namespace + */ + protected function belongsToDriver(object $driver): bool + { + $namespace = function (object $object): string { + return (new ReflectionClass($object))->getNamespaceName(); + }; + + return str_starts_with($namespace($this), $namespace($driver)); + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Traits/CanBuildFilePointer.php b/upLoadImage/vendor/intervention/image/src/Traits/CanBuildFilePointer.php new file mode 100644 index 0000000..29d613d --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Traits/CanBuildFilePointer.php @@ -0,0 +1,42 @@ +filename = $filename; + } + + /** + * {@inheritdoc} + * + * @see FontInterface::setSize() + */ + public function setSize(float $size): FontInterface + { + $this->size = $size; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see FontInterface::size() + */ + public function size(): float + { + return $this->size; + } + + /** + * {@inheritdoc} + * + * @see FontInterface::setAngle() + */ + public function setAngle(float $angle): FontInterface + { + $this->angle = $angle; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see FontInterface::angle() + */ + public function angle(): float + { + return $this->angle; + } + + /** + * {@inheritdoc} + * + * @see FontInterface::setFilename() + * + * @throws FontException + */ + public function setFilename(string $filename): FontInterface + { + if (!file_exists($filename)) { + throw new FontException('Font file ' . $filename . ' does not exist.'); + } + + $this->filename = $filename; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see FontInterface::filename() + */ + public function filename(): ?string + { + return $this->filename; + } + + /** + * {@inheritdoc} + * + * @see FontInterface::hasFilename() + */ + public function hasFilename(): bool + { + return !is_null($this->filename) && is_file($this->filename); + } + + /** + * {@inheritdoc} + * + * @see FontInterface::setColor() + */ + public function setColor(mixed $color): FontInterface + { + $this->color = $color; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see FontInterface::color() + */ + public function color(): mixed + { + return $this->color; + } + + /** + * {@inheritdoc} + * + * @see FontInterface::setStrokeColor() + */ + public function setStrokeColor(mixed $color): FontInterface + { + $this->strokeColor = $color; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see FontInterface::strokeColor() + */ + public function strokeColor(): mixed + { + return $this->strokeColor; + } + + /** + * {@inheritdoc} + * + * @see FontInterface::setStrokeWidth() + */ + public function setStrokeWidth(int $width): FontInterface + { + if (!in_array($width, range(0, 10))) { + throw new FontException( + 'The stroke width must be in the range from 0 to 10.' + ); + } + + $this->strokeWidth = $width; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see FontInterface::strokeWidth() + */ + public function strokeWidth(): int + { + return $this->strokeWidth; + } + + /** + * {@inheritdoc} + * + * @see FontInterface::hasStrokeEffect() + */ + public function hasStrokeEffect(): bool + { + return $this->strokeWidth > 0; + } + + /** + * {@inheritdoc} + * + * @see FontInterface::alignment() + */ + public function alignment(): string + { + return $this->alignment; + } + + /** + * {@inheritdoc} + * + * @see FontInterface::setAlignment() + */ + public function setAlignment(string $value): FontInterface + { + $this->alignment = $value; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see FontInterface::valignment() + */ + public function valignment(): string + { + return $this->valignment; + } + + /** + * {@inheritdoc} + * + * @see FontInterface::setValignment() + */ + public function setValignment(string $value): FontInterface + { + $this->valignment = $value; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see FontInterface::setLineHeight() + */ + public function setLineHeight(float $height): FontInterface + { + $this->lineHeight = $height; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see FontInterface::lineHeight() + */ + public function lineHeight(): float + { + return $this->lineHeight; + } + + /** + * {@inheritdoc} + * + * @see FontInterface::setWrapWidth() + */ + public function setWrapWidth(?int $width): FontInterface + { + $this->wrapWidth = $width; + + return $this; + } + + /** + * {@inheritdoc} + * + * @see FontInterface::wrapWidth() + */ + public function wrapWidth(): ?int + { + return $this->wrapWidth; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Typography/FontFactory.php b/upLoadImage/vendor/intervention/image/src/Typography/FontFactory.php new file mode 100644 index 0000000..7259012 --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Typography/FontFactory.php @@ -0,0 +1,141 @@ +font = is_a($init, FontInterface::class) ? $init : new Font(); + + if (is_callable($init)) { + $init($this); + } + } + + /** + * Set the filename of the font to be built + */ + public function filename(string $value): self + { + $this->font->setFilename($value); + + return $this; + } + + /** + * {@inheritdoc} + * + * @see self::filename() + */ + public function file(string $value): self + { + return $this->filename($value); + } + + /** + * Set outline stroke effect for the font to be built + * + * @throws FontException + */ + public function stroke(mixed $color, int $width = 1): self + { + $this->font->setStrokeWidth($width); + $this->font->setStrokeColor($color); + + return $this; + } + + /** + * Set color for the font to be built + */ + public function color(mixed $value): self + { + $this->font->setColor($value); + + return $this; + } + + /** + * Set the size for the font to be built + */ + public function size(float $value): self + { + $this->font->setSize($value); + + return $this; + } + + /** + * Set the horizontal alignment of the font to be built + */ + public function align(string $value): self + { + $this->font->setAlignment($value); + + return $this; + } + + /** + * Set the vertical alignment of the font to be built + */ + public function valign(string $value): self + { + $this->font->setValignment($value); + + return $this; + } + + /** + * Set the line height of the font to be built + */ + public function lineHeight(float $value): self + { + $this->font->setLineHeight($value); + + return $this; + } + + /** + * Set the rotation angle of the font to be built + */ + public function angle(float $value): self + { + $this->font->setAngle($value); + + return $this; + } + + /** + * Set the maximum width of the text block to be built + */ + public function wrap(int $width): self + { + $this->font->setWrapWidth($width); + + return $this; + } + + /** + * Build font + */ + public function __invoke(): FontInterface + { + return $this->font; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Typography/Line.php b/upLoadImage/vendor/intervention/image/src/Typography/Line.php new file mode 100644 index 0000000..e820dfc --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Typography/Line.php @@ -0,0 +1,125 @@ + + */ +class Line implements IteratorAggregate, Countable, Stringable +{ + /** + * Segments (usually individual words including punctuation marks) of the line + * + * @var array + */ + protected array $segments = []; + + /** + * Create new text line object with given text & position + * + * @return void + */ + public function __construct( + ?string $text = null, + protected PointInterface $position = new Point() + ) { + if (is_string($text)) { + $this->segments = $this->wordsSeperatedBySpaces($text) ? explode(" ", $text) : mb_str_split($text); + } + } + + /** + * Add word to current line + */ + public function add(string $word): self + { + $this->segments[] = $word; + + return $this; + } + + /** + * Returns Iterator + * + * @return Traversable + */ + public function getIterator(): Traversable + { + return new ArrayIterator($this->segments); + } + + /** + * Get Position of line + */ + public function position(): PointInterface + { + return $this->position; + } + + /** + * Set position of current line + */ + public function setPosition(PointInterface $point): self + { + $this->position = $point; + + return $this; + } + + /** + * Count segments (individual words including punctuation marks) of line + */ + public function count(): int + { + return count($this->segments); + } + + /** + * Count characters of line + */ + public function length(): int + { + return mb_strlen((string) $this); + } + + /** + * Dermine if words are sperarated by spaces in the written language of the given text + */ + private function wordsSeperatedBySpaces(string $text): bool + { + return 1 !== preg_match( + '/[' . + '\x{4E00}-\x{9FFF}' . // CJK Unified Ideographs (chinese) + '\x{3400}-\x{4DBF}' . // CJK Unified Ideographs Extension A (chinese) + '\x{3040}-\x{309F}' . // hiragana (japanese) + '\x{30A0}-\x{30FF}' . // katakana (japanese) + '\x{0E00}-\x{0E7F}' . // thai + ']/u', + $text + ); + } + + /** + * Cast line to string + */ + public function __toString(): string + { + $string = implode("", $this->segments); + + if ($this->wordsSeperatedBySpaces($string)) { + return implode(" ", $this->segments); + } + + return $string; + } +} diff --git a/upLoadImage/vendor/intervention/image/src/Typography/TextBlock.php b/upLoadImage/vendor/intervention/image/src/Typography/TextBlock.php new file mode 100644 index 0000000..09d109b --- /dev/null +++ b/upLoadImage/vendor/intervention/image/src/Typography/TextBlock.php @@ -0,0 +1,72 @@ +push(new Line($line)); + } + } + + /** + * Return array of lines in text block + * + * @return array + */ + public function lines(): array + { + return $this->items; + } + + /** + * Set lines of the text block + * + * @param array $lines + */ + public function setLines(array $lines): self + { + $this->items = $lines; + + return $this; + } + + /** + * Get line by given key + */ + public function line(mixed $key): ?Line + { + if (!array_key_exists($key, $this->lines())) { + return null; + } + + return $this->lines()[$key]; + } + + /** + * Return line with most characters of text block + */ + public function longestLine(): Line + { + $lines = $this->lines(); + usort($lines, function (Line $a, Line $b): int { + if ($a->length() === $b->length()) { + return 0; + } + return $a->length() > $b->length() ? -1 : 1; + }); + + return $lines[0]; + } +} diff --git a/upLoadImage/vendor/symfony/deprecation-contracts/CHANGELOG.md b/upLoadImage/vendor/symfony/deprecation-contracts/CHANGELOG.md new file mode 100644 index 0000000..7932e26 --- /dev/null +++ b/upLoadImage/vendor/symfony/deprecation-contracts/CHANGELOG.md @@ -0,0 +1,5 @@ +CHANGELOG +========= + +The changelog is maintained for all Symfony contracts at the following URL: +https://github.com/symfony/contracts/blob/main/CHANGELOG.md diff --git a/upLoadImage/vendor/symfony/deprecation-contracts/LICENSE b/upLoadImage/vendor/symfony/deprecation-contracts/LICENSE new file mode 100644 index 0000000..0ed3a24 --- /dev/null +++ b/upLoadImage/vendor/symfony/deprecation-contracts/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2020-present Fabien Potencier + +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. diff --git a/upLoadImage/vendor/symfony/deprecation-contracts/README.md b/upLoadImage/vendor/symfony/deprecation-contracts/README.md new file mode 100644 index 0000000..9814864 --- /dev/null +++ b/upLoadImage/vendor/symfony/deprecation-contracts/README.md @@ -0,0 +1,26 @@ +Symfony Deprecation Contracts +============================= + +A generic function and convention to trigger deprecation notices. + +This package provides a single global function named `trigger_deprecation()` that triggers silenced deprecation notices. + +By using a custom PHP error handler such as the one provided by the Symfony ErrorHandler component, +the triggered deprecations can be caught and logged for later discovery, both on dev and prod environments. + +The function requires at least 3 arguments: + - the name of the Composer package that is triggering the deprecation + - the version of the package that introduced the deprecation + - the message of the deprecation + - more arguments can be provided: they will be inserted in the message using `printf()` formatting + +Example: +```php +trigger_deprecation('symfony/blockchain', '8.9', 'Using "%s" is deprecated, use "%s" instead.', 'bitcoin', 'fabcoin'); +``` + +This will generate the following message: +`Since symfony/blockchain 8.9: Using "bitcoin" is deprecated, use "fabcoin" instead.` + +While not recommended, the deprecation notices can be completely ignored by declaring an empty +`function trigger_deprecation() {}` in your application. diff --git a/upLoadImage/vendor/symfony/deprecation-contracts/composer.json b/upLoadImage/vendor/symfony/deprecation-contracts/composer.json new file mode 100644 index 0000000..5533b5c --- /dev/null +++ b/upLoadImage/vendor/symfony/deprecation-contracts/composer.json @@ -0,0 +1,35 @@ +{ + "name": "symfony/deprecation-contracts", + "type": "library", + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=8.1" + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "minimum-stability": "dev", + "extra": { + "branch-alias": { + "dev-main": "3.6-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + } +} diff --git a/upLoadImage/vendor/symfony/deprecation-contracts/function.php b/upLoadImage/vendor/symfony/deprecation-contracts/function.php new file mode 100644 index 0000000..2d56512 --- /dev/null +++ b/upLoadImage/vendor/symfony/deprecation-contracts/function.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +if (!function_exists('trigger_deprecation')) { + /** + * Triggers a silenced deprecation notice. + * + * @param string $package The name of the Composer package that is triggering the deprecation + * @param string $version The version of the package that introduced the deprecation + * @param string $message The message of the deprecation + * @param mixed ...$args Values to insert in the message using printf() formatting + * + * @author Nicolas Grekas + */ + function trigger_deprecation(string $package, string $version, string $message, mixed ...$args): void + { + @trigger_error(($package || $version ? "Since $package $version: " : '').($args ? vsprintf($message, $args) : $message), \E_USER_DEPRECATED); + } +} diff --git a/upLoadImage/vendor/symfony/polyfill-mbstring/LICENSE b/upLoadImage/vendor/symfony/polyfill-mbstring/LICENSE new file mode 100644 index 0000000..6e3afce --- /dev/null +++ b/upLoadImage/vendor/symfony/polyfill-mbstring/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015-present Fabien Potencier + +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. diff --git a/upLoadImage/vendor/symfony/polyfill-mbstring/Mbstring.php b/upLoadImage/vendor/symfony/polyfill-mbstring/Mbstring.php new file mode 100644 index 0000000..31e36a3 --- /dev/null +++ b/upLoadImage/vendor/symfony/polyfill-mbstring/Mbstring.php @@ -0,0 +1,1045 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Mbstring; + +/** + * Partial mbstring implementation in PHP, iconv based, UTF-8 centric. + * + * Implemented: + * - mb_chr - Returns a specific character from its Unicode code point + * - mb_convert_encoding - Convert character encoding + * - mb_convert_variables - Convert character code in variable(s) + * - mb_decode_mimeheader - Decode string in MIME header field + * - mb_encode_mimeheader - Encode string for MIME header XXX NATIVE IMPLEMENTATION IS REALLY BUGGED + * - mb_decode_numericentity - Decode HTML numeric string reference to character + * - mb_encode_numericentity - Encode character to HTML numeric string reference + * - mb_convert_case - Perform case folding on a string + * - mb_detect_encoding - Detect character encoding + * - mb_get_info - Get internal settings of mbstring + * - mb_http_input - Detect HTTP input character encoding + * - mb_http_output - Set/Get HTTP output character encoding + * - mb_internal_encoding - Set/Get internal character encoding + * - mb_list_encodings - Returns an array of all supported encodings + * - mb_ord - Returns the Unicode code point of a character + * - mb_output_handler - Callback function converts character encoding in output buffer + * - mb_scrub - Replaces ill-formed byte sequences with substitute characters + * - mb_strlen - Get string length + * - mb_strpos - Find position of first occurrence of string in a string + * - mb_strrpos - Find position of last occurrence of a string in a string + * - mb_str_split - Convert a string to an array + * - mb_strtolower - Make a string lowercase + * - mb_strtoupper - Make a string uppercase + * - mb_substitute_character - Set/Get substitution character + * - mb_substr - Get part of string + * - mb_stripos - Finds position of first occurrence of a string within another, case insensitive + * - mb_stristr - Finds first occurrence of a string within another, case insensitive + * - mb_strrchr - Finds the last occurrence of a character in a string within another + * - mb_strrichr - Finds the last occurrence of a character in a string within another, case insensitive + * - mb_strripos - Finds position of last occurrence of a string within another, case insensitive + * - mb_strstr - Finds first occurrence of a string within another + * - mb_strwidth - Return width of string + * - mb_substr_count - Count the number of substring occurrences + * - mb_ucfirst - Make a string's first character uppercase + * - mb_lcfirst - Make a string's first character lowercase + * - mb_trim - Strip whitespace (or other characters) from the beginning and end of a string + * - mb_ltrim - Strip whitespace (or other characters) from the beginning of a string + * - mb_rtrim - Strip whitespace (or other characters) from the end of a string + * + * Not implemented: + * - mb_convert_kana - Convert "kana" one from another ("zen-kaku", "han-kaku" and more) + * - mb_ereg_* - Regular expression with multibyte support + * - mb_parse_str - Parse GET/POST/COOKIE data and set global variable + * - mb_preferred_mime_name - Get MIME charset string + * - mb_regex_encoding - Returns current encoding for multibyte regex as string + * - mb_regex_set_options - Set/Get the default options for mbregex functions + * - mb_send_mail - Send encoded mail + * - mb_split - Split multibyte string using regular expression + * - mb_strcut - Get part of string + * - mb_strimwidth - Get truncated string with specified width + * + * @author Nicolas Grekas + * + * @internal + */ +final class Mbstring +{ + public const MB_CASE_FOLD = \PHP_INT_MAX; + + private const SIMPLE_CASE_FOLD = [ + ['µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"], + ['μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι'], + ]; + + private static $encodingList = ['ASCII', 'UTF-8']; + private static $language = 'neutral'; + private static $internalEncoding = 'UTF-8'; + + public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null) + { + if (\is_array($s)) { + $r = []; + foreach ($s as $str) { + $r[] = self::mb_convert_encoding($str, $toEncoding, $fromEncoding); + } + + return $r; + } + + if (\is_array($fromEncoding) || (null !== $fromEncoding && false !== strpos($fromEncoding, ','))) { + $fromEncoding = self::mb_detect_encoding($s, $fromEncoding); + } else { + $fromEncoding = self::getEncoding($fromEncoding); + } + + $toEncoding = self::getEncoding($toEncoding); + + if ('BASE64' === $fromEncoding) { + $s = base64_decode($s); + $fromEncoding = $toEncoding; + } + + if ('BASE64' === $toEncoding) { + return base64_encode($s); + } + + if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) { + if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) { + $fromEncoding = 'Windows-1252'; + } + if ('UTF-8' !== $fromEncoding) { + $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s); + } + + return preg_replace_callback('/[\x80-\xFF]+/', [__CLASS__, 'html_encoding_callback'], $s); + } + + if ('HTML-ENTITIES' === $fromEncoding) { + $s = html_entity_decode($s, \ENT_COMPAT, 'UTF-8'); + $fromEncoding = 'UTF-8'; + } + + return iconv($fromEncoding, $toEncoding.'//IGNORE', $s); + } + + public static function mb_convert_variables($toEncoding, $fromEncoding, &...$vars) + { + $ok = true; + array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) { + if (false === $v = self::mb_convert_encoding($v, $toEncoding, $fromEncoding)) { + $ok = false; + } + }); + + return $ok ? $fromEncoding : false; + } + + public static function mb_decode_mimeheader($s) + { + return iconv_mime_decode($s, 2, self::$internalEncoding); + } + + public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null) + { + trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', \E_USER_WARNING); + } + + public static function mb_decode_numericentity($s, $convmap, $encoding = null) + { + if (null !== $s && !\is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) { + trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING); + + return null; + } + + if (!\is_array($convmap) || (80000 > \PHP_VERSION_ID && !$convmap)) { + return false; + } + + if (null !== $encoding && !\is_scalar($encoding)) { + trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING); + + return ''; // Instead of null (cf. mb_encode_numericentity). + } + + $s = (string) $s; + if ('' === $s) { + return ''; + } + + $encoding = self::getEncoding($encoding); + + if ('UTF-8' === $encoding) { + $encoding = null; + if (!preg_match('//u', $s)) { + $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s); + } + } else { + $s = iconv($encoding, 'UTF-8//IGNORE', $s); + } + + $cnt = floor(\count($convmap) / 4) * 4; + + for ($i = 0; $i < $cnt; $i += 4) { + // collector_decode_htmlnumericentity ignores $convmap[$i + 3] + $convmap[$i] += $convmap[$i + 2]; + $convmap[$i + 1] += $convmap[$i + 2]; + } + + $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) { + $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1]; + for ($i = 0; $i < $cnt; $i += 4) { + if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) { + return self::mb_chr($c - $convmap[$i + 2]); + } + } + + return $m[0]; + }, $s); + + if (null === $encoding) { + return $s; + } + + return iconv('UTF-8', $encoding.'//IGNORE', $s); + } + + public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false) + { + if (null !== $s && !\is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) { + trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING); + + return null; + } + + if (!\is_array($convmap) || (80000 > \PHP_VERSION_ID && !$convmap)) { + return false; + } + + if (null !== $encoding && !\is_scalar($encoding)) { + trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING); + + return null; // Instead of '' (cf. mb_decode_numericentity). + } + + if (null !== $is_hex && !\is_scalar($is_hex)) { + trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', \E_USER_WARNING); + + return null; + } + + $s = (string) $s; + if ('' === $s) { + return ''; + } + + $encoding = self::getEncoding($encoding); + + if ('UTF-8' === $encoding) { + $encoding = null; + if (!preg_match('//u', $s)) { + $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s); + } + } else { + $s = iconv($encoding, 'UTF-8//IGNORE', $s); + } + + static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4]; + + $cnt = floor(\count($convmap) / 4) * 4; + $i = 0; + $len = \strlen($s); + $result = ''; + + while ($i < $len) { + $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"]; + $uchr = substr($s, $i, $ulen); + $i += $ulen; + $c = self::mb_ord($uchr); + + for ($j = 0; $j < $cnt; $j += 4) { + if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) { + $cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3]; + $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';'; + continue 2; + } + } + $result .= $uchr; + } + + if (null === $encoding) { + return $result; + } + + return iconv('UTF-8', $encoding.'//IGNORE', $result); + } + + public static function mb_convert_case($s, $mode, $encoding = null) + { + $s = (string) $s; + if ('' === $s) { + return ''; + } + + $encoding = self::getEncoding($encoding); + + if ('UTF-8' === $encoding) { + $encoding = null; + if (!preg_match('//u', $s)) { + $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s); + } + } else { + $s = iconv($encoding, 'UTF-8//IGNORE', $s); + } + + if (\MB_CASE_TITLE == $mode) { + static $titleRegexp = null; + if (null === $titleRegexp) { + $titleRegexp = self::getData('titleCaseRegexp'); + } + $s = preg_replace_callback($titleRegexp, [__CLASS__, 'title_case'], $s); + } else { + if (\MB_CASE_UPPER == $mode) { + static $upper = null; + if (null === $upper) { + $upper = self::getData('upperCase'); + } + $map = $upper; + } else { + if (self::MB_CASE_FOLD === $mode) { + static $caseFolding = null; + if (null === $caseFolding) { + $caseFolding = self::getData('caseFolding'); + } + $s = strtr($s, $caseFolding); + } + + static $lower = null; + if (null === $lower) { + $lower = self::getData('lowerCase'); + } + $map = $lower; + } + + static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4]; + + $i = 0; + $len = \strlen($s); + + while ($i < $len) { + $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"]; + $uchr = substr($s, $i, $ulen); + $i += $ulen; + + if (isset($map[$uchr])) { + $uchr = $map[$uchr]; + $nlen = \strlen($uchr); + + if ($nlen == $ulen) { + $nlen = $i; + do { + $s[--$nlen] = $uchr[--$ulen]; + } while ($ulen); + } else { + $s = substr_replace($s, $uchr, $i - $ulen, $ulen); + $len += $nlen - $ulen; + $i += $nlen - $ulen; + } + } + } + } + + if (null === $encoding) { + return $s; + } + + return iconv('UTF-8', $encoding.'//IGNORE', $s); + } + + public static function mb_internal_encoding($encoding = null) + { + if (null === $encoding) { + return self::$internalEncoding; + } + + $normalizedEncoding = self::getEncoding($encoding); + + if ('UTF-8' === $normalizedEncoding || false !== @iconv($normalizedEncoding, $normalizedEncoding, ' ')) { + self::$internalEncoding = $normalizedEncoding; + + return true; + } + + if (80000 > \PHP_VERSION_ID) { + return false; + } + + throw new \ValueError(sprintf('Argument #1 ($encoding) must be a valid encoding, "%s" given', $encoding)); + } + + public static function mb_language($lang = null) + { + if (null === $lang) { + return self::$language; + } + + switch ($normalizedLang = strtolower($lang)) { + case 'uni': + case 'neutral': + self::$language = $normalizedLang; + + return true; + } + + if (80000 > \PHP_VERSION_ID) { + return false; + } + + throw new \ValueError(sprintf('Argument #1 ($language) must be a valid language, "%s" given', $lang)); + } + + public static function mb_list_encodings() + { + return ['UTF-8']; + } + + public static function mb_encoding_aliases($encoding) + { + switch (strtoupper($encoding)) { + case 'UTF8': + case 'UTF-8': + return ['utf8']; + } + + return false; + } + + public static function mb_check_encoding($var = null, $encoding = null) + { + if (null === $encoding) { + if (null === $var) { + return false; + } + $encoding = self::$internalEncoding; + } + + if (!\is_array($var)) { + return self::mb_detect_encoding($var, [$encoding]) || false !== @iconv($encoding, $encoding, $var); + } + + foreach ($var as $key => $value) { + if (!self::mb_check_encoding($key, $encoding)) { + return false; + } + if (!self::mb_check_encoding($value, $encoding)) { + return false; + } + } + + return true; + } + + public static function mb_detect_encoding($str, $encodingList = null, $strict = false) + { + if (null === $encodingList) { + $encodingList = self::$encodingList; + } else { + if (!\is_array($encodingList)) { + $encodingList = array_map('trim', explode(',', $encodingList)); + } + $encodingList = array_map('strtoupper', $encodingList); + } + + foreach ($encodingList as $enc) { + switch ($enc) { + case 'ASCII': + if (!preg_match('/[\x80-\xFF]/', $str)) { + return $enc; + } + break; + + case 'UTF8': + case 'UTF-8': + if (preg_match('//u', $str)) { + return 'UTF-8'; + } + break; + + default: + if (0 === strncmp($enc, 'ISO-8859-', 9)) { + return $enc; + } + } + } + + return false; + } + + public static function mb_detect_order($encodingList = null) + { + if (null === $encodingList) { + return self::$encodingList; + } + + if (!\is_array($encodingList)) { + $encodingList = array_map('trim', explode(',', $encodingList)); + } + $encodingList = array_map('strtoupper', $encodingList); + + foreach ($encodingList as $enc) { + switch ($enc) { + default: + if (strncmp($enc, 'ISO-8859-', 9)) { + return false; + } + // no break + case 'ASCII': + case 'UTF8': + case 'UTF-8': + } + } + + self::$encodingList = $encodingList; + + return true; + } + + public static function mb_strlen($s, $encoding = null) + { + $encoding = self::getEncoding($encoding); + if ('CP850' === $encoding || 'ASCII' === $encoding) { + return \strlen($s); + } + + return @iconv_strlen($s, $encoding); + } + + public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) + { + $encoding = self::getEncoding($encoding); + if ('CP850' === $encoding || 'ASCII' === $encoding) { + return strpos($haystack, $needle, $offset); + } + + $needle = (string) $needle; + if ('' === $needle) { + if (80000 > \PHP_VERSION_ID) { + trigger_error(__METHOD__.': Empty delimiter', \E_USER_WARNING); + + return false; + } + + return 0; + } + + return iconv_strpos($haystack, $needle, $offset, $encoding); + } + + public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) + { + $encoding = self::getEncoding($encoding); + if ('CP850' === $encoding || 'ASCII' === $encoding) { + return strrpos($haystack, $needle, $offset); + } + + if ($offset != (int) $offset) { + $offset = 0; + } elseif ($offset = (int) $offset) { + if ($offset < 0) { + if (0 > $offset += self::mb_strlen($needle)) { + $haystack = self::mb_substr($haystack, 0, $offset, $encoding); + } + $offset = 0; + } else { + $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding); + } + } + + $pos = '' !== $needle || 80000 > \PHP_VERSION_ID + ? iconv_strrpos($haystack, $needle, $encoding) + : self::mb_strlen($haystack, $encoding); + + return false !== $pos ? $offset + $pos : false; + } + + public static function mb_str_split($string, $split_length = 1, $encoding = null) + { + if (null !== $string && !\is_scalar($string) && !(\is_object($string) && method_exists($string, '__toString'))) { + trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', \E_USER_WARNING); + + return null; + } + + if (1 > $split_length = (int) $split_length) { + if (80000 > \PHP_VERSION_ID) { + trigger_error('The length of each segment must be greater than zero', \E_USER_WARNING); + + return false; + } + + throw new \ValueError('Argument #2 ($length) must be greater than 0'); + } + + if (null === $encoding) { + $encoding = mb_internal_encoding(); + } + + if ('UTF-8' === $encoding = self::getEncoding($encoding)) { + $rx = '/('; + while (65535 < $split_length) { + $rx .= '.{65535}'; + $split_length -= 65535; + } + $rx .= '.{'.$split_length.'})/us'; + + return preg_split($rx, $string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY); + } + + $result = []; + $length = mb_strlen($string, $encoding); + + for ($i = 0; $i < $length; $i += $split_length) { + $result[] = mb_substr($string, $i, $split_length, $encoding); + } + + return $result; + } + + public static function mb_strtolower($s, $encoding = null) + { + return self::mb_convert_case($s, \MB_CASE_LOWER, $encoding); + } + + public static function mb_strtoupper($s, $encoding = null) + { + return self::mb_convert_case($s, \MB_CASE_UPPER, $encoding); + } + + public static function mb_substitute_character($c = null) + { + if (null === $c) { + return 'none'; + } + if (0 === strcasecmp($c, 'none')) { + return true; + } + if (80000 > \PHP_VERSION_ID) { + return false; + } + if (\is_int($c) || 'long' === $c || 'entity' === $c) { + return false; + } + + throw new \ValueError('Argument #1 ($substitute_character) must be "none", "long", "entity" or a valid codepoint'); + } + + public static function mb_substr($s, $start, $length = null, $encoding = null) + { + $encoding = self::getEncoding($encoding); + if ('CP850' === $encoding || 'ASCII' === $encoding) { + return (string) substr($s, $start, null === $length ? 2147483647 : $length); + } + + if ($start < 0) { + $start = iconv_strlen($s, $encoding) + $start; + if ($start < 0) { + $start = 0; + } + } + + if (null === $length) { + $length = 2147483647; + } elseif ($length < 0) { + $length = iconv_strlen($s, $encoding) + $length - $start; + if ($length < 0) { + return ''; + } + } + + return (string) iconv_substr($s, $start, $length, $encoding); + } + + public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) + { + [$haystack, $needle] = str_replace(self::SIMPLE_CASE_FOLD[0], self::SIMPLE_CASE_FOLD[1], [ + self::mb_convert_case($haystack, \MB_CASE_LOWER, $encoding), + self::mb_convert_case($needle, \MB_CASE_LOWER, $encoding), + ]); + + return self::mb_strpos($haystack, $needle, $offset, $encoding); + } + + public static function mb_stristr($haystack, $needle, $part = false, $encoding = null) + { + $pos = self::mb_stripos($haystack, $needle, 0, $encoding); + + return self::getSubpart($pos, $part, $haystack, $encoding); + } + + public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null) + { + $encoding = self::getEncoding($encoding); + if ('CP850' === $encoding || 'ASCII' === $encoding) { + $pos = strrpos($haystack, $needle); + } else { + $needle = self::mb_substr($needle, 0, 1, $encoding); + $pos = iconv_strrpos($haystack, $needle, $encoding); + } + + return self::getSubpart($pos, $part, $haystack, $encoding); + } + + public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null) + { + $needle = self::mb_substr($needle, 0, 1, $encoding); + $pos = self::mb_strripos($haystack, $needle, $encoding); + + return self::getSubpart($pos, $part, $haystack, $encoding); + } + + public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) + { + $haystack = self::mb_convert_case($haystack, \MB_CASE_LOWER, $encoding); + $needle = self::mb_convert_case($needle, \MB_CASE_LOWER, $encoding); + + $haystack = str_replace(self::SIMPLE_CASE_FOLD[0], self::SIMPLE_CASE_FOLD[1], $haystack); + $needle = str_replace(self::SIMPLE_CASE_FOLD[0], self::SIMPLE_CASE_FOLD[1], $needle); + + return self::mb_strrpos($haystack, $needle, $offset, $encoding); + } + + public static function mb_strstr($haystack, $needle, $part = false, $encoding = null) + { + $pos = strpos($haystack, $needle); + if (false === $pos) { + return false; + } + if ($part) { + return substr($haystack, 0, $pos); + } + + return substr($haystack, $pos); + } + + public static function mb_get_info($type = 'all') + { + $info = [ + 'internal_encoding' => self::$internalEncoding, + 'http_output' => 'pass', + 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)', + 'func_overload' => 0, + 'func_overload_list' => 'no overload', + 'mail_charset' => 'UTF-8', + 'mail_header_encoding' => 'BASE64', + 'mail_body_encoding' => 'BASE64', + 'illegal_chars' => 0, + 'encoding_translation' => 'Off', + 'language' => self::$language, + 'detect_order' => self::$encodingList, + 'substitute_character' => 'none', + 'strict_detection' => 'Off', + ]; + + if ('all' === $type) { + return $info; + } + if (isset($info[$type])) { + return $info[$type]; + } + + return false; + } + + public static function mb_http_input($type = '') + { + return false; + } + + public static function mb_http_output($encoding = null) + { + return null !== $encoding ? 'pass' === $encoding : 'pass'; + } + + public static function mb_strwidth($s, $encoding = null) + { + $encoding = self::getEncoding($encoding); + + if ('UTF-8' !== $encoding) { + $s = iconv($encoding, 'UTF-8//IGNORE', $s); + } + + $s = preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $s, -1, $wide); + + return ($wide << 1) + iconv_strlen($s, 'UTF-8'); + } + + public static function mb_substr_count($haystack, $needle, $encoding = null) + { + return substr_count($haystack, $needle); + } + + public static function mb_output_handler($contents, $status) + { + return $contents; + } + + public static function mb_chr($code, $encoding = null) + { + if (0x80 > $code %= 0x200000) { + $s = \chr($code); + } elseif (0x800 > $code) { + $s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F); + } elseif (0x10000 > $code) { + $s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F); + } else { + $s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F); + } + + if ('UTF-8' !== $encoding = self::getEncoding($encoding)) { + $s = mb_convert_encoding($s, $encoding, 'UTF-8'); + } + + return $s; + } + + public static function mb_ord($s, $encoding = null) + { + if ('UTF-8' !== $encoding = self::getEncoding($encoding)) { + $s = mb_convert_encoding($s, 'UTF-8', $encoding); + } + + if (1 === \strlen($s)) { + return \ord($s); + } + + $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0; + if (0xF0 <= $code) { + return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80; + } + if (0xE0 <= $code) { + return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80; + } + if (0xC0 <= $code) { + return (($code - 0xC0) << 6) + $s[2] - 0x80; + } + + return $code; + } + + public static function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = \STR_PAD_RIGHT, ?string $encoding = null): string + { + if (!\in_array($pad_type, [\STR_PAD_RIGHT, \STR_PAD_LEFT, \STR_PAD_BOTH], true)) { + throw new \ValueError('mb_str_pad(): Argument #4 ($pad_type) must be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH'); + } + + if (null === $encoding) { + $encoding = self::mb_internal_encoding(); + } else { + self::assertEncoding($encoding, 'mb_str_pad(): Argument #5 ($encoding) must be a valid encoding, "%s" given'); + } + + if (self::mb_strlen($pad_string, $encoding) <= 0) { + throw new \ValueError('mb_str_pad(): Argument #3 ($pad_string) must be a non-empty string'); + } + + $paddingRequired = $length - self::mb_strlen($string, $encoding); + + if ($paddingRequired < 1) { + return $string; + } + + switch ($pad_type) { + case \STR_PAD_LEFT: + return self::mb_substr(str_repeat($pad_string, $paddingRequired), 0, $paddingRequired, $encoding).$string; + case \STR_PAD_RIGHT: + return $string.self::mb_substr(str_repeat($pad_string, $paddingRequired), 0, $paddingRequired, $encoding); + default: + $leftPaddingLength = floor($paddingRequired / 2); + $rightPaddingLength = $paddingRequired - $leftPaddingLength; + + return self::mb_substr(str_repeat($pad_string, $leftPaddingLength), 0, $leftPaddingLength, $encoding).$string.self::mb_substr(str_repeat($pad_string, $rightPaddingLength), 0, $rightPaddingLength, $encoding); + } + } + + public static function mb_ucfirst(string $string, ?string $encoding = null): string + { + if (null === $encoding) { + $encoding = self::mb_internal_encoding(); + } else { + self::assertEncoding($encoding, 'mb_ucfirst(): Argument #2 ($encoding) must be a valid encoding, "%s" given'); + } + + $firstChar = mb_substr($string, 0, 1, $encoding); + $firstChar = mb_convert_case($firstChar, \MB_CASE_TITLE, $encoding); + + return $firstChar.mb_substr($string, 1, null, $encoding); + } + + public static function mb_lcfirst(string $string, ?string $encoding = null): string + { + if (null === $encoding) { + $encoding = self::mb_internal_encoding(); + } else { + self::assertEncoding($encoding, 'mb_lcfirst(): Argument #2 ($encoding) must be a valid encoding, "%s" given'); + } + + $firstChar = mb_substr($string, 0, 1, $encoding); + $firstChar = mb_convert_case($firstChar, \MB_CASE_LOWER, $encoding); + + return $firstChar.mb_substr($string, 1, null, $encoding); + } + + private static function getSubpart($pos, $part, $haystack, $encoding) + { + if (false === $pos) { + return false; + } + if ($part) { + return self::mb_substr($haystack, 0, $pos, $encoding); + } + + return self::mb_substr($haystack, $pos, null, $encoding); + } + + private static function html_encoding_callback(array $m) + { + $i = 1; + $entities = ''; + $m = unpack('C*', htmlentities($m[0], \ENT_COMPAT, 'UTF-8')); + + while (isset($m[$i])) { + if (0x80 > $m[$i]) { + $entities .= \chr($m[$i++]); + continue; + } + if (0xF0 <= $m[$i]) { + $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80; + } elseif (0xE0 <= $m[$i]) { + $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80; + } else { + $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80; + } + + $entities .= '&#'.$c.';'; + } + + return $entities; + } + + private static function title_case(array $s) + { + return self::mb_convert_case($s[1], \MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], \MB_CASE_LOWER, 'UTF-8'); + } + + private static function getData($file) + { + if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) { + return require $file; + } + + return false; + } + + private static function getEncoding($encoding) + { + if (null === $encoding) { + return self::$internalEncoding; + } + + if ('UTF-8' === $encoding) { + return 'UTF-8'; + } + + $encoding = strtoupper($encoding); + + if ('8BIT' === $encoding || 'BINARY' === $encoding) { + return 'CP850'; + } + + if ('UTF8' === $encoding) { + return 'UTF-8'; + } + + return $encoding; + } + + public static function mb_trim(string $string, ?string $characters = null, ?string $encoding = null): string + { + return self::mb_internal_trim('{^[%s]+|[%1$s]+$}Du', $string, $characters, $encoding, __FUNCTION__); + } + + public static function mb_ltrim(string $string, ?string $characters = null, ?string $encoding = null): string + { + return self::mb_internal_trim('{^[%s]+}Du', $string, $characters, $encoding, __FUNCTION__); + } + + public static function mb_rtrim(string $string, ?string $characters = null, ?string $encoding = null): string + { + return self::mb_internal_trim('{[%s]+$}Du', $string, $characters, $encoding, __FUNCTION__); + } + + private static function mb_internal_trim(string $regex, string $string, ?string $characters, ?string $encoding, string $function): string + { + if (null === $encoding) { + $encoding = self::mb_internal_encoding(); + } else { + self::assertEncoding($encoding, $function.'(): Argument #3 ($encoding) must be a valid encoding, "%s" given'); + } + + if ('' === $characters) { + return null === $encoding ? $string : self::mb_convert_encoding($string, $encoding); + } + + if ('UTF-8' === $encoding) { + $encoding = null; + if (!preg_match('//u', $string)) { + $string = @iconv('UTF-8', 'UTF-8//IGNORE', $string); + } + if (null !== $characters && !preg_match('//u', $characters)) { + $characters = @iconv('UTF-8', 'UTF-8//IGNORE', $characters); + } + } else { + $string = iconv($encoding, 'UTF-8//IGNORE', $string); + + if (null !== $characters) { + $characters = iconv($encoding, 'UTF-8//IGNORE', $characters); + } + } + + if (null === $characters) { + $characters = "\\0 \f\n\r\t\v\u{00A0}\u{1680}\u{2000}\u{2001}\u{2002}\u{2003}\u{2004}\u{2005}\u{2006}\u{2007}\u{2008}\u{2009}\u{200A}\u{2028}\u{2029}\u{202F}\u{205F}\u{3000}\u{0085}\u{180E}"; + } else { + $characters = preg_quote($characters); + } + + $string = preg_replace(sprintf($regex, $characters), '', $string); + + if (null === $encoding) { + return $string; + } + + return iconv('UTF-8', $encoding.'//IGNORE', $string); + } + + private static function assertEncoding(string $encoding, string $errorFormat): void + { + try { + $validEncoding = @self::mb_check_encoding('', $encoding); + } catch (\ValueError $e) { + throw new \ValueError(sprintf($errorFormat, $encoding)); + } + + // BC for PHP 7.3 and lower + if (!$validEncoding) { + throw new \ValueError(sprintf($errorFormat, $encoding)); + } + } +} diff --git a/upLoadImage/vendor/symfony/polyfill-mbstring/README.md b/upLoadImage/vendor/symfony/polyfill-mbstring/README.md new file mode 100644 index 0000000..478b40d --- /dev/null +++ b/upLoadImage/vendor/symfony/polyfill-mbstring/README.md @@ -0,0 +1,13 @@ +Symfony Polyfill / Mbstring +=========================== + +This component provides a partial, native PHP implementation for the +[Mbstring](https://php.net/mbstring) extension. + +More information can be found in the +[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md). + +License +======= + +This library is released under the [MIT license](LICENSE). diff --git a/upLoadImage/vendor/symfony/polyfill-mbstring/Resources/unidata/caseFolding.php b/upLoadImage/vendor/symfony/polyfill-mbstring/Resources/unidata/caseFolding.php new file mode 100644 index 0000000..512bba0 --- /dev/null +++ b/upLoadImage/vendor/symfony/polyfill-mbstring/Resources/unidata/caseFolding.php @@ -0,0 +1,119 @@ + 'i̇', + 'µ' => 'μ', + 'ſ' => 's', + 'ͅ' => 'ι', + 'ς' => 'σ', + 'ϐ' => 'β', + 'ϑ' => 'θ', + 'ϕ' => 'φ', + 'ϖ' => 'π', + 'ϰ' => 'κ', + 'ϱ' => 'ρ', + 'ϵ' => 'ε', + 'ẛ' => 'ṡ', + 'ι' => 'ι', + 'ß' => 'ss', + 'ʼn' => 'ʼn', + 'ǰ' => 'ǰ', + 'ΐ' => 'ΐ', + 'ΰ' => 'ΰ', + 'և' => 'եւ', + 'ẖ' => 'ẖ', + 'ẗ' => 'ẗ', + 'ẘ' => 'ẘ', + 'ẙ' => 'ẙ', + 'ẚ' => 'aʾ', + 'ẞ' => 'ss', + 'ὐ' => 'ὐ', + 'ὒ' => 'ὒ', + 'ὔ' => 'ὔ', + 'ὖ' => 'ὖ', + 'ᾀ' => 'ἀι', + 'ᾁ' => 'ἁι', + 'ᾂ' => 'ἂι', + 'ᾃ' => 'ἃι', + 'ᾄ' => 'ἄι', + 'ᾅ' => 'ἅι', + 'ᾆ' => 'ἆι', + 'ᾇ' => 'ἇι', + 'ᾈ' => 'ἀι', + 'ᾉ' => 'ἁι', + 'ᾊ' => 'ἂι', + 'ᾋ' => 'ἃι', + 'ᾌ' => 'ἄι', + 'ᾍ' => 'ἅι', + 'ᾎ' => 'ἆι', + 'ᾏ' => 'ἇι', + 'ᾐ' => 'ἠι', + 'ᾑ' => 'ἡι', + 'ᾒ' => 'ἢι', + 'ᾓ' => 'ἣι', + 'ᾔ' => 'ἤι', + 'ᾕ' => 'ἥι', + 'ᾖ' => 'ἦι', + 'ᾗ' => 'ἧι', + 'ᾘ' => 'ἠι', + 'ᾙ' => 'ἡι', + 'ᾚ' => 'ἢι', + 'ᾛ' => 'ἣι', + 'ᾜ' => 'ἤι', + 'ᾝ' => 'ἥι', + 'ᾞ' => 'ἦι', + 'ᾟ' => 'ἧι', + 'ᾠ' => 'ὠι', + 'ᾡ' => 'ὡι', + 'ᾢ' => 'ὢι', + 'ᾣ' => 'ὣι', + 'ᾤ' => 'ὤι', + 'ᾥ' => 'ὥι', + 'ᾦ' => 'ὦι', + 'ᾧ' => 'ὧι', + 'ᾨ' => 'ὠι', + 'ᾩ' => 'ὡι', + 'ᾪ' => 'ὢι', + 'ᾫ' => 'ὣι', + 'ᾬ' => 'ὤι', + 'ᾭ' => 'ὥι', + 'ᾮ' => 'ὦι', + 'ᾯ' => 'ὧι', + 'ᾲ' => 'ὰι', + 'ᾳ' => 'αι', + 'ᾴ' => 'άι', + 'ᾶ' => 'ᾶ', + 'ᾷ' => 'ᾶι', + 'ᾼ' => 'αι', + 'ῂ' => 'ὴι', + 'ῃ' => 'ηι', + 'ῄ' => 'ήι', + 'ῆ' => 'ῆ', + 'ῇ' => 'ῆι', + 'ῌ' => 'ηι', + 'ῒ' => 'ῒ', + 'ῖ' => 'ῖ', + 'ῗ' => 'ῗ', + 'ῢ' => 'ῢ', + 'ῤ' => 'ῤ', + 'ῦ' => 'ῦ', + 'ῧ' => 'ῧ', + 'ῲ' => 'ὼι', + 'ῳ' => 'ωι', + 'ῴ' => 'ώι', + 'ῶ' => 'ῶ', + 'ῷ' => 'ῶι', + 'ῼ' => 'ωι', + 'ff' => 'ff', + 'fi' => 'fi', + 'fl' => 'fl', + 'ffi' => 'ffi', + 'ffl' => 'ffl', + 'ſt' => 'st', + 'st' => 'st', + 'ﬓ' => 'մն', + 'ﬔ' => 'մե', + 'ﬕ' => 'մի', + 'ﬖ' => 'վն', + 'ﬗ' => 'մխ', +]; diff --git a/upLoadImage/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php b/upLoadImage/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php new file mode 100644 index 0000000..fac60b0 --- /dev/null +++ b/upLoadImage/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php @@ -0,0 +1,1397 @@ + 'a', + 'B' => 'b', + 'C' => 'c', + 'D' => 'd', + 'E' => 'e', + 'F' => 'f', + 'G' => 'g', + 'H' => 'h', + 'I' => 'i', + 'J' => 'j', + 'K' => 'k', + 'L' => 'l', + 'M' => 'm', + 'N' => 'n', + 'O' => 'o', + 'P' => 'p', + 'Q' => 'q', + 'R' => 'r', + 'S' => 's', + 'T' => 't', + 'U' => 'u', + 'V' => 'v', + 'W' => 'w', + 'X' => 'x', + 'Y' => 'y', + 'Z' => 'z', + 'À' => 'à', + 'Á' => 'á', + 'Â' => 'â', + 'Ã' => 'ã', + 'Ä' => 'ä', + 'Å' => 'å', + 'Æ' => 'æ', + 'Ç' => 'ç', + 'È' => 'è', + 'É' => 'é', + 'Ê' => 'ê', + 'Ë' => 'ë', + 'Ì' => 'ì', + 'Í' => 'í', + 'Î' => 'î', + 'Ï' => 'ï', + 'Ð' => 'ð', + 'Ñ' => 'ñ', + 'Ò' => 'ò', + 'Ó' => 'ó', + 'Ô' => 'ô', + 'Õ' => 'õ', + 'Ö' => 'ö', + 'Ø' => 'ø', + 'Ù' => 'ù', + 'Ú' => 'ú', + 'Û' => 'û', + 'Ü' => 'ü', + 'Ý' => 'ý', + 'Þ' => 'þ', + 'Ā' => 'ā', + 'Ă' => 'ă', + 'Ą' => 'ą', + 'Ć' => 'ć', + 'Ĉ' => 'ĉ', + 'Ċ' => 'ċ', + 'Č' => 'č', + 'Ď' => 'ď', + 'Đ' => 'đ', + 'Ē' => 'ē', + 'Ĕ' => 'ĕ', + 'Ė' => 'ė', + 'Ę' => 'ę', + 'Ě' => 'ě', + 'Ĝ' => 'ĝ', + 'Ğ' => 'ğ', + 'Ġ' => 'ġ', + 'Ģ' => 'ģ', + 'Ĥ' => 'ĥ', + 'Ħ' => 'ħ', + 'Ĩ' => 'ĩ', + 'Ī' => 'ī', + 'Ĭ' => 'ĭ', + 'Į' => 'į', + 'İ' => 'i̇', + 'IJ' => 'ij', + 'Ĵ' => 'ĵ', + 'Ķ' => 'ķ', + 'Ĺ' => 'ĺ', + 'Ļ' => 'ļ', + 'Ľ' => 'ľ', + 'Ŀ' => 'ŀ', + 'Ł' => 'ł', + 'Ń' => 'ń', + 'Ņ' => 'ņ', + 'Ň' => 'ň', + 'Ŋ' => 'ŋ', + 'Ō' => 'ō', + 'Ŏ' => 'ŏ', + 'Ő' => 'ő', + 'Œ' => 'œ', + 'Ŕ' => 'ŕ', + 'Ŗ' => 'ŗ', + 'Ř' => 'ř', + 'Ś' => 'ś', + 'Ŝ' => 'ŝ', + 'Ş' => 'ş', + 'Š' => 'š', + 'Ţ' => 'ţ', + 'Ť' => 'ť', + 'Ŧ' => 'ŧ', + 'Ũ' => 'ũ', + 'Ū' => 'ū', + 'Ŭ' => 'ŭ', + 'Ů' => 'ů', + 'Ű' => 'ű', + 'Ų' => 'ų', + 'Ŵ' => 'ŵ', + 'Ŷ' => 'ŷ', + 'Ÿ' => 'ÿ', + 'Ź' => 'ź', + 'Ż' => 'ż', + 'Ž' => 'ž', + 'Ɓ' => 'ɓ', + 'Ƃ' => 'ƃ', + 'Ƅ' => 'ƅ', + 'Ɔ' => 'ɔ', + 'Ƈ' => 'ƈ', + 'Ɖ' => 'ɖ', + 'Ɗ' => 'ɗ', + 'Ƌ' => 'ƌ', + 'Ǝ' => 'ǝ', + 'Ə' => 'ə', + 'Ɛ' => 'ɛ', + 'Ƒ' => 'ƒ', + 'Ɠ' => 'ɠ', + 'Ɣ' => 'ɣ', + 'Ɩ' => 'ɩ', + 'Ɨ' => 'ɨ', + 'Ƙ' => 'ƙ', + 'Ɯ' => 'ɯ', + 'Ɲ' => 'ɲ', + 'Ɵ' => 'ɵ', + 'Ơ' => 'ơ', + 'Ƣ' => 'ƣ', + 'Ƥ' => 'ƥ', + 'Ʀ' => 'ʀ', + 'Ƨ' => 'ƨ', + 'Ʃ' => 'ʃ', + 'Ƭ' => 'ƭ', + 'Ʈ' => 'ʈ', + 'Ư' => 'ư', + 'Ʊ' => 'ʊ', + 'Ʋ' => 'ʋ', + 'Ƴ' => 'ƴ', + 'Ƶ' => 'ƶ', + 'Ʒ' => 'ʒ', + 'Ƹ' => 'ƹ', + 'Ƽ' => 'ƽ', + 'DŽ' => 'dž', + 'Dž' => 'dž', + 'LJ' => 'lj', + 'Lj' => 'lj', + 'NJ' => 'nj', + 'Nj' => 'nj', + 'Ǎ' => 'ǎ', + 'Ǐ' => 'ǐ', + 'Ǒ' => 'ǒ', + 'Ǔ' => 'ǔ', + 'Ǖ' => 'ǖ', + 'Ǘ' => 'ǘ', + 'Ǚ' => 'ǚ', + 'Ǜ' => 'ǜ', + 'Ǟ' => 'ǟ', + 'Ǡ' => 'ǡ', + 'Ǣ' => 'ǣ', + 'Ǥ' => 'ǥ', + 'Ǧ' => 'ǧ', + 'Ǩ' => 'ǩ', + 'Ǫ' => 'ǫ', + 'Ǭ' => 'ǭ', + 'Ǯ' => 'ǯ', + 'DZ' => 'dz', + 'Dz' => 'dz', + 'Ǵ' => 'ǵ', + 'Ƕ' => 'ƕ', + 'Ƿ' => 'ƿ', + 'Ǹ' => 'ǹ', + 'Ǻ' => 'ǻ', + 'Ǽ' => 'ǽ', + 'Ǿ' => 'ǿ', + 'Ȁ' => 'ȁ', + 'Ȃ' => 'ȃ', + 'Ȅ' => 'ȅ', + 'Ȇ' => 'ȇ', + 'Ȉ' => 'ȉ', + 'Ȋ' => 'ȋ', + 'Ȍ' => 'ȍ', + 'Ȏ' => 'ȏ', + 'Ȑ' => 'ȑ', + 'Ȓ' => 'ȓ', + 'Ȕ' => 'ȕ', + 'Ȗ' => 'ȗ', + 'Ș' => 'ș', + 'Ț' => 'ț', + 'Ȝ' => 'ȝ', + 'Ȟ' => 'ȟ', + 'Ƞ' => 'ƞ', + 'Ȣ' => 'ȣ', + 'Ȥ' => 'ȥ', + 'Ȧ' => 'ȧ', + 'Ȩ' => 'ȩ', + 'Ȫ' => 'ȫ', + 'Ȭ' => 'ȭ', + 'Ȯ' => 'ȯ', + 'Ȱ' => 'ȱ', + 'Ȳ' => 'ȳ', + 'Ⱥ' => 'ⱥ', + 'Ȼ' => 'ȼ', + 'Ƚ' => 'ƚ', + 'Ⱦ' => 'ⱦ', + 'Ɂ' => 'ɂ', + 'Ƀ' => 'ƀ', + 'Ʉ' => 'ʉ', + 'Ʌ' => 'ʌ', + 'Ɇ' => 'ɇ', + 'Ɉ' => 'ɉ', + 'Ɋ' => 'ɋ', + 'Ɍ' => 'ɍ', + 'Ɏ' => 'ɏ', + 'Ͱ' => 'ͱ', + 'Ͳ' => 'ͳ', + 'Ͷ' => 'ͷ', + 'Ϳ' => 'ϳ', + 'Ά' => 'ά', + 'Έ' => 'έ', + 'Ή' => 'ή', + 'Ί' => 'ί', + 'Ό' => 'ό', + 'Ύ' => 'ύ', + 'Ώ' => 'ώ', + 'Α' => 'α', + 'Β' => 'β', + 'Γ' => 'γ', + 'Δ' => 'δ', + 'Ε' => 'ε', + 'Ζ' => 'ζ', + 'Η' => 'η', + 'Θ' => 'θ', + 'Ι' => 'ι', + 'Κ' => 'κ', + 'Λ' => 'λ', + 'Μ' => 'μ', + 'Ν' => 'ν', + 'Ξ' => 'ξ', + 'Ο' => 'ο', + 'Π' => 'π', + 'Ρ' => 'ρ', + 'Σ' => 'σ', + 'Τ' => 'τ', + 'Υ' => 'υ', + 'Φ' => 'φ', + 'Χ' => 'χ', + 'Ψ' => 'ψ', + 'Ω' => 'ω', + 'Ϊ' => 'ϊ', + 'Ϋ' => 'ϋ', + 'Ϗ' => 'ϗ', + 'Ϙ' => 'ϙ', + 'Ϛ' => 'ϛ', + 'Ϝ' => 'ϝ', + 'Ϟ' => 'ϟ', + 'Ϡ' => 'ϡ', + 'Ϣ' => 'ϣ', + 'Ϥ' => 'ϥ', + 'Ϧ' => 'ϧ', + 'Ϩ' => 'ϩ', + 'Ϫ' => 'ϫ', + 'Ϭ' => 'ϭ', + 'Ϯ' => 'ϯ', + 'ϴ' => 'θ', + 'Ϸ' => 'ϸ', + 'Ϲ' => 'ϲ', + 'Ϻ' => 'ϻ', + 'Ͻ' => 'ͻ', + 'Ͼ' => 'ͼ', + 'Ͽ' => 'ͽ', + 'Ѐ' => 'ѐ', + 'Ё' => 'ё', + 'Ђ' => 'ђ', + 'Ѓ' => 'ѓ', + 'Є' => 'є', + 'Ѕ' => 'ѕ', + 'І' => 'і', + 'Ї' => 'ї', + 'Ј' => 'ј', + 'Љ' => 'љ', + 'Њ' => 'њ', + 'Ћ' => 'ћ', + 'Ќ' => 'ќ', + 'Ѝ' => 'ѝ', + 'Ў' => 'ў', + 'Џ' => 'џ', + 'А' => 'а', + 'Б' => 'б', + 'В' => 'в', + 'Г' => 'г', + 'Д' => 'д', + 'Е' => 'е', + 'Ж' => 'ж', + 'З' => 'з', + 'И' => 'и', + 'Й' => 'й', + 'К' => 'к', + 'Л' => 'л', + 'М' => 'м', + 'Н' => 'н', + 'О' => 'о', + 'П' => 'п', + 'Р' => 'р', + 'С' => 'с', + 'Т' => 'т', + 'У' => 'у', + 'Ф' => 'ф', + 'Х' => 'х', + 'Ц' => 'ц', + 'Ч' => 'ч', + 'Ш' => 'ш', + 'Щ' => 'щ', + 'Ъ' => 'ъ', + 'Ы' => 'ы', + 'Ь' => 'ь', + 'Э' => 'э', + 'Ю' => 'ю', + 'Я' => 'я', + 'Ѡ' => 'ѡ', + 'Ѣ' => 'ѣ', + 'Ѥ' => 'ѥ', + 'Ѧ' => 'ѧ', + 'Ѩ' => 'ѩ', + 'Ѫ' => 'ѫ', + 'Ѭ' => 'ѭ', + 'Ѯ' => 'ѯ', + 'Ѱ' => 'ѱ', + 'Ѳ' => 'ѳ', + 'Ѵ' => 'ѵ', + 'Ѷ' => 'ѷ', + 'Ѹ' => 'ѹ', + 'Ѻ' => 'ѻ', + 'Ѽ' => 'ѽ', + 'Ѿ' => 'ѿ', + 'Ҁ' => 'ҁ', + 'Ҋ' => 'ҋ', + 'Ҍ' => 'ҍ', + 'Ҏ' => 'ҏ', + 'Ґ' => 'ґ', + 'Ғ' => 'ғ', + 'Ҕ' => 'ҕ', + 'Җ' => 'җ', + 'Ҙ' => 'ҙ', + 'Қ' => 'қ', + 'Ҝ' => 'ҝ', + 'Ҟ' => 'ҟ', + 'Ҡ' => 'ҡ', + 'Ң' => 'ң', + 'Ҥ' => 'ҥ', + 'Ҧ' => 'ҧ', + 'Ҩ' => 'ҩ', + 'Ҫ' => 'ҫ', + 'Ҭ' => 'ҭ', + 'Ү' => 'ү', + 'Ұ' => 'ұ', + 'Ҳ' => 'ҳ', + 'Ҵ' => 'ҵ', + 'Ҷ' => 'ҷ', + 'Ҹ' => 'ҹ', + 'Һ' => 'һ', + 'Ҽ' => 'ҽ', + 'Ҿ' => 'ҿ', + 'Ӏ' => 'ӏ', + 'Ӂ' => 'ӂ', + 'Ӄ' => 'ӄ', + 'Ӆ' => 'ӆ', + 'Ӈ' => 'ӈ', + 'Ӊ' => 'ӊ', + 'Ӌ' => 'ӌ', + 'Ӎ' => 'ӎ', + 'Ӑ' => 'ӑ', + 'Ӓ' => 'ӓ', + 'Ӕ' => 'ӕ', + 'Ӗ' => 'ӗ', + 'Ә' => 'ә', + 'Ӛ' => 'ӛ', + 'Ӝ' => 'ӝ', + 'Ӟ' => 'ӟ', + 'Ӡ' => 'ӡ', + 'Ӣ' => 'ӣ', + 'Ӥ' => 'ӥ', + 'Ӧ' => 'ӧ', + 'Ө' => 'ө', + 'Ӫ' => 'ӫ', + 'Ӭ' => 'ӭ', + 'Ӯ' => 'ӯ', + 'Ӱ' => 'ӱ', + 'Ӳ' => 'ӳ', + 'Ӵ' => 'ӵ', + 'Ӷ' => 'ӷ', + 'Ӹ' => 'ӹ', + 'Ӻ' => 'ӻ', + 'Ӽ' => 'ӽ', + 'Ӿ' => 'ӿ', + 'Ԁ' => 'ԁ', + 'Ԃ' => 'ԃ', + 'Ԅ' => 'ԅ', + 'Ԇ' => 'ԇ', + 'Ԉ' => 'ԉ', + 'Ԋ' => 'ԋ', + 'Ԍ' => 'ԍ', + 'Ԏ' => 'ԏ', + 'Ԑ' => 'ԑ', + 'Ԓ' => 'ԓ', + 'Ԕ' => 'ԕ', + 'Ԗ' => 'ԗ', + 'Ԙ' => 'ԙ', + 'Ԛ' => 'ԛ', + 'Ԝ' => 'ԝ', + 'Ԟ' => 'ԟ', + 'Ԡ' => 'ԡ', + 'Ԣ' => 'ԣ', + 'Ԥ' => 'ԥ', + 'Ԧ' => 'ԧ', + 'Ԩ' => 'ԩ', + 'Ԫ' => 'ԫ', + 'Ԭ' => 'ԭ', + 'Ԯ' => 'ԯ', + 'Ա' => 'ա', + 'Բ' => 'բ', + 'Գ' => 'գ', + 'Դ' => 'դ', + 'Ե' => 'ե', + 'Զ' => 'զ', + 'Է' => 'է', + 'Ը' => 'ը', + 'Թ' => 'թ', + 'Ժ' => 'ժ', + 'Ի' => 'ի', + 'Լ' => 'լ', + 'Խ' => 'խ', + 'Ծ' => 'ծ', + 'Կ' => 'կ', + 'Հ' => 'հ', + 'Ձ' => 'ձ', + 'Ղ' => 'ղ', + 'Ճ' => 'ճ', + 'Մ' => 'մ', + 'Յ' => 'յ', + 'Ն' => 'ն', + 'Շ' => 'շ', + 'Ո' => 'ո', + 'Չ' => 'չ', + 'Պ' => 'պ', + 'Ջ' => 'ջ', + 'Ռ' => 'ռ', + 'Ս' => 'ս', + 'Վ' => 'վ', + 'Տ' => 'տ', + 'Ր' => 'ր', + 'Ց' => 'ց', + 'Ւ' => 'ւ', + 'Փ' => 'փ', + 'Ք' => 'ք', + 'Օ' => 'օ', + 'Ֆ' => 'ֆ', + 'Ⴀ' => 'ⴀ', + 'Ⴁ' => 'ⴁ', + 'Ⴂ' => 'ⴂ', + 'Ⴃ' => 'ⴃ', + 'Ⴄ' => 'ⴄ', + 'Ⴅ' => 'ⴅ', + 'Ⴆ' => 'ⴆ', + 'Ⴇ' => 'ⴇ', + 'Ⴈ' => 'ⴈ', + 'Ⴉ' => 'ⴉ', + 'Ⴊ' => 'ⴊ', + 'Ⴋ' => 'ⴋ', + 'Ⴌ' => 'ⴌ', + 'Ⴍ' => 'ⴍ', + 'Ⴎ' => 'ⴎ', + 'Ⴏ' => 'ⴏ', + 'Ⴐ' => 'ⴐ', + 'Ⴑ' => 'ⴑ', + 'Ⴒ' => 'ⴒ', + 'Ⴓ' => 'ⴓ', + 'Ⴔ' => 'ⴔ', + 'Ⴕ' => 'ⴕ', + 'Ⴖ' => 'ⴖ', + 'Ⴗ' => 'ⴗ', + 'Ⴘ' => 'ⴘ', + 'Ⴙ' => 'ⴙ', + 'Ⴚ' => 'ⴚ', + 'Ⴛ' => 'ⴛ', + 'Ⴜ' => 'ⴜ', + 'Ⴝ' => 'ⴝ', + 'Ⴞ' => 'ⴞ', + 'Ⴟ' => 'ⴟ', + 'Ⴠ' => 'ⴠ', + 'Ⴡ' => 'ⴡ', + 'Ⴢ' => 'ⴢ', + 'Ⴣ' => 'ⴣ', + 'Ⴤ' => 'ⴤ', + 'Ⴥ' => 'ⴥ', + 'Ⴧ' => 'ⴧ', + 'Ⴭ' => 'ⴭ', + 'Ꭰ' => 'ꭰ', + 'Ꭱ' => 'ꭱ', + 'Ꭲ' => 'ꭲ', + 'Ꭳ' => 'ꭳ', + 'Ꭴ' => 'ꭴ', + 'Ꭵ' => 'ꭵ', + 'Ꭶ' => 'ꭶ', + 'Ꭷ' => 'ꭷ', + 'Ꭸ' => 'ꭸ', + 'Ꭹ' => 'ꭹ', + 'Ꭺ' => 'ꭺ', + 'Ꭻ' => 'ꭻ', + 'Ꭼ' => 'ꭼ', + 'Ꭽ' => 'ꭽ', + 'Ꭾ' => 'ꭾ', + 'Ꭿ' => 'ꭿ', + 'Ꮀ' => 'ꮀ', + 'Ꮁ' => 'ꮁ', + 'Ꮂ' => 'ꮂ', + 'Ꮃ' => 'ꮃ', + 'Ꮄ' => 'ꮄ', + 'Ꮅ' => 'ꮅ', + 'Ꮆ' => 'ꮆ', + 'Ꮇ' => 'ꮇ', + 'Ꮈ' => 'ꮈ', + 'Ꮉ' => 'ꮉ', + 'Ꮊ' => 'ꮊ', + 'Ꮋ' => 'ꮋ', + 'Ꮌ' => 'ꮌ', + 'Ꮍ' => 'ꮍ', + 'Ꮎ' => 'ꮎ', + 'Ꮏ' => 'ꮏ', + 'Ꮐ' => 'ꮐ', + 'Ꮑ' => 'ꮑ', + 'Ꮒ' => 'ꮒ', + 'Ꮓ' => 'ꮓ', + 'Ꮔ' => 'ꮔ', + 'Ꮕ' => 'ꮕ', + 'Ꮖ' => 'ꮖ', + 'Ꮗ' => 'ꮗ', + 'Ꮘ' => 'ꮘ', + 'Ꮙ' => 'ꮙ', + 'Ꮚ' => 'ꮚ', + 'Ꮛ' => 'ꮛ', + 'Ꮜ' => 'ꮜ', + 'Ꮝ' => 'ꮝ', + 'Ꮞ' => 'ꮞ', + 'Ꮟ' => 'ꮟ', + 'Ꮠ' => 'ꮠ', + 'Ꮡ' => 'ꮡ', + 'Ꮢ' => 'ꮢ', + 'Ꮣ' => 'ꮣ', + 'Ꮤ' => 'ꮤ', + 'Ꮥ' => 'ꮥ', + 'Ꮦ' => 'ꮦ', + 'Ꮧ' => 'ꮧ', + 'Ꮨ' => 'ꮨ', + 'Ꮩ' => 'ꮩ', + 'Ꮪ' => 'ꮪ', + 'Ꮫ' => 'ꮫ', + 'Ꮬ' => 'ꮬ', + 'Ꮭ' => 'ꮭ', + 'Ꮮ' => 'ꮮ', + 'Ꮯ' => 'ꮯ', + 'Ꮰ' => 'ꮰ', + 'Ꮱ' => 'ꮱ', + 'Ꮲ' => 'ꮲ', + 'Ꮳ' => 'ꮳ', + 'Ꮴ' => 'ꮴ', + 'Ꮵ' => 'ꮵ', + 'Ꮶ' => 'ꮶ', + 'Ꮷ' => 'ꮷ', + 'Ꮸ' => 'ꮸ', + 'Ꮹ' => 'ꮹ', + 'Ꮺ' => 'ꮺ', + 'Ꮻ' => 'ꮻ', + 'Ꮼ' => 'ꮼ', + 'Ꮽ' => 'ꮽ', + 'Ꮾ' => 'ꮾ', + 'Ꮿ' => 'ꮿ', + 'Ᏸ' => 'ᏸ', + 'Ᏹ' => 'ᏹ', + 'Ᏺ' => 'ᏺ', + 'Ᏻ' => 'ᏻ', + 'Ᏼ' => 'ᏼ', + 'Ᏽ' => 'ᏽ', + 'Ა' => 'ა', + 'Ბ' => 'ბ', + 'Გ' => 'გ', + 'Დ' => 'დ', + 'Ე' => 'ე', + 'Ვ' => 'ვ', + 'Ზ' => 'ზ', + 'Თ' => 'თ', + 'Ი' => 'ი', + 'Კ' => 'კ', + 'Ლ' => 'ლ', + 'Მ' => 'მ', + 'Ნ' => 'ნ', + 'Ო' => 'ო', + 'Პ' => 'პ', + 'Ჟ' => 'ჟ', + 'Რ' => 'რ', + 'Ს' => 'ს', + 'Ტ' => 'ტ', + 'Უ' => 'უ', + 'Ფ' => 'ფ', + 'Ქ' => 'ქ', + 'Ღ' => 'ღ', + 'Ყ' => 'ყ', + 'Შ' => 'შ', + 'Ჩ' => 'ჩ', + 'Ც' => 'ც', + 'Ძ' => 'ძ', + 'Წ' => 'წ', + 'Ჭ' => 'ჭ', + 'Ხ' => 'ხ', + 'Ჯ' => 'ჯ', + 'Ჰ' => 'ჰ', + 'Ჱ' => 'ჱ', + 'Ჲ' => 'ჲ', + 'Ჳ' => 'ჳ', + 'Ჴ' => 'ჴ', + 'Ჵ' => 'ჵ', + 'Ჶ' => 'ჶ', + 'Ჷ' => 'ჷ', + 'Ჸ' => 'ჸ', + 'Ჹ' => 'ჹ', + 'Ჺ' => 'ჺ', + 'Ჽ' => 'ჽ', + 'Ჾ' => 'ჾ', + 'Ჿ' => 'ჿ', + 'Ḁ' => 'ḁ', + 'Ḃ' => 'ḃ', + 'Ḅ' => 'ḅ', + 'Ḇ' => 'ḇ', + 'Ḉ' => 'ḉ', + 'Ḋ' => 'ḋ', + 'Ḍ' => 'ḍ', + 'Ḏ' => 'ḏ', + 'Ḑ' => 'ḑ', + 'Ḓ' => 'ḓ', + 'Ḕ' => 'ḕ', + 'Ḗ' => 'ḗ', + 'Ḙ' => 'ḙ', + 'Ḛ' => 'ḛ', + 'Ḝ' => 'ḝ', + 'Ḟ' => 'ḟ', + 'Ḡ' => 'ḡ', + 'Ḣ' => 'ḣ', + 'Ḥ' => 'ḥ', + 'Ḧ' => 'ḧ', + 'Ḩ' => 'ḩ', + 'Ḫ' => 'ḫ', + 'Ḭ' => 'ḭ', + 'Ḯ' => 'ḯ', + 'Ḱ' => 'ḱ', + 'Ḳ' => 'ḳ', + 'Ḵ' => 'ḵ', + 'Ḷ' => 'ḷ', + 'Ḹ' => 'ḹ', + 'Ḻ' => 'ḻ', + 'Ḽ' => 'ḽ', + 'Ḿ' => 'ḿ', + 'Ṁ' => 'ṁ', + 'Ṃ' => 'ṃ', + 'Ṅ' => 'ṅ', + 'Ṇ' => 'ṇ', + 'Ṉ' => 'ṉ', + 'Ṋ' => 'ṋ', + 'Ṍ' => 'ṍ', + 'Ṏ' => 'ṏ', + 'Ṑ' => 'ṑ', + 'Ṓ' => 'ṓ', + 'Ṕ' => 'ṕ', + 'Ṗ' => 'ṗ', + 'Ṙ' => 'ṙ', + 'Ṛ' => 'ṛ', + 'Ṝ' => 'ṝ', + 'Ṟ' => 'ṟ', + 'Ṡ' => 'ṡ', + 'Ṣ' => 'ṣ', + 'Ṥ' => 'ṥ', + 'Ṧ' => 'ṧ', + 'Ṩ' => 'ṩ', + 'Ṫ' => 'ṫ', + 'Ṭ' => 'ṭ', + 'Ṯ' => 'ṯ', + 'Ṱ' => 'ṱ', + 'Ṳ' => 'ṳ', + 'Ṵ' => 'ṵ', + 'Ṷ' => 'ṷ', + 'Ṹ' => 'ṹ', + 'Ṻ' => 'ṻ', + 'Ṽ' => 'ṽ', + 'Ṿ' => 'ṿ', + 'Ẁ' => 'ẁ', + 'Ẃ' => 'ẃ', + 'Ẅ' => 'ẅ', + 'Ẇ' => 'ẇ', + 'Ẉ' => 'ẉ', + 'Ẋ' => 'ẋ', + 'Ẍ' => 'ẍ', + 'Ẏ' => 'ẏ', + 'Ẑ' => 'ẑ', + 'Ẓ' => 'ẓ', + 'Ẕ' => 'ẕ', + 'ẞ' => 'ß', + 'Ạ' => 'ạ', + 'Ả' => 'ả', + 'Ấ' => 'ấ', + 'Ầ' => 'ầ', + 'Ẩ' => 'ẩ', + 'Ẫ' => 'ẫ', + 'Ậ' => 'ậ', + 'Ắ' => 'ắ', + 'Ằ' => 'ằ', + 'Ẳ' => 'ẳ', + 'Ẵ' => 'ẵ', + 'Ặ' => 'ặ', + 'Ẹ' => 'ẹ', + 'Ẻ' => 'ẻ', + 'Ẽ' => 'ẽ', + 'Ế' => 'ế', + 'Ề' => 'ề', + 'Ể' => 'ể', + 'Ễ' => 'ễ', + 'Ệ' => 'ệ', + 'Ỉ' => 'ỉ', + 'Ị' => 'ị', + 'Ọ' => 'ọ', + 'Ỏ' => 'ỏ', + 'Ố' => 'ố', + 'Ồ' => 'ồ', + 'Ổ' => 'ổ', + 'Ỗ' => 'ỗ', + 'Ộ' => 'ộ', + 'Ớ' => 'ớ', + 'Ờ' => 'ờ', + 'Ở' => 'ở', + 'Ỡ' => 'ỡ', + 'Ợ' => 'ợ', + 'Ụ' => 'ụ', + 'Ủ' => 'ủ', + 'Ứ' => 'ứ', + 'Ừ' => 'ừ', + 'Ử' => 'ử', + 'Ữ' => 'ữ', + 'Ự' => 'ự', + 'Ỳ' => 'ỳ', + 'Ỵ' => 'ỵ', + 'Ỷ' => 'ỷ', + 'Ỹ' => 'ỹ', + 'Ỻ' => 'ỻ', + 'Ỽ' => 'ỽ', + 'Ỿ' => 'ỿ', + 'Ἀ' => 'ἀ', + 'Ἁ' => 'ἁ', + 'Ἂ' => 'ἂ', + 'Ἃ' => 'ἃ', + 'Ἄ' => 'ἄ', + 'Ἅ' => 'ἅ', + 'Ἆ' => 'ἆ', + 'Ἇ' => 'ἇ', + 'Ἐ' => 'ἐ', + 'Ἑ' => 'ἑ', + 'Ἒ' => 'ἒ', + 'Ἓ' => 'ἓ', + 'Ἔ' => 'ἔ', + 'Ἕ' => 'ἕ', + 'Ἠ' => 'ἠ', + 'Ἡ' => 'ἡ', + 'Ἢ' => 'ἢ', + 'Ἣ' => 'ἣ', + 'Ἤ' => 'ἤ', + 'Ἥ' => 'ἥ', + 'Ἦ' => 'ἦ', + 'Ἧ' => 'ἧ', + 'Ἰ' => 'ἰ', + 'Ἱ' => 'ἱ', + 'Ἲ' => 'ἲ', + 'Ἳ' => 'ἳ', + 'Ἴ' => 'ἴ', + 'Ἵ' => 'ἵ', + 'Ἶ' => 'ἶ', + 'Ἷ' => 'ἷ', + 'Ὀ' => 'ὀ', + 'Ὁ' => 'ὁ', + 'Ὂ' => 'ὂ', + 'Ὃ' => 'ὃ', + 'Ὄ' => 'ὄ', + 'Ὅ' => 'ὅ', + 'Ὑ' => 'ὑ', + 'Ὓ' => 'ὓ', + 'Ὕ' => 'ὕ', + 'Ὗ' => 'ὗ', + 'Ὠ' => 'ὠ', + 'Ὡ' => 'ὡ', + 'Ὢ' => 'ὢ', + 'Ὣ' => 'ὣ', + 'Ὤ' => 'ὤ', + 'Ὥ' => 'ὥ', + 'Ὦ' => 'ὦ', + 'Ὧ' => 'ὧ', + 'ᾈ' => 'ᾀ', + 'ᾉ' => 'ᾁ', + 'ᾊ' => 'ᾂ', + 'ᾋ' => 'ᾃ', + 'ᾌ' => 'ᾄ', + 'ᾍ' => 'ᾅ', + 'ᾎ' => 'ᾆ', + 'ᾏ' => 'ᾇ', + 'ᾘ' => 'ᾐ', + 'ᾙ' => 'ᾑ', + 'ᾚ' => 'ᾒ', + 'ᾛ' => 'ᾓ', + 'ᾜ' => 'ᾔ', + 'ᾝ' => 'ᾕ', + 'ᾞ' => 'ᾖ', + 'ᾟ' => 'ᾗ', + 'ᾨ' => 'ᾠ', + 'ᾩ' => 'ᾡ', + 'ᾪ' => 'ᾢ', + 'ᾫ' => 'ᾣ', + 'ᾬ' => 'ᾤ', + 'ᾭ' => 'ᾥ', + 'ᾮ' => 'ᾦ', + 'ᾯ' => 'ᾧ', + 'Ᾰ' => 'ᾰ', + 'Ᾱ' => 'ᾱ', + 'Ὰ' => 'ὰ', + 'Ά' => 'ά', + 'ᾼ' => 'ᾳ', + 'Ὲ' => 'ὲ', + 'Έ' => 'έ', + 'Ὴ' => 'ὴ', + 'Ή' => 'ή', + 'ῌ' => 'ῃ', + 'Ῐ' => 'ῐ', + 'Ῑ' => 'ῑ', + 'Ὶ' => 'ὶ', + 'Ί' => 'ί', + 'Ῠ' => 'ῠ', + 'Ῡ' => 'ῡ', + 'Ὺ' => 'ὺ', + 'Ύ' => 'ύ', + 'Ῥ' => 'ῥ', + 'Ὸ' => 'ὸ', + 'Ό' => 'ό', + 'Ὼ' => 'ὼ', + 'Ώ' => 'ώ', + 'ῼ' => 'ῳ', + 'Ω' => 'ω', + 'K' => 'k', + 'Å' => 'å', + 'Ⅎ' => 'ⅎ', + 'Ⅰ' => 'ⅰ', + 'Ⅱ' => 'ⅱ', + 'Ⅲ' => 'ⅲ', + 'Ⅳ' => 'ⅳ', + 'Ⅴ' => 'ⅴ', + 'Ⅵ' => 'ⅵ', + 'Ⅶ' => 'ⅶ', + 'Ⅷ' => 'ⅷ', + 'Ⅸ' => 'ⅸ', + 'Ⅹ' => 'ⅹ', + 'Ⅺ' => 'ⅺ', + 'Ⅻ' => 'ⅻ', + 'Ⅼ' => 'ⅼ', + 'Ⅽ' => 'ⅽ', + 'Ⅾ' => 'ⅾ', + 'Ⅿ' => 'ⅿ', + 'Ↄ' => 'ↄ', + 'Ⓐ' => 'ⓐ', + 'Ⓑ' => 'ⓑ', + 'Ⓒ' => 'ⓒ', + 'Ⓓ' => 'ⓓ', + 'Ⓔ' => 'ⓔ', + 'Ⓕ' => 'ⓕ', + 'Ⓖ' => 'ⓖ', + 'Ⓗ' => 'ⓗ', + 'Ⓘ' => 'ⓘ', + 'Ⓙ' => 'ⓙ', + 'Ⓚ' => 'ⓚ', + 'Ⓛ' => 'ⓛ', + 'Ⓜ' => 'ⓜ', + 'Ⓝ' => 'ⓝ', + 'Ⓞ' => 'ⓞ', + 'Ⓟ' => 'ⓟ', + 'Ⓠ' => 'ⓠ', + 'Ⓡ' => 'ⓡ', + 'Ⓢ' => 'ⓢ', + 'Ⓣ' => 'ⓣ', + 'Ⓤ' => 'ⓤ', + 'Ⓥ' => 'ⓥ', + 'Ⓦ' => 'ⓦ', + 'Ⓧ' => 'ⓧ', + 'Ⓨ' => 'ⓨ', + 'Ⓩ' => 'ⓩ', + 'Ⰰ' => 'ⰰ', + 'Ⰱ' => 'ⰱ', + 'Ⰲ' => 'ⰲ', + 'Ⰳ' => 'ⰳ', + 'Ⰴ' => 'ⰴ', + 'Ⰵ' => 'ⰵ', + 'Ⰶ' => 'ⰶ', + 'Ⰷ' => 'ⰷ', + 'Ⰸ' => 'ⰸ', + 'Ⰹ' => 'ⰹ', + 'Ⰺ' => 'ⰺ', + 'Ⰻ' => 'ⰻ', + 'Ⰼ' => 'ⰼ', + 'Ⰽ' => 'ⰽ', + 'Ⰾ' => 'ⰾ', + 'Ⰿ' => 'ⰿ', + 'Ⱀ' => 'ⱀ', + 'Ⱁ' => 'ⱁ', + 'Ⱂ' => 'ⱂ', + 'Ⱃ' => 'ⱃ', + 'Ⱄ' => 'ⱄ', + 'Ⱅ' => 'ⱅ', + 'Ⱆ' => 'ⱆ', + 'Ⱇ' => 'ⱇ', + 'Ⱈ' => 'ⱈ', + 'Ⱉ' => 'ⱉ', + 'Ⱊ' => 'ⱊ', + 'Ⱋ' => 'ⱋ', + 'Ⱌ' => 'ⱌ', + 'Ⱍ' => 'ⱍ', + 'Ⱎ' => 'ⱎ', + 'Ⱏ' => 'ⱏ', + 'Ⱐ' => 'ⱐ', + 'Ⱑ' => 'ⱑ', + 'Ⱒ' => 'ⱒ', + 'Ⱓ' => 'ⱓ', + 'Ⱔ' => 'ⱔ', + 'Ⱕ' => 'ⱕ', + 'Ⱖ' => 'ⱖ', + 'Ⱗ' => 'ⱗ', + 'Ⱘ' => 'ⱘ', + 'Ⱙ' => 'ⱙ', + 'Ⱚ' => 'ⱚ', + 'Ⱛ' => 'ⱛ', + 'Ⱜ' => 'ⱜ', + 'Ⱝ' => 'ⱝ', + 'Ⱞ' => 'ⱞ', + 'Ⱡ' => 'ⱡ', + 'Ɫ' => 'ɫ', + 'Ᵽ' => 'ᵽ', + 'Ɽ' => 'ɽ', + 'Ⱨ' => 'ⱨ', + 'Ⱪ' => 'ⱪ', + 'Ⱬ' => 'ⱬ', + 'Ɑ' => 'ɑ', + 'Ɱ' => 'ɱ', + 'Ɐ' => 'ɐ', + 'Ɒ' => 'ɒ', + 'Ⱳ' => 'ⱳ', + 'Ⱶ' => 'ⱶ', + 'Ȿ' => 'ȿ', + 'Ɀ' => 'ɀ', + 'Ⲁ' => 'ⲁ', + 'Ⲃ' => 'ⲃ', + 'Ⲅ' => 'ⲅ', + 'Ⲇ' => 'ⲇ', + 'Ⲉ' => 'ⲉ', + 'Ⲋ' => 'ⲋ', + 'Ⲍ' => 'ⲍ', + 'Ⲏ' => 'ⲏ', + 'Ⲑ' => 'ⲑ', + 'Ⲓ' => 'ⲓ', + 'Ⲕ' => 'ⲕ', + 'Ⲗ' => 'ⲗ', + 'Ⲙ' => 'ⲙ', + 'Ⲛ' => 'ⲛ', + 'Ⲝ' => 'ⲝ', + 'Ⲟ' => 'ⲟ', + 'Ⲡ' => 'ⲡ', + 'Ⲣ' => 'ⲣ', + 'Ⲥ' => 'ⲥ', + 'Ⲧ' => 'ⲧ', + 'Ⲩ' => 'ⲩ', + 'Ⲫ' => 'ⲫ', + 'Ⲭ' => 'ⲭ', + 'Ⲯ' => 'ⲯ', + 'Ⲱ' => 'ⲱ', + 'Ⲳ' => 'ⲳ', + 'Ⲵ' => 'ⲵ', + 'Ⲷ' => 'ⲷ', + 'Ⲹ' => 'ⲹ', + 'Ⲻ' => 'ⲻ', + 'Ⲽ' => 'ⲽ', + 'Ⲿ' => 'ⲿ', + 'Ⳁ' => 'ⳁ', + 'Ⳃ' => 'ⳃ', + 'Ⳅ' => 'ⳅ', + 'Ⳇ' => 'ⳇ', + 'Ⳉ' => 'ⳉ', + 'Ⳋ' => 'ⳋ', + 'Ⳍ' => 'ⳍ', + 'Ⳏ' => 'ⳏ', + 'Ⳑ' => 'ⳑ', + 'Ⳓ' => 'ⳓ', + 'Ⳕ' => 'ⳕ', + 'Ⳗ' => 'ⳗ', + 'Ⳙ' => 'ⳙ', + 'Ⳛ' => 'ⳛ', + 'Ⳝ' => 'ⳝ', + 'Ⳟ' => 'ⳟ', + 'Ⳡ' => 'ⳡ', + 'Ⳣ' => 'ⳣ', + 'Ⳬ' => 'ⳬ', + 'Ⳮ' => 'ⳮ', + 'Ⳳ' => 'ⳳ', + 'Ꙁ' => 'ꙁ', + 'Ꙃ' => 'ꙃ', + 'Ꙅ' => 'ꙅ', + 'Ꙇ' => 'ꙇ', + 'Ꙉ' => 'ꙉ', + 'Ꙋ' => 'ꙋ', + 'Ꙍ' => 'ꙍ', + 'Ꙏ' => 'ꙏ', + 'Ꙑ' => 'ꙑ', + 'Ꙓ' => 'ꙓ', + 'Ꙕ' => 'ꙕ', + 'Ꙗ' => 'ꙗ', + 'Ꙙ' => 'ꙙ', + 'Ꙛ' => 'ꙛ', + 'Ꙝ' => 'ꙝ', + 'Ꙟ' => 'ꙟ', + 'Ꙡ' => 'ꙡ', + 'Ꙣ' => 'ꙣ', + 'Ꙥ' => 'ꙥ', + 'Ꙧ' => 'ꙧ', + 'Ꙩ' => 'ꙩ', + 'Ꙫ' => 'ꙫ', + 'Ꙭ' => 'ꙭ', + 'Ꚁ' => 'ꚁ', + 'Ꚃ' => 'ꚃ', + 'Ꚅ' => 'ꚅ', + 'Ꚇ' => 'ꚇ', + 'Ꚉ' => 'ꚉ', + 'Ꚋ' => 'ꚋ', + 'Ꚍ' => 'ꚍ', + 'Ꚏ' => 'ꚏ', + 'Ꚑ' => 'ꚑ', + 'Ꚓ' => 'ꚓ', + 'Ꚕ' => 'ꚕ', + 'Ꚗ' => 'ꚗ', + 'Ꚙ' => 'ꚙ', + 'Ꚛ' => 'ꚛ', + 'Ꜣ' => 'ꜣ', + 'Ꜥ' => 'ꜥ', + 'Ꜧ' => 'ꜧ', + 'Ꜩ' => 'ꜩ', + 'Ꜫ' => 'ꜫ', + 'Ꜭ' => 'ꜭ', + 'Ꜯ' => 'ꜯ', + 'Ꜳ' => 'ꜳ', + 'Ꜵ' => 'ꜵ', + 'Ꜷ' => 'ꜷ', + 'Ꜹ' => 'ꜹ', + 'Ꜻ' => 'ꜻ', + 'Ꜽ' => 'ꜽ', + 'Ꜿ' => 'ꜿ', + 'Ꝁ' => 'ꝁ', + 'Ꝃ' => 'ꝃ', + 'Ꝅ' => 'ꝅ', + 'Ꝇ' => 'ꝇ', + 'Ꝉ' => 'ꝉ', + 'Ꝋ' => 'ꝋ', + 'Ꝍ' => 'ꝍ', + 'Ꝏ' => 'ꝏ', + 'Ꝑ' => 'ꝑ', + 'Ꝓ' => 'ꝓ', + 'Ꝕ' => 'ꝕ', + 'Ꝗ' => 'ꝗ', + 'Ꝙ' => 'ꝙ', + 'Ꝛ' => 'ꝛ', + 'Ꝝ' => 'ꝝ', + 'Ꝟ' => 'ꝟ', + 'Ꝡ' => 'ꝡ', + 'Ꝣ' => 'ꝣ', + 'Ꝥ' => 'ꝥ', + 'Ꝧ' => 'ꝧ', + 'Ꝩ' => 'ꝩ', + 'Ꝫ' => 'ꝫ', + 'Ꝭ' => 'ꝭ', + 'Ꝯ' => 'ꝯ', + 'Ꝺ' => 'ꝺ', + 'Ꝼ' => 'ꝼ', + 'Ᵹ' => 'ᵹ', + 'Ꝿ' => 'ꝿ', + 'Ꞁ' => 'ꞁ', + 'Ꞃ' => 'ꞃ', + 'Ꞅ' => 'ꞅ', + 'Ꞇ' => 'ꞇ', + 'Ꞌ' => 'ꞌ', + 'Ɥ' => 'ɥ', + 'Ꞑ' => 'ꞑ', + 'Ꞓ' => 'ꞓ', + 'Ꞗ' => 'ꞗ', + 'Ꞙ' => 'ꞙ', + 'Ꞛ' => 'ꞛ', + 'Ꞝ' => 'ꞝ', + 'Ꞟ' => 'ꞟ', + 'Ꞡ' => 'ꞡ', + 'Ꞣ' => 'ꞣ', + 'Ꞥ' => 'ꞥ', + 'Ꞧ' => 'ꞧ', + 'Ꞩ' => 'ꞩ', + 'Ɦ' => 'ɦ', + 'Ɜ' => 'ɜ', + 'Ɡ' => 'ɡ', + 'Ɬ' => 'ɬ', + 'Ɪ' => 'ɪ', + 'Ʞ' => 'ʞ', + 'Ʇ' => 'ʇ', + 'Ʝ' => 'ʝ', + 'Ꭓ' => 'ꭓ', + 'Ꞵ' => 'ꞵ', + 'Ꞷ' => 'ꞷ', + 'Ꞹ' => 'ꞹ', + 'Ꞻ' => 'ꞻ', + 'Ꞽ' => 'ꞽ', + 'Ꞿ' => 'ꞿ', + 'Ꟃ' => 'ꟃ', + 'Ꞔ' => 'ꞔ', + 'Ʂ' => 'ʂ', + 'Ᶎ' => 'ᶎ', + 'Ꟈ' => 'ꟈ', + 'Ꟊ' => 'ꟊ', + 'Ꟶ' => 'ꟶ', + 'A' => 'a', + 'B' => 'b', + 'C' => 'c', + 'D' => 'd', + 'E' => 'e', + 'F' => 'f', + 'G' => 'g', + 'H' => 'h', + 'I' => 'i', + 'J' => 'j', + 'K' => 'k', + 'L' => 'l', + 'M' => 'm', + 'N' => 'n', + 'O' => 'o', + 'P' => 'p', + 'Q' => 'q', + 'R' => 'r', + 'S' => 's', + 'T' => 't', + 'U' => 'u', + 'V' => 'v', + 'W' => 'w', + 'X' => 'x', + 'Y' => 'y', + 'Z' => 'z', + '𐐀' => '𐐨', + '𐐁' => '𐐩', + '𐐂' => '𐐪', + '𐐃' => '𐐫', + '𐐄' => '𐐬', + '𐐅' => '𐐭', + '𐐆' => '𐐮', + '𐐇' => '𐐯', + '𐐈' => '𐐰', + '𐐉' => '𐐱', + '𐐊' => '𐐲', + '𐐋' => '𐐳', + '𐐌' => '𐐴', + '𐐍' => '𐐵', + '𐐎' => '𐐶', + '𐐏' => '𐐷', + '𐐐' => '𐐸', + '𐐑' => '𐐹', + '𐐒' => '𐐺', + '𐐓' => '𐐻', + '𐐔' => '𐐼', + '𐐕' => '𐐽', + '𐐖' => '𐐾', + '𐐗' => '𐐿', + '𐐘' => '𐑀', + '𐐙' => '𐑁', + '𐐚' => '𐑂', + '𐐛' => '𐑃', + '𐐜' => '𐑄', + '𐐝' => '𐑅', + '𐐞' => '𐑆', + '𐐟' => '𐑇', + '𐐠' => '𐑈', + '𐐡' => '𐑉', + '𐐢' => '𐑊', + '𐐣' => '𐑋', + '𐐤' => '𐑌', + '𐐥' => '𐑍', + '𐐦' => '𐑎', + '𐐧' => '𐑏', + '𐒰' => '𐓘', + '𐒱' => '𐓙', + '𐒲' => '𐓚', + '𐒳' => '𐓛', + '𐒴' => '𐓜', + '𐒵' => '𐓝', + '𐒶' => '𐓞', + '𐒷' => '𐓟', + '𐒸' => '𐓠', + '𐒹' => '𐓡', + '𐒺' => '𐓢', + '𐒻' => '𐓣', + '𐒼' => '𐓤', + '𐒽' => '𐓥', + '𐒾' => '𐓦', + '𐒿' => '𐓧', + '𐓀' => '𐓨', + '𐓁' => '𐓩', + '𐓂' => '𐓪', + '𐓃' => '𐓫', + '𐓄' => '𐓬', + '𐓅' => '𐓭', + '𐓆' => '𐓮', + '𐓇' => '𐓯', + '𐓈' => '𐓰', + '𐓉' => '𐓱', + '𐓊' => '𐓲', + '𐓋' => '𐓳', + '𐓌' => '𐓴', + '𐓍' => '𐓵', + '𐓎' => '𐓶', + '𐓏' => '𐓷', + '𐓐' => '𐓸', + '𐓑' => '𐓹', + '𐓒' => '𐓺', + '𐓓' => '𐓻', + '𐲀' => '𐳀', + '𐲁' => '𐳁', + '𐲂' => '𐳂', + '𐲃' => '𐳃', + '𐲄' => '𐳄', + '𐲅' => '𐳅', + '𐲆' => '𐳆', + '𐲇' => '𐳇', + '𐲈' => '𐳈', + '𐲉' => '𐳉', + '𐲊' => '𐳊', + '𐲋' => '𐳋', + '𐲌' => '𐳌', + '𐲍' => '𐳍', + '𐲎' => '𐳎', + '𐲏' => '𐳏', + '𐲐' => '𐳐', + '𐲑' => '𐳑', + '𐲒' => '𐳒', + '𐲓' => '𐳓', + '𐲔' => '𐳔', + '𐲕' => '𐳕', + '𐲖' => '𐳖', + '𐲗' => '𐳗', + '𐲘' => '𐳘', + '𐲙' => '𐳙', + '𐲚' => '𐳚', + '𐲛' => '𐳛', + '𐲜' => '𐳜', + '𐲝' => '𐳝', + '𐲞' => '𐳞', + '𐲟' => '𐳟', + '𐲠' => '𐳠', + '𐲡' => '𐳡', + '𐲢' => '𐳢', + '𐲣' => '𐳣', + '𐲤' => '𐳤', + '𐲥' => '𐳥', + '𐲦' => '𐳦', + '𐲧' => '𐳧', + '𐲨' => '𐳨', + '𐲩' => '𐳩', + '𐲪' => '𐳪', + '𐲫' => '𐳫', + '𐲬' => '𐳬', + '𐲭' => '𐳭', + '𐲮' => '𐳮', + '𐲯' => '𐳯', + '𐲰' => '𐳰', + '𐲱' => '𐳱', + '𐲲' => '𐳲', + '𑢠' => '𑣀', + '𑢡' => '𑣁', + '𑢢' => '𑣂', + '𑢣' => '𑣃', + '𑢤' => '𑣄', + '𑢥' => '𑣅', + '𑢦' => '𑣆', + '𑢧' => '𑣇', + '𑢨' => '𑣈', + '𑢩' => '𑣉', + '𑢪' => '𑣊', + '𑢫' => '𑣋', + '𑢬' => '𑣌', + '𑢭' => '𑣍', + '𑢮' => '𑣎', + '𑢯' => '𑣏', + '𑢰' => '𑣐', + '𑢱' => '𑣑', + '𑢲' => '𑣒', + '𑢳' => '𑣓', + '𑢴' => '𑣔', + '𑢵' => '𑣕', + '𑢶' => '𑣖', + '𑢷' => '𑣗', + '𑢸' => '𑣘', + '𑢹' => '𑣙', + '𑢺' => '𑣚', + '𑢻' => '𑣛', + '𑢼' => '𑣜', + '𑢽' => '𑣝', + '𑢾' => '𑣞', + '𑢿' => '𑣟', + '𖹀' => '𖹠', + '𖹁' => '𖹡', + '𖹂' => '𖹢', + '𖹃' => '𖹣', + '𖹄' => '𖹤', + '𖹅' => '𖹥', + '𖹆' => '𖹦', + '𖹇' => '𖹧', + '𖹈' => '𖹨', + '𖹉' => '𖹩', + '𖹊' => '𖹪', + '𖹋' => '𖹫', + '𖹌' => '𖹬', + '𖹍' => '𖹭', + '𖹎' => '𖹮', + '𖹏' => '𖹯', + '𖹐' => '𖹰', + '𖹑' => '𖹱', + '𖹒' => '𖹲', + '𖹓' => '𖹳', + '𖹔' => '𖹴', + '𖹕' => '𖹵', + '𖹖' => '𖹶', + '𖹗' => '𖹷', + '𖹘' => '𖹸', + '𖹙' => '𖹹', + '𖹚' => '𖹺', + '𖹛' => '𖹻', + '𖹜' => '𖹼', + '𖹝' => '𖹽', + '𖹞' => '𖹾', + '𖹟' => '𖹿', + '𞤀' => '𞤢', + '𞤁' => '𞤣', + '𞤂' => '𞤤', + '𞤃' => '𞤥', + '𞤄' => '𞤦', + '𞤅' => '𞤧', + '𞤆' => '𞤨', + '𞤇' => '𞤩', + '𞤈' => '𞤪', + '𞤉' => '𞤫', + '𞤊' => '𞤬', + '𞤋' => '𞤭', + '𞤌' => '𞤮', + '𞤍' => '𞤯', + '𞤎' => '𞤰', + '𞤏' => '𞤱', + '𞤐' => '𞤲', + '𞤑' => '𞤳', + '𞤒' => '𞤴', + '𞤓' => '𞤵', + '𞤔' => '𞤶', + '𞤕' => '𞤷', + '𞤖' => '𞤸', + '𞤗' => '𞤹', + '𞤘' => '𞤺', + '𞤙' => '𞤻', + '𞤚' => '𞤼', + '𞤛' => '𞤽', + '𞤜' => '𞤾', + '𞤝' => '𞤿', + '𞤞' => '𞥀', + '𞤟' => '𞥁', + '𞤠' => '𞥂', + '𞤡' => '𞥃', +); diff --git a/upLoadImage/vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php b/upLoadImage/vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php new file mode 100644 index 0000000..2a8f6e7 --- /dev/null +++ b/upLoadImage/vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php @@ -0,0 +1,5 @@ + 'A', + 'b' => 'B', + 'c' => 'C', + 'd' => 'D', + 'e' => 'E', + 'f' => 'F', + 'g' => 'G', + 'h' => 'H', + 'i' => 'I', + 'j' => 'J', + 'k' => 'K', + 'l' => 'L', + 'm' => 'M', + 'n' => 'N', + 'o' => 'O', + 'p' => 'P', + 'q' => 'Q', + 'r' => 'R', + 's' => 'S', + 't' => 'T', + 'u' => 'U', + 'v' => 'V', + 'w' => 'W', + 'x' => 'X', + 'y' => 'Y', + 'z' => 'Z', + 'µ' => 'Μ', + 'à' => 'À', + 'á' => 'Á', + 'â' => 'Â', + 'ã' => 'Ã', + 'ä' => 'Ä', + 'å' => 'Å', + 'æ' => 'Æ', + 'ç' => 'Ç', + 'è' => 'È', + 'é' => 'É', + 'ê' => 'Ê', + 'ë' => 'Ë', + 'ì' => 'Ì', + 'í' => 'Í', + 'î' => 'Î', + 'ï' => 'Ï', + 'ð' => 'Ð', + 'ñ' => 'Ñ', + 'ò' => 'Ò', + 'ó' => 'Ó', + 'ô' => 'Ô', + 'õ' => 'Õ', + 'ö' => 'Ö', + 'ø' => 'Ø', + 'ù' => 'Ù', + 'ú' => 'Ú', + 'û' => 'Û', + 'ü' => 'Ü', + 'ý' => 'Ý', + 'þ' => 'Þ', + 'ÿ' => 'Ÿ', + 'ā' => 'Ā', + 'ă' => 'Ă', + 'ą' => 'Ą', + 'ć' => 'Ć', + 'ĉ' => 'Ĉ', + 'ċ' => 'Ċ', + 'č' => 'Č', + 'ď' => 'Ď', + 'đ' => 'Đ', + 'ē' => 'Ē', + 'ĕ' => 'Ĕ', + 'ė' => 'Ė', + 'ę' => 'Ę', + 'ě' => 'Ě', + 'ĝ' => 'Ĝ', + 'ğ' => 'Ğ', + 'ġ' => 'Ġ', + 'ģ' => 'Ģ', + 'ĥ' => 'Ĥ', + 'ħ' => 'Ħ', + 'ĩ' => 'Ĩ', + 'ī' => 'Ī', + 'ĭ' => 'Ĭ', + 'į' => 'Į', + 'ı' => 'I', + 'ij' => 'IJ', + 'ĵ' => 'Ĵ', + 'ķ' => 'Ķ', + 'ĺ' => 'Ĺ', + 'ļ' => 'Ļ', + 'ľ' => 'Ľ', + 'ŀ' => 'Ŀ', + 'ł' => 'Ł', + 'ń' => 'Ń', + 'ņ' => 'Ņ', + 'ň' => 'Ň', + 'ŋ' => 'Ŋ', + 'ō' => 'Ō', + 'ŏ' => 'Ŏ', + 'ő' => 'Ő', + 'œ' => 'Œ', + 'ŕ' => 'Ŕ', + 'ŗ' => 'Ŗ', + 'ř' => 'Ř', + 'ś' => 'Ś', + 'ŝ' => 'Ŝ', + 'ş' => 'Ş', + 'š' => 'Š', + 'ţ' => 'Ţ', + 'ť' => 'Ť', + 'ŧ' => 'Ŧ', + 'ũ' => 'Ũ', + 'ū' => 'Ū', + 'ŭ' => 'Ŭ', + 'ů' => 'Ů', + 'ű' => 'Ű', + 'ų' => 'Ų', + 'ŵ' => 'Ŵ', + 'ŷ' => 'Ŷ', + 'ź' => 'Ź', + 'ż' => 'Ż', + 'ž' => 'Ž', + 'ſ' => 'S', + 'ƀ' => 'Ƀ', + 'ƃ' => 'Ƃ', + 'ƅ' => 'Ƅ', + 'ƈ' => 'Ƈ', + 'ƌ' => 'Ƌ', + 'ƒ' => 'Ƒ', + 'ƕ' => 'Ƕ', + 'ƙ' => 'Ƙ', + 'ƚ' => 'Ƚ', + 'ƞ' => 'Ƞ', + 'ơ' => 'Ơ', + 'ƣ' => 'Ƣ', + 'ƥ' => 'Ƥ', + 'ƨ' => 'Ƨ', + 'ƭ' => 'Ƭ', + 'ư' => 'Ư', + 'ƴ' => 'Ƴ', + 'ƶ' => 'Ƶ', + 'ƹ' => 'Ƹ', + 'ƽ' => 'Ƽ', + 'ƿ' => 'Ƿ', + 'Dž' => 'DŽ', + 'dž' => 'DŽ', + 'Lj' => 'LJ', + 'lj' => 'LJ', + 'Nj' => 'NJ', + 'nj' => 'NJ', + 'ǎ' => 'Ǎ', + 'ǐ' => 'Ǐ', + 'ǒ' => 'Ǒ', + 'ǔ' => 'Ǔ', + 'ǖ' => 'Ǖ', + 'ǘ' => 'Ǘ', + 'ǚ' => 'Ǚ', + 'ǜ' => 'Ǜ', + 'ǝ' => 'Ǝ', + 'ǟ' => 'Ǟ', + 'ǡ' => 'Ǡ', + 'ǣ' => 'Ǣ', + 'ǥ' => 'Ǥ', + 'ǧ' => 'Ǧ', + 'ǩ' => 'Ǩ', + 'ǫ' => 'Ǫ', + 'ǭ' => 'Ǭ', + 'ǯ' => 'Ǯ', + 'Dz' => 'DZ', + 'dz' => 'DZ', + 'ǵ' => 'Ǵ', + 'ǹ' => 'Ǹ', + 'ǻ' => 'Ǻ', + 'ǽ' => 'Ǽ', + 'ǿ' => 'Ǿ', + 'ȁ' => 'Ȁ', + 'ȃ' => 'Ȃ', + 'ȅ' => 'Ȅ', + 'ȇ' => 'Ȇ', + 'ȉ' => 'Ȉ', + 'ȋ' => 'Ȋ', + 'ȍ' => 'Ȍ', + 'ȏ' => 'Ȏ', + 'ȑ' => 'Ȑ', + 'ȓ' => 'Ȓ', + 'ȕ' => 'Ȕ', + 'ȗ' => 'Ȗ', + 'ș' => 'Ș', + 'ț' => 'Ț', + 'ȝ' => 'Ȝ', + 'ȟ' => 'Ȟ', + 'ȣ' => 'Ȣ', + 'ȥ' => 'Ȥ', + 'ȧ' => 'Ȧ', + 'ȩ' => 'Ȩ', + 'ȫ' => 'Ȫ', + 'ȭ' => 'Ȭ', + 'ȯ' => 'Ȯ', + 'ȱ' => 'Ȱ', + 'ȳ' => 'Ȳ', + 'ȼ' => 'Ȼ', + 'ȿ' => 'Ȿ', + 'ɀ' => 'Ɀ', + 'ɂ' => 'Ɂ', + 'ɇ' => 'Ɇ', + 'ɉ' => 'Ɉ', + 'ɋ' => 'Ɋ', + 'ɍ' => 'Ɍ', + 'ɏ' => 'Ɏ', + 'ɐ' => 'Ɐ', + 'ɑ' => 'Ɑ', + 'ɒ' => 'Ɒ', + 'ɓ' => 'Ɓ', + 'ɔ' => 'Ɔ', + 'ɖ' => 'Ɖ', + 'ɗ' => 'Ɗ', + 'ə' => 'Ə', + 'ɛ' => 'Ɛ', + 'ɜ' => 'Ɜ', + 'ɠ' => 'Ɠ', + 'ɡ' => 'Ɡ', + 'ɣ' => 'Ɣ', + 'ɥ' => 'Ɥ', + 'ɦ' => 'Ɦ', + 'ɨ' => 'Ɨ', + 'ɩ' => 'Ɩ', + 'ɪ' => 'Ɪ', + 'ɫ' => 'Ɫ', + 'ɬ' => 'Ɬ', + 'ɯ' => 'Ɯ', + 'ɱ' => 'Ɱ', + 'ɲ' => 'Ɲ', + 'ɵ' => 'Ɵ', + 'ɽ' => 'Ɽ', + 'ʀ' => 'Ʀ', + 'ʂ' => 'Ʂ', + 'ʃ' => 'Ʃ', + 'ʇ' => 'Ʇ', + 'ʈ' => 'Ʈ', + 'ʉ' => 'Ʉ', + 'ʊ' => 'Ʊ', + 'ʋ' => 'Ʋ', + 'ʌ' => 'Ʌ', + 'ʒ' => 'Ʒ', + 'ʝ' => 'Ʝ', + 'ʞ' => 'Ʞ', + 'ͅ' => 'Ι', + 'ͱ' => 'Ͱ', + 'ͳ' => 'Ͳ', + 'ͷ' => 'Ͷ', + 'ͻ' => 'Ͻ', + 'ͼ' => 'Ͼ', + 'ͽ' => 'Ͽ', + 'ά' => 'Ά', + 'έ' => 'Έ', + 'ή' => 'Ή', + 'ί' => 'Ί', + 'α' => 'Α', + 'β' => 'Β', + 'γ' => 'Γ', + 'δ' => 'Δ', + 'ε' => 'Ε', + 'ζ' => 'Ζ', + 'η' => 'Η', + 'θ' => 'Θ', + 'ι' => 'Ι', + 'κ' => 'Κ', + 'λ' => 'Λ', + 'μ' => 'Μ', + 'ν' => 'Ν', + 'ξ' => 'Ξ', + 'ο' => 'Ο', + 'π' => 'Π', + 'ρ' => 'Ρ', + 'ς' => 'Σ', + 'σ' => 'Σ', + 'τ' => 'Τ', + 'υ' => 'Υ', + 'φ' => 'Φ', + 'χ' => 'Χ', + 'ψ' => 'Ψ', + 'ω' => 'Ω', + 'ϊ' => 'Ϊ', + 'ϋ' => 'Ϋ', + 'ό' => 'Ό', + 'ύ' => 'Ύ', + 'ώ' => 'Ώ', + 'ϐ' => 'Β', + 'ϑ' => 'Θ', + 'ϕ' => 'Φ', + 'ϖ' => 'Π', + 'ϗ' => 'Ϗ', + 'ϙ' => 'Ϙ', + 'ϛ' => 'Ϛ', + 'ϝ' => 'Ϝ', + 'ϟ' => 'Ϟ', + 'ϡ' => 'Ϡ', + 'ϣ' => 'Ϣ', + 'ϥ' => 'Ϥ', + 'ϧ' => 'Ϧ', + 'ϩ' => 'Ϩ', + 'ϫ' => 'Ϫ', + 'ϭ' => 'Ϭ', + 'ϯ' => 'Ϯ', + 'ϰ' => 'Κ', + 'ϱ' => 'Ρ', + 'ϲ' => 'Ϲ', + 'ϳ' => 'Ϳ', + 'ϵ' => 'Ε', + 'ϸ' => 'Ϸ', + 'ϻ' => 'Ϻ', + 'а' => 'А', + 'б' => 'Б', + 'в' => 'В', + 'г' => 'Г', + 'д' => 'Д', + 'е' => 'Е', + 'ж' => 'Ж', + 'з' => 'З', + 'и' => 'И', + 'й' => 'Й', + 'к' => 'К', + 'л' => 'Л', + 'м' => 'М', + 'н' => 'Н', + 'о' => 'О', + 'п' => 'П', + 'р' => 'Р', + 'с' => 'С', + 'т' => 'Т', + 'у' => 'У', + 'ф' => 'Ф', + 'х' => 'Х', + 'ц' => 'Ц', + 'ч' => 'Ч', + 'ш' => 'Ш', + 'щ' => 'Щ', + 'ъ' => 'Ъ', + 'ы' => 'Ы', + 'ь' => 'Ь', + 'э' => 'Э', + 'ю' => 'Ю', + 'я' => 'Я', + 'ѐ' => 'Ѐ', + 'ё' => 'Ё', + 'ђ' => 'Ђ', + 'ѓ' => 'Ѓ', + 'є' => 'Є', + 'ѕ' => 'Ѕ', + 'і' => 'І', + 'ї' => 'Ї', + 'ј' => 'Ј', + 'љ' => 'Љ', + 'њ' => 'Њ', + 'ћ' => 'Ћ', + 'ќ' => 'Ќ', + 'ѝ' => 'Ѝ', + 'ў' => 'Ў', + 'џ' => 'Џ', + 'ѡ' => 'Ѡ', + 'ѣ' => 'Ѣ', + 'ѥ' => 'Ѥ', + 'ѧ' => 'Ѧ', + 'ѩ' => 'Ѩ', + 'ѫ' => 'Ѫ', + 'ѭ' => 'Ѭ', + 'ѯ' => 'Ѯ', + 'ѱ' => 'Ѱ', + 'ѳ' => 'Ѳ', + 'ѵ' => 'Ѵ', + 'ѷ' => 'Ѷ', + 'ѹ' => 'Ѹ', + 'ѻ' => 'Ѻ', + 'ѽ' => 'Ѽ', + 'ѿ' => 'Ѿ', + 'ҁ' => 'Ҁ', + 'ҋ' => 'Ҋ', + 'ҍ' => 'Ҍ', + 'ҏ' => 'Ҏ', + 'ґ' => 'Ґ', + 'ғ' => 'Ғ', + 'ҕ' => 'Ҕ', + 'җ' => 'Җ', + 'ҙ' => 'Ҙ', + 'қ' => 'Қ', + 'ҝ' => 'Ҝ', + 'ҟ' => 'Ҟ', + 'ҡ' => 'Ҡ', + 'ң' => 'Ң', + 'ҥ' => 'Ҥ', + 'ҧ' => 'Ҧ', + 'ҩ' => 'Ҩ', + 'ҫ' => 'Ҫ', + 'ҭ' => 'Ҭ', + 'ү' => 'Ү', + 'ұ' => 'Ұ', + 'ҳ' => 'Ҳ', + 'ҵ' => 'Ҵ', + 'ҷ' => 'Ҷ', + 'ҹ' => 'Ҹ', + 'һ' => 'Һ', + 'ҽ' => 'Ҽ', + 'ҿ' => 'Ҿ', + 'ӂ' => 'Ӂ', + 'ӄ' => 'Ӄ', + 'ӆ' => 'Ӆ', + 'ӈ' => 'Ӈ', + 'ӊ' => 'Ӊ', + 'ӌ' => 'Ӌ', + 'ӎ' => 'Ӎ', + 'ӏ' => 'Ӏ', + 'ӑ' => 'Ӑ', + 'ӓ' => 'Ӓ', + 'ӕ' => 'Ӕ', + 'ӗ' => 'Ӗ', + 'ә' => 'Ә', + 'ӛ' => 'Ӛ', + 'ӝ' => 'Ӝ', + 'ӟ' => 'Ӟ', + 'ӡ' => 'Ӡ', + 'ӣ' => 'Ӣ', + 'ӥ' => 'Ӥ', + 'ӧ' => 'Ӧ', + 'ө' => 'Ө', + 'ӫ' => 'Ӫ', + 'ӭ' => 'Ӭ', + 'ӯ' => 'Ӯ', + 'ӱ' => 'Ӱ', + 'ӳ' => 'Ӳ', + 'ӵ' => 'Ӵ', + 'ӷ' => 'Ӷ', + 'ӹ' => 'Ӹ', + 'ӻ' => 'Ӻ', + 'ӽ' => 'Ӽ', + 'ӿ' => 'Ӿ', + 'ԁ' => 'Ԁ', + 'ԃ' => 'Ԃ', + 'ԅ' => 'Ԅ', + 'ԇ' => 'Ԇ', + 'ԉ' => 'Ԉ', + 'ԋ' => 'Ԋ', + 'ԍ' => 'Ԍ', + 'ԏ' => 'Ԏ', + 'ԑ' => 'Ԑ', + 'ԓ' => 'Ԓ', + 'ԕ' => 'Ԕ', + 'ԗ' => 'Ԗ', + 'ԙ' => 'Ԙ', + 'ԛ' => 'Ԛ', + 'ԝ' => 'Ԝ', + 'ԟ' => 'Ԟ', + 'ԡ' => 'Ԡ', + 'ԣ' => 'Ԣ', + 'ԥ' => 'Ԥ', + 'ԧ' => 'Ԧ', + 'ԩ' => 'Ԩ', + 'ԫ' => 'Ԫ', + 'ԭ' => 'Ԭ', + 'ԯ' => 'Ԯ', + 'ա' => 'Ա', + 'բ' => 'Բ', + 'գ' => 'Գ', + 'դ' => 'Դ', + 'ե' => 'Ե', + 'զ' => 'Զ', + 'է' => 'Է', + 'ը' => 'Ը', + 'թ' => 'Թ', + 'ժ' => 'Ժ', + 'ի' => 'Ի', + 'լ' => 'Լ', + 'խ' => 'Խ', + 'ծ' => 'Ծ', + 'կ' => 'Կ', + 'հ' => 'Հ', + 'ձ' => 'Ձ', + 'ղ' => 'Ղ', + 'ճ' => 'Ճ', + 'մ' => 'Մ', + 'յ' => 'Յ', + 'ն' => 'Ն', + 'շ' => 'Շ', + 'ո' => 'Ո', + 'չ' => 'Չ', + 'պ' => 'Պ', + 'ջ' => 'Ջ', + 'ռ' => 'Ռ', + 'ս' => 'Ս', + 'վ' => 'Վ', + 'տ' => 'Տ', + 'ր' => 'Ր', + 'ց' => 'Ց', + 'ւ' => 'Ւ', + 'փ' => 'Փ', + 'ք' => 'Ք', + 'օ' => 'Օ', + 'ֆ' => 'Ֆ', + 'ა' => 'Ა', + 'ბ' => 'Ბ', + 'გ' => 'Გ', + 'დ' => 'Დ', + 'ე' => 'Ე', + 'ვ' => 'Ვ', + 'ზ' => 'Ზ', + 'თ' => 'Თ', + 'ი' => 'Ი', + 'კ' => 'Კ', + 'ლ' => 'Ლ', + 'მ' => 'Მ', + 'ნ' => 'Ნ', + 'ო' => 'Ო', + 'პ' => 'Პ', + 'ჟ' => 'Ჟ', + 'რ' => 'Რ', + 'ს' => 'Ს', + 'ტ' => 'Ტ', + 'უ' => 'Უ', + 'ფ' => 'Ფ', + 'ქ' => 'Ქ', + 'ღ' => 'Ღ', + 'ყ' => 'Ყ', + 'შ' => 'Შ', + 'ჩ' => 'Ჩ', + 'ც' => 'Ც', + 'ძ' => 'Ძ', + 'წ' => 'Წ', + 'ჭ' => 'Ჭ', + 'ხ' => 'Ხ', + 'ჯ' => 'Ჯ', + 'ჰ' => 'Ჰ', + 'ჱ' => 'Ჱ', + 'ჲ' => 'Ჲ', + 'ჳ' => 'Ჳ', + 'ჴ' => 'Ჴ', + 'ჵ' => 'Ჵ', + 'ჶ' => 'Ჶ', + 'ჷ' => 'Ჷ', + 'ჸ' => 'Ჸ', + 'ჹ' => 'Ჹ', + 'ჺ' => 'Ჺ', + 'ჽ' => 'Ჽ', + 'ჾ' => 'Ჾ', + 'ჿ' => 'Ჿ', + 'ᏸ' => 'Ᏸ', + 'ᏹ' => 'Ᏹ', + 'ᏺ' => 'Ᏺ', + 'ᏻ' => 'Ᏻ', + 'ᏼ' => 'Ᏼ', + 'ᏽ' => 'Ᏽ', + 'ᲀ' => 'В', + 'ᲁ' => 'Д', + 'ᲂ' => 'О', + 'ᲃ' => 'С', + 'ᲄ' => 'Т', + 'ᲅ' => 'Т', + 'ᲆ' => 'Ъ', + 'ᲇ' => 'Ѣ', + 'ᲈ' => 'Ꙋ', + 'ᵹ' => 'Ᵹ', + 'ᵽ' => 'Ᵽ', + 'ᶎ' => 'Ᶎ', + 'ḁ' => 'Ḁ', + 'ḃ' => 'Ḃ', + 'ḅ' => 'Ḅ', + 'ḇ' => 'Ḇ', + 'ḉ' => 'Ḉ', + 'ḋ' => 'Ḋ', + 'ḍ' => 'Ḍ', + 'ḏ' => 'Ḏ', + 'ḑ' => 'Ḑ', + 'ḓ' => 'Ḓ', + 'ḕ' => 'Ḕ', + 'ḗ' => 'Ḗ', + 'ḙ' => 'Ḙ', + 'ḛ' => 'Ḛ', + 'ḝ' => 'Ḝ', + 'ḟ' => 'Ḟ', + 'ḡ' => 'Ḡ', + 'ḣ' => 'Ḣ', + 'ḥ' => 'Ḥ', + 'ḧ' => 'Ḧ', + 'ḩ' => 'Ḩ', + 'ḫ' => 'Ḫ', + 'ḭ' => 'Ḭ', + 'ḯ' => 'Ḯ', + 'ḱ' => 'Ḱ', + 'ḳ' => 'Ḳ', + 'ḵ' => 'Ḵ', + 'ḷ' => 'Ḷ', + 'ḹ' => 'Ḹ', + 'ḻ' => 'Ḻ', + 'ḽ' => 'Ḽ', + 'ḿ' => 'Ḿ', + 'ṁ' => 'Ṁ', + 'ṃ' => 'Ṃ', + 'ṅ' => 'Ṅ', + 'ṇ' => 'Ṇ', + 'ṉ' => 'Ṉ', + 'ṋ' => 'Ṋ', + 'ṍ' => 'Ṍ', + 'ṏ' => 'Ṏ', + 'ṑ' => 'Ṑ', + 'ṓ' => 'Ṓ', + 'ṕ' => 'Ṕ', + 'ṗ' => 'Ṗ', + 'ṙ' => 'Ṙ', + 'ṛ' => 'Ṛ', + 'ṝ' => 'Ṝ', + 'ṟ' => 'Ṟ', + 'ṡ' => 'Ṡ', + 'ṣ' => 'Ṣ', + 'ṥ' => 'Ṥ', + 'ṧ' => 'Ṧ', + 'ṩ' => 'Ṩ', + 'ṫ' => 'Ṫ', + 'ṭ' => 'Ṭ', + 'ṯ' => 'Ṯ', + 'ṱ' => 'Ṱ', + 'ṳ' => 'Ṳ', + 'ṵ' => 'Ṵ', + 'ṷ' => 'Ṷ', + 'ṹ' => 'Ṹ', + 'ṻ' => 'Ṻ', + 'ṽ' => 'Ṽ', + 'ṿ' => 'Ṿ', + 'ẁ' => 'Ẁ', + 'ẃ' => 'Ẃ', + 'ẅ' => 'Ẅ', + 'ẇ' => 'Ẇ', + 'ẉ' => 'Ẉ', + 'ẋ' => 'Ẋ', + 'ẍ' => 'Ẍ', + 'ẏ' => 'Ẏ', + 'ẑ' => 'Ẑ', + 'ẓ' => 'Ẓ', + 'ẕ' => 'Ẕ', + 'ẛ' => 'Ṡ', + 'ạ' => 'Ạ', + 'ả' => 'Ả', + 'ấ' => 'Ấ', + 'ầ' => 'Ầ', + 'ẩ' => 'Ẩ', + 'ẫ' => 'Ẫ', + 'ậ' => 'Ậ', + 'ắ' => 'Ắ', + 'ằ' => 'Ằ', + 'ẳ' => 'Ẳ', + 'ẵ' => 'Ẵ', + 'ặ' => 'Ặ', + 'ẹ' => 'Ẹ', + 'ẻ' => 'Ẻ', + 'ẽ' => 'Ẽ', + 'ế' => 'Ế', + 'ề' => 'Ề', + 'ể' => 'Ể', + 'ễ' => 'Ễ', + 'ệ' => 'Ệ', + 'ỉ' => 'Ỉ', + 'ị' => 'Ị', + 'ọ' => 'Ọ', + 'ỏ' => 'Ỏ', + 'ố' => 'Ố', + 'ồ' => 'Ồ', + 'ổ' => 'Ổ', + 'ỗ' => 'Ỗ', + 'ộ' => 'Ộ', + 'ớ' => 'Ớ', + 'ờ' => 'Ờ', + 'ở' => 'Ở', + 'ỡ' => 'Ỡ', + 'ợ' => 'Ợ', + 'ụ' => 'Ụ', + 'ủ' => 'Ủ', + 'ứ' => 'Ứ', + 'ừ' => 'Ừ', + 'ử' => 'Ử', + 'ữ' => 'Ữ', + 'ự' => 'Ự', + 'ỳ' => 'Ỳ', + 'ỵ' => 'Ỵ', + 'ỷ' => 'Ỷ', + 'ỹ' => 'Ỹ', + 'ỻ' => 'Ỻ', + 'ỽ' => 'Ỽ', + 'ỿ' => 'Ỿ', + 'ἀ' => 'Ἀ', + 'ἁ' => 'Ἁ', + 'ἂ' => 'Ἂ', + 'ἃ' => 'Ἃ', + 'ἄ' => 'Ἄ', + 'ἅ' => 'Ἅ', + 'ἆ' => 'Ἆ', + 'ἇ' => 'Ἇ', + 'ἐ' => 'Ἐ', + 'ἑ' => 'Ἑ', + 'ἒ' => 'Ἒ', + 'ἓ' => 'Ἓ', + 'ἔ' => 'Ἔ', + 'ἕ' => 'Ἕ', + 'ἠ' => 'Ἠ', + 'ἡ' => 'Ἡ', + 'ἢ' => 'Ἢ', + 'ἣ' => 'Ἣ', + 'ἤ' => 'Ἤ', + 'ἥ' => 'Ἥ', + 'ἦ' => 'Ἦ', + 'ἧ' => 'Ἧ', + 'ἰ' => 'Ἰ', + 'ἱ' => 'Ἱ', + 'ἲ' => 'Ἲ', + 'ἳ' => 'Ἳ', + 'ἴ' => 'Ἴ', + 'ἵ' => 'Ἵ', + 'ἶ' => 'Ἶ', + 'ἷ' => 'Ἷ', + 'ὀ' => 'Ὀ', + 'ὁ' => 'Ὁ', + 'ὂ' => 'Ὂ', + 'ὃ' => 'Ὃ', + 'ὄ' => 'Ὄ', + 'ὅ' => 'Ὅ', + 'ὑ' => 'Ὑ', + 'ὓ' => 'Ὓ', + 'ὕ' => 'Ὕ', + 'ὗ' => 'Ὗ', + 'ὠ' => 'Ὠ', + 'ὡ' => 'Ὡ', + 'ὢ' => 'Ὢ', + 'ὣ' => 'Ὣ', + 'ὤ' => 'Ὤ', + 'ὥ' => 'Ὥ', + 'ὦ' => 'Ὦ', + 'ὧ' => 'Ὧ', + 'ὰ' => 'Ὰ', + 'ά' => 'Ά', + 'ὲ' => 'Ὲ', + 'έ' => 'Έ', + 'ὴ' => 'Ὴ', + 'ή' => 'Ή', + 'ὶ' => 'Ὶ', + 'ί' => 'Ί', + 'ὸ' => 'Ὸ', + 'ό' => 'Ό', + 'ὺ' => 'Ὺ', + 'ύ' => 'Ύ', + 'ὼ' => 'Ὼ', + 'ώ' => 'Ώ', + 'ᾀ' => 'ἈΙ', + 'ᾁ' => 'ἉΙ', + 'ᾂ' => 'ἊΙ', + 'ᾃ' => 'ἋΙ', + 'ᾄ' => 'ἌΙ', + 'ᾅ' => 'ἍΙ', + 'ᾆ' => 'ἎΙ', + 'ᾇ' => 'ἏΙ', + 'ᾐ' => 'ἨΙ', + 'ᾑ' => 'ἩΙ', + 'ᾒ' => 'ἪΙ', + 'ᾓ' => 'ἫΙ', + 'ᾔ' => 'ἬΙ', + 'ᾕ' => 'ἭΙ', + 'ᾖ' => 'ἮΙ', + 'ᾗ' => 'ἯΙ', + 'ᾠ' => 'ὨΙ', + 'ᾡ' => 'ὩΙ', + 'ᾢ' => 'ὪΙ', + 'ᾣ' => 'ὫΙ', + 'ᾤ' => 'ὬΙ', + 'ᾥ' => 'ὭΙ', + 'ᾦ' => 'ὮΙ', + 'ᾧ' => 'ὯΙ', + 'ᾰ' => 'Ᾰ', + 'ᾱ' => 'Ᾱ', + 'ᾳ' => 'ΑΙ', + 'ι' => 'Ι', + 'ῃ' => 'ΗΙ', + 'ῐ' => 'Ῐ', + 'ῑ' => 'Ῑ', + 'ῠ' => 'Ῠ', + 'ῡ' => 'Ῡ', + 'ῥ' => 'Ῥ', + 'ῳ' => 'ΩΙ', + 'ⅎ' => 'Ⅎ', + 'ⅰ' => 'Ⅰ', + 'ⅱ' => 'Ⅱ', + 'ⅲ' => 'Ⅲ', + 'ⅳ' => 'Ⅳ', + 'ⅴ' => 'Ⅴ', + 'ⅵ' => 'Ⅵ', + 'ⅶ' => 'Ⅶ', + 'ⅷ' => 'Ⅷ', + 'ⅸ' => 'Ⅸ', + 'ⅹ' => 'Ⅹ', + 'ⅺ' => 'Ⅺ', + 'ⅻ' => 'Ⅻ', + 'ⅼ' => 'Ⅼ', + 'ⅽ' => 'Ⅽ', + 'ⅾ' => 'Ⅾ', + 'ⅿ' => 'Ⅿ', + 'ↄ' => 'Ↄ', + 'ⓐ' => 'Ⓐ', + 'ⓑ' => 'Ⓑ', + 'ⓒ' => 'Ⓒ', + 'ⓓ' => 'Ⓓ', + 'ⓔ' => 'Ⓔ', + 'ⓕ' => 'Ⓕ', + 'ⓖ' => 'Ⓖ', + 'ⓗ' => 'Ⓗ', + 'ⓘ' => 'Ⓘ', + 'ⓙ' => 'Ⓙ', + 'ⓚ' => 'Ⓚ', + 'ⓛ' => 'Ⓛ', + 'ⓜ' => 'Ⓜ', + 'ⓝ' => 'Ⓝ', + 'ⓞ' => 'Ⓞ', + 'ⓟ' => 'Ⓟ', + 'ⓠ' => 'Ⓠ', + 'ⓡ' => 'Ⓡ', + 'ⓢ' => 'Ⓢ', + 'ⓣ' => 'Ⓣ', + 'ⓤ' => 'Ⓤ', + 'ⓥ' => 'Ⓥ', + 'ⓦ' => 'Ⓦ', + 'ⓧ' => 'Ⓧ', + 'ⓨ' => 'Ⓨ', + 'ⓩ' => 'Ⓩ', + 'ⰰ' => 'Ⰰ', + 'ⰱ' => 'Ⰱ', + 'ⰲ' => 'Ⰲ', + 'ⰳ' => 'Ⰳ', + 'ⰴ' => 'Ⰴ', + 'ⰵ' => 'Ⰵ', + 'ⰶ' => 'Ⰶ', + 'ⰷ' => 'Ⰷ', + 'ⰸ' => 'Ⰸ', + 'ⰹ' => 'Ⰹ', + 'ⰺ' => 'Ⰺ', + 'ⰻ' => 'Ⰻ', + 'ⰼ' => 'Ⰼ', + 'ⰽ' => 'Ⰽ', + 'ⰾ' => 'Ⰾ', + 'ⰿ' => 'Ⰿ', + 'ⱀ' => 'Ⱀ', + 'ⱁ' => 'Ⱁ', + 'ⱂ' => 'Ⱂ', + 'ⱃ' => 'Ⱃ', + 'ⱄ' => 'Ⱄ', + 'ⱅ' => 'Ⱅ', + 'ⱆ' => 'Ⱆ', + 'ⱇ' => 'Ⱇ', + 'ⱈ' => 'Ⱈ', + 'ⱉ' => 'Ⱉ', + 'ⱊ' => 'Ⱊ', + 'ⱋ' => 'Ⱋ', + 'ⱌ' => 'Ⱌ', + 'ⱍ' => 'Ⱍ', + 'ⱎ' => 'Ⱎ', + 'ⱏ' => 'Ⱏ', + 'ⱐ' => 'Ⱐ', + 'ⱑ' => 'Ⱑ', + 'ⱒ' => 'Ⱒ', + 'ⱓ' => 'Ⱓ', + 'ⱔ' => 'Ⱔ', + 'ⱕ' => 'Ⱕ', + 'ⱖ' => 'Ⱖ', + 'ⱗ' => 'Ⱗ', + 'ⱘ' => 'Ⱘ', + 'ⱙ' => 'Ⱙ', + 'ⱚ' => 'Ⱚ', + 'ⱛ' => 'Ⱛ', + 'ⱜ' => 'Ⱜ', + 'ⱝ' => 'Ⱝ', + 'ⱞ' => 'Ⱞ', + 'ⱡ' => 'Ⱡ', + 'ⱥ' => 'Ⱥ', + 'ⱦ' => 'Ⱦ', + 'ⱨ' => 'Ⱨ', + 'ⱪ' => 'Ⱪ', + 'ⱬ' => 'Ⱬ', + 'ⱳ' => 'Ⱳ', + 'ⱶ' => 'Ⱶ', + 'ⲁ' => 'Ⲁ', + 'ⲃ' => 'Ⲃ', + 'ⲅ' => 'Ⲅ', + 'ⲇ' => 'Ⲇ', + 'ⲉ' => 'Ⲉ', + 'ⲋ' => 'Ⲋ', + 'ⲍ' => 'Ⲍ', + 'ⲏ' => 'Ⲏ', + 'ⲑ' => 'Ⲑ', + 'ⲓ' => 'Ⲓ', + 'ⲕ' => 'Ⲕ', + 'ⲗ' => 'Ⲗ', + 'ⲙ' => 'Ⲙ', + 'ⲛ' => 'Ⲛ', + 'ⲝ' => 'Ⲝ', + 'ⲟ' => 'Ⲟ', + 'ⲡ' => 'Ⲡ', + 'ⲣ' => 'Ⲣ', + 'ⲥ' => 'Ⲥ', + 'ⲧ' => 'Ⲧ', + 'ⲩ' => 'Ⲩ', + 'ⲫ' => 'Ⲫ', + 'ⲭ' => 'Ⲭ', + 'ⲯ' => 'Ⲯ', + 'ⲱ' => 'Ⲱ', + 'ⲳ' => 'Ⲳ', + 'ⲵ' => 'Ⲵ', + 'ⲷ' => 'Ⲷ', + 'ⲹ' => 'Ⲹ', + 'ⲻ' => 'Ⲻ', + 'ⲽ' => 'Ⲽ', + 'ⲿ' => 'Ⲿ', + 'ⳁ' => 'Ⳁ', + 'ⳃ' => 'Ⳃ', + 'ⳅ' => 'Ⳅ', + 'ⳇ' => 'Ⳇ', + 'ⳉ' => 'Ⳉ', + 'ⳋ' => 'Ⳋ', + 'ⳍ' => 'Ⳍ', + 'ⳏ' => 'Ⳏ', + 'ⳑ' => 'Ⳑ', + 'ⳓ' => 'Ⳓ', + 'ⳕ' => 'Ⳕ', + 'ⳗ' => 'Ⳗ', + 'ⳙ' => 'Ⳙ', + 'ⳛ' => 'Ⳛ', + 'ⳝ' => 'Ⳝ', + 'ⳟ' => 'Ⳟ', + 'ⳡ' => 'Ⳡ', + 'ⳣ' => 'Ⳣ', + 'ⳬ' => 'Ⳬ', + 'ⳮ' => 'Ⳮ', + 'ⳳ' => 'Ⳳ', + 'ⴀ' => 'Ⴀ', + 'ⴁ' => 'Ⴁ', + 'ⴂ' => 'Ⴂ', + 'ⴃ' => 'Ⴃ', + 'ⴄ' => 'Ⴄ', + 'ⴅ' => 'Ⴅ', + 'ⴆ' => 'Ⴆ', + 'ⴇ' => 'Ⴇ', + 'ⴈ' => 'Ⴈ', + 'ⴉ' => 'Ⴉ', + 'ⴊ' => 'Ⴊ', + 'ⴋ' => 'Ⴋ', + 'ⴌ' => 'Ⴌ', + 'ⴍ' => 'Ⴍ', + 'ⴎ' => 'Ⴎ', + 'ⴏ' => 'Ⴏ', + 'ⴐ' => 'Ⴐ', + 'ⴑ' => 'Ⴑ', + 'ⴒ' => 'Ⴒ', + 'ⴓ' => 'Ⴓ', + 'ⴔ' => 'Ⴔ', + 'ⴕ' => 'Ⴕ', + 'ⴖ' => 'Ⴖ', + 'ⴗ' => 'Ⴗ', + 'ⴘ' => 'Ⴘ', + 'ⴙ' => 'Ⴙ', + 'ⴚ' => 'Ⴚ', + 'ⴛ' => 'Ⴛ', + 'ⴜ' => 'Ⴜ', + 'ⴝ' => 'Ⴝ', + 'ⴞ' => 'Ⴞ', + 'ⴟ' => 'Ⴟ', + 'ⴠ' => 'Ⴠ', + 'ⴡ' => 'Ⴡ', + 'ⴢ' => 'Ⴢ', + 'ⴣ' => 'Ⴣ', + 'ⴤ' => 'Ⴤ', + 'ⴥ' => 'Ⴥ', + 'ⴧ' => 'Ⴧ', + 'ⴭ' => 'Ⴭ', + 'ꙁ' => 'Ꙁ', + 'ꙃ' => 'Ꙃ', + 'ꙅ' => 'Ꙅ', + 'ꙇ' => 'Ꙇ', + 'ꙉ' => 'Ꙉ', + 'ꙋ' => 'Ꙋ', + 'ꙍ' => 'Ꙍ', + 'ꙏ' => 'Ꙏ', + 'ꙑ' => 'Ꙑ', + 'ꙓ' => 'Ꙓ', + 'ꙕ' => 'Ꙕ', + 'ꙗ' => 'Ꙗ', + 'ꙙ' => 'Ꙙ', + 'ꙛ' => 'Ꙛ', + 'ꙝ' => 'Ꙝ', + 'ꙟ' => 'Ꙟ', + 'ꙡ' => 'Ꙡ', + 'ꙣ' => 'Ꙣ', + 'ꙥ' => 'Ꙥ', + 'ꙧ' => 'Ꙧ', + 'ꙩ' => 'Ꙩ', + 'ꙫ' => 'Ꙫ', + 'ꙭ' => 'Ꙭ', + 'ꚁ' => 'Ꚁ', + 'ꚃ' => 'Ꚃ', + 'ꚅ' => 'Ꚅ', + 'ꚇ' => 'Ꚇ', + 'ꚉ' => 'Ꚉ', + 'ꚋ' => 'Ꚋ', + 'ꚍ' => 'Ꚍ', + 'ꚏ' => 'Ꚏ', + 'ꚑ' => 'Ꚑ', + 'ꚓ' => 'Ꚓ', + 'ꚕ' => 'Ꚕ', + 'ꚗ' => 'Ꚗ', + 'ꚙ' => 'Ꚙ', + 'ꚛ' => 'Ꚛ', + 'ꜣ' => 'Ꜣ', + 'ꜥ' => 'Ꜥ', + 'ꜧ' => 'Ꜧ', + 'ꜩ' => 'Ꜩ', + 'ꜫ' => 'Ꜫ', + 'ꜭ' => 'Ꜭ', + 'ꜯ' => 'Ꜯ', + 'ꜳ' => 'Ꜳ', + 'ꜵ' => 'Ꜵ', + 'ꜷ' => 'Ꜷ', + 'ꜹ' => 'Ꜹ', + 'ꜻ' => 'Ꜻ', + 'ꜽ' => 'Ꜽ', + 'ꜿ' => 'Ꜿ', + 'ꝁ' => 'Ꝁ', + 'ꝃ' => 'Ꝃ', + 'ꝅ' => 'Ꝅ', + 'ꝇ' => 'Ꝇ', + 'ꝉ' => 'Ꝉ', + 'ꝋ' => 'Ꝋ', + 'ꝍ' => 'Ꝍ', + 'ꝏ' => 'Ꝏ', + 'ꝑ' => 'Ꝑ', + 'ꝓ' => 'Ꝓ', + 'ꝕ' => 'Ꝕ', + 'ꝗ' => 'Ꝗ', + 'ꝙ' => 'Ꝙ', + 'ꝛ' => 'Ꝛ', + 'ꝝ' => 'Ꝝ', + 'ꝟ' => 'Ꝟ', + 'ꝡ' => 'Ꝡ', + 'ꝣ' => 'Ꝣ', + 'ꝥ' => 'Ꝥ', + 'ꝧ' => 'Ꝧ', + 'ꝩ' => 'Ꝩ', + 'ꝫ' => 'Ꝫ', + 'ꝭ' => 'Ꝭ', + 'ꝯ' => 'Ꝯ', + 'ꝺ' => 'Ꝺ', + 'ꝼ' => 'Ꝼ', + 'ꝿ' => 'Ꝿ', + 'ꞁ' => 'Ꞁ', + 'ꞃ' => 'Ꞃ', + 'ꞅ' => 'Ꞅ', + 'ꞇ' => 'Ꞇ', + 'ꞌ' => 'Ꞌ', + 'ꞑ' => 'Ꞑ', + 'ꞓ' => 'Ꞓ', + 'ꞔ' => 'Ꞔ', + 'ꞗ' => 'Ꞗ', + 'ꞙ' => 'Ꞙ', + 'ꞛ' => 'Ꞛ', + 'ꞝ' => 'Ꞝ', + 'ꞟ' => 'Ꞟ', + 'ꞡ' => 'Ꞡ', + 'ꞣ' => 'Ꞣ', + 'ꞥ' => 'Ꞥ', + 'ꞧ' => 'Ꞧ', + 'ꞩ' => 'Ꞩ', + 'ꞵ' => 'Ꞵ', + 'ꞷ' => 'Ꞷ', + 'ꞹ' => 'Ꞹ', + 'ꞻ' => 'Ꞻ', + 'ꞽ' => 'Ꞽ', + 'ꞿ' => 'Ꞿ', + 'ꟃ' => 'Ꟃ', + 'ꟈ' => 'Ꟈ', + 'ꟊ' => 'Ꟊ', + 'ꟶ' => 'Ꟶ', + 'ꭓ' => 'Ꭓ', + 'ꭰ' => 'Ꭰ', + 'ꭱ' => 'Ꭱ', + 'ꭲ' => 'Ꭲ', + 'ꭳ' => 'Ꭳ', + 'ꭴ' => 'Ꭴ', + 'ꭵ' => 'Ꭵ', + 'ꭶ' => 'Ꭶ', + 'ꭷ' => 'Ꭷ', + 'ꭸ' => 'Ꭸ', + 'ꭹ' => 'Ꭹ', + 'ꭺ' => 'Ꭺ', + 'ꭻ' => 'Ꭻ', + 'ꭼ' => 'Ꭼ', + 'ꭽ' => 'Ꭽ', + 'ꭾ' => 'Ꭾ', + 'ꭿ' => 'Ꭿ', + 'ꮀ' => 'Ꮀ', + 'ꮁ' => 'Ꮁ', + 'ꮂ' => 'Ꮂ', + 'ꮃ' => 'Ꮃ', + 'ꮄ' => 'Ꮄ', + 'ꮅ' => 'Ꮅ', + 'ꮆ' => 'Ꮆ', + 'ꮇ' => 'Ꮇ', + 'ꮈ' => 'Ꮈ', + 'ꮉ' => 'Ꮉ', + 'ꮊ' => 'Ꮊ', + 'ꮋ' => 'Ꮋ', + 'ꮌ' => 'Ꮌ', + 'ꮍ' => 'Ꮍ', + 'ꮎ' => 'Ꮎ', + 'ꮏ' => 'Ꮏ', + 'ꮐ' => 'Ꮐ', + 'ꮑ' => 'Ꮑ', + 'ꮒ' => 'Ꮒ', + 'ꮓ' => 'Ꮓ', + 'ꮔ' => 'Ꮔ', + 'ꮕ' => 'Ꮕ', + 'ꮖ' => 'Ꮖ', + 'ꮗ' => 'Ꮗ', + 'ꮘ' => 'Ꮘ', + 'ꮙ' => 'Ꮙ', + 'ꮚ' => 'Ꮚ', + 'ꮛ' => 'Ꮛ', + 'ꮜ' => 'Ꮜ', + 'ꮝ' => 'Ꮝ', + 'ꮞ' => 'Ꮞ', + 'ꮟ' => 'Ꮟ', + 'ꮠ' => 'Ꮠ', + 'ꮡ' => 'Ꮡ', + 'ꮢ' => 'Ꮢ', + 'ꮣ' => 'Ꮣ', + 'ꮤ' => 'Ꮤ', + 'ꮥ' => 'Ꮥ', + 'ꮦ' => 'Ꮦ', + 'ꮧ' => 'Ꮧ', + 'ꮨ' => 'Ꮨ', + 'ꮩ' => 'Ꮩ', + 'ꮪ' => 'Ꮪ', + 'ꮫ' => 'Ꮫ', + 'ꮬ' => 'Ꮬ', + 'ꮭ' => 'Ꮭ', + 'ꮮ' => 'Ꮮ', + 'ꮯ' => 'Ꮯ', + 'ꮰ' => 'Ꮰ', + 'ꮱ' => 'Ꮱ', + 'ꮲ' => 'Ꮲ', + 'ꮳ' => 'Ꮳ', + 'ꮴ' => 'Ꮴ', + 'ꮵ' => 'Ꮵ', + 'ꮶ' => 'Ꮶ', + 'ꮷ' => 'Ꮷ', + 'ꮸ' => 'Ꮸ', + 'ꮹ' => 'Ꮹ', + 'ꮺ' => 'Ꮺ', + 'ꮻ' => 'Ꮻ', + 'ꮼ' => 'Ꮼ', + 'ꮽ' => 'Ꮽ', + 'ꮾ' => 'Ꮾ', + 'ꮿ' => 'Ꮿ', + 'a' => 'A', + 'b' => 'B', + 'c' => 'C', + 'd' => 'D', + 'e' => 'E', + 'f' => 'F', + 'g' => 'G', + 'h' => 'H', + 'i' => 'I', + 'j' => 'J', + 'k' => 'K', + 'l' => 'L', + 'm' => 'M', + 'n' => 'N', + 'o' => 'O', + 'p' => 'P', + 'q' => 'Q', + 'r' => 'R', + 's' => 'S', + 't' => 'T', + 'u' => 'U', + 'v' => 'V', + 'w' => 'W', + 'x' => 'X', + 'y' => 'Y', + 'z' => 'Z', + '𐐨' => '𐐀', + '𐐩' => '𐐁', + '𐐪' => '𐐂', + '𐐫' => '𐐃', + '𐐬' => '𐐄', + '𐐭' => '𐐅', + '𐐮' => '𐐆', + '𐐯' => '𐐇', + '𐐰' => '𐐈', + '𐐱' => '𐐉', + '𐐲' => '𐐊', + '𐐳' => '𐐋', + '𐐴' => '𐐌', + '𐐵' => '𐐍', + '𐐶' => '𐐎', + '𐐷' => '𐐏', + '𐐸' => '𐐐', + '𐐹' => '𐐑', + '𐐺' => '𐐒', + '𐐻' => '𐐓', + '𐐼' => '𐐔', + '𐐽' => '𐐕', + '𐐾' => '𐐖', + '𐐿' => '𐐗', + '𐑀' => '𐐘', + '𐑁' => '𐐙', + '𐑂' => '𐐚', + '𐑃' => '𐐛', + '𐑄' => '𐐜', + '𐑅' => '𐐝', + '𐑆' => '𐐞', + '𐑇' => '𐐟', + '𐑈' => '𐐠', + '𐑉' => '𐐡', + '𐑊' => '𐐢', + '𐑋' => '𐐣', + '𐑌' => '𐐤', + '𐑍' => '𐐥', + '𐑎' => '𐐦', + '𐑏' => '𐐧', + '𐓘' => '𐒰', + '𐓙' => '𐒱', + '𐓚' => '𐒲', + '𐓛' => '𐒳', + '𐓜' => '𐒴', + '𐓝' => '𐒵', + '𐓞' => '𐒶', + '𐓟' => '𐒷', + '𐓠' => '𐒸', + '𐓡' => '𐒹', + '𐓢' => '𐒺', + '𐓣' => '𐒻', + '𐓤' => '𐒼', + '𐓥' => '𐒽', + '𐓦' => '𐒾', + '𐓧' => '𐒿', + '𐓨' => '𐓀', + '𐓩' => '𐓁', + '𐓪' => '𐓂', + '𐓫' => '𐓃', + '𐓬' => '𐓄', + '𐓭' => '𐓅', + '𐓮' => '𐓆', + '𐓯' => '𐓇', + '𐓰' => '𐓈', + '𐓱' => '𐓉', + '𐓲' => '𐓊', + '𐓳' => '𐓋', + '𐓴' => '𐓌', + '𐓵' => '𐓍', + '𐓶' => '𐓎', + '𐓷' => '𐓏', + '𐓸' => '𐓐', + '𐓹' => '𐓑', + '𐓺' => '𐓒', + '𐓻' => '𐓓', + '𐳀' => '𐲀', + '𐳁' => '𐲁', + '𐳂' => '𐲂', + '𐳃' => '𐲃', + '𐳄' => '𐲄', + '𐳅' => '𐲅', + '𐳆' => '𐲆', + '𐳇' => '𐲇', + '𐳈' => '𐲈', + '𐳉' => '𐲉', + '𐳊' => '𐲊', + '𐳋' => '𐲋', + '𐳌' => '𐲌', + '𐳍' => '𐲍', + '𐳎' => '𐲎', + '𐳏' => '𐲏', + '𐳐' => '𐲐', + '𐳑' => '𐲑', + '𐳒' => '𐲒', + '𐳓' => '𐲓', + '𐳔' => '𐲔', + '𐳕' => '𐲕', + '𐳖' => '𐲖', + '𐳗' => '𐲗', + '𐳘' => '𐲘', + '𐳙' => '𐲙', + '𐳚' => '𐲚', + '𐳛' => '𐲛', + '𐳜' => '𐲜', + '𐳝' => '𐲝', + '𐳞' => '𐲞', + '𐳟' => '𐲟', + '𐳠' => '𐲠', + '𐳡' => '𐲡', + '𐳢' => '𐲢', + '𐳣' => '𐲣', + '𐳤' => '𐲤', + '𐳥' => '𐲥', + '𐳦' => '𐲦', + '𐳧' => '𐲧', + '𐳨' => '𐲨', + '𐳩' => '𐲩', + '𐳪' => '𐲪', + '𐳫' => '𐲫', + '𐳬' => '𐲬', + '𐳭' => '𐲭', + '𐳮' => '𐲮', + '𐳯' => '𐲯', + '𐳰' => '𐲰', + '𐳱' => '𐲱', + '𐳲' => '𐲲', + '𑣀' => '𑢠', + '𑣁' => '𑢡', + '𑣂' => '𑢢', + '𑣃' => '𑢣', + '𑣄' => '𑢤', + '𑣅' => '𑢥', + '𑣆' => '𑢦', + '𑣇' => '𑢧', + '𑣈' => '𑢨', + '𑣉' => '𑢩', + '𑣊' => '𑢪', + '𑣋' => '𑢫', + '𑣌' => '𑢬', + '𑣍' => '𑢭', + '𑣎' => '𑢮', + '𑣏' => '𑢯', + '𑣐' => '𑢰', + '𑣑' => '𑢱', + '𑣒' => '𑢲', + '𑣓' => '𑢳', + '𑣔' => '𑢴', + '𑣕' => '𑢵', + '𑣖' => '𑢶', + '𑣗' => '𑢷', + '𑣘' => '𑢸', + '𑣙' => '𑢹', + '𑣚' => '𑢺', + '𑣛' => '𑢻', + '𑣜' => '𑢼', + '𑣝' => '𑢽', + '𑣞' => '𑢾', + '𑣟' => '𑢿', + '𖹠' => '𖹀', + '𖹡' => '𖹁', + '𖹢' => '𖹂', + '𖹣' => '𖹃', + '𖹤' => '𖹄', + '𖹥' => '𖹅', + '𖹦' => '𖹆', + '𖹧' => '𖹇', + '𖹨' => '𖹈', + '𖹩' => '𖹉', + '𖹪' => '𖹊', + '𖹫' => '𖹋', + '𖹬' => '𖹌', + '𖹭' => '𖹍', + '𖹮' => '𖹎', + '𖹯' => '𖹏', + '𖹰' => '𖹐', + '𖹱' => '𖹑', + '𖹲' => '𖹒', + '𖹳' => '𖹓', + '𖹴' => '𖹔', + '𖹵' => '𖹕', + '𖹶' => '𖹖', + '𖹷' => '𖹗', + '𖹸' => '𖹘', + '𖹹' => '𖹙', + '𖹺' => '𖹚', + '𖹻' => '𖹛', + '𖹼' => '𖹜', + '𖹽' => '𖹝', + '𖹾' => '𖹞', + '𖹿' => '𖹟', + '𞤢' => '𞤀', + '𞤣' => '𞤁', + '𞤤' => '𞤂', + '𞤥' => '𞤃', + '𞤦' => '𞤄', + '𞤧' => '𞤅', + '𞤨' => '𞤆', + '𞤩' => '𞤇', + '𞤪' => '𞤈', + '𞤫' => '𞤉', + '𞤬' => '𞤊', + '𞤭' => '𞤋', + '𞤮' => '𞤌', + '𞤯' => '𞤍', + '𞤰' => '𞤎', + '𞤱' => '𞤏', + '𞤲' => '𞤐', + '𞤳' => '𞤑', + '𞤴' => '𞤒', + '𞤵' => '𞤓', + '𞤶' => '𞤔', + '𞤷' => '𞤕', + '𞤸' => '𞤖', + '𞤹' => '𞤗', + '𞤺' => '𞤘', + '𞤻' => '𞤙', + '𞤼' => '𞤚', + '𞤽' => '𞤛', + '𞤾' => '𞤜', + '𞤿' => '𞤝', + '𞥀' => '𞤞', + '𞥁' => '𞤟', + '𞥂' => '𞤠', + '𞥃' => '𞤡', + 'ß' => 'SS', + 'ff' => 'FF', + 'fi' => 'FI', + 'fl' => 'FL', + 'ffi' => 'FFI', + 'ffl' => 'FFL', + 'ſt' => 'ST', + 'st' => 'ST', + 'և' => 'ԵՒ', + 'ﬓ' => 'ՄՆ', + 'ﬔ' => 'ՄԵ', + 'ﬕ' => 'ՄԻ', + 'ﬖ' => 'ՎՆ', + 'ﬗ' => 'ՄԽ', + 'ʼn' => 'ʼN', + 'ΐ' => 'Ϊ́', + 'ΰ' => 'Ϋ́', + 'ǰ' => 'J̌', + 'ẖ' => 'H̱', + 'ẗ' => 'T̈', + 'ẘ' => 'W̊', + 'ẙ' => 'Y̊', + 'ẚ' => 'Aʾ', + 'ὐ' => 'Υ̓', + 'ὒ' => 'Υ̓̀', + 'ὔ' => 'Υ̓́', + 'ὖ' => 'Υ̓͂', + 'ᾶ' => 'Α͂', + 'ῆ' => 'Η͂', + 'ῒ' => 'Ϊ̀', + 'ΐ' => 'Ϊ́', + 'ῖ' => 'Ι͂', + 'ῗ' => 'Ϊ͂', + 'ῢ' => 'Ϋ̀', + 'ΰ' => 'Ϋ́', + 'ῤ' => 'Ρ̓', + 'ῦ' => 'Υ͂', + 'ῧ' => 'Ϋ͂', + 'ῶ' => 'Ω͂', + 'ᾈ' => 'ἈΙ', + 'ᾉ' => 'ἉΙ', + 'ᾊ' => 'ἊΙ', + 'ᾋ' => 'ἋΙ', + 'ᾌ' => 'ἌΙ', + 'ᾍ' => 'ἍΙ', + 'ᾎ' => 'ἎΙ', + 'ᾏ' => 'ἏΙ', + 'ᾘ' => 'ἨΙ', + 'ᾙ' => 'ἩΙ', + 'ᾚ' => 'ἪΙ', + 'ᾛ' => 'ἫΙ', + 'ᾜ' => 'ἬΙ', + 'ᾝ' => 'ἭΙ', + 'ᾞ' => 'ἮΙ', + 'ᾟ' => 'ἯΙ', + 'ᾨ' => 'ὨΙ', + 'ᾩ' => 'ὩΙ', + 'ᾪ' => 'ὪΙ', + 'ᾫ' => 'ὫΙ', + 'ᾬ' => 'ὬΙ', + 'ᾭ' => 'ὭΙ', + 'ᾮ' => 'ὮΙ', + 'ᾯ' => 'ὯΙ', + 'ᾼ' => 'ΑΙ', + 'ῌ' => 'ΗΙ', + 'ῼ' => 'ΩΙ', + 'ᾲ' => 'ᾺΙ', + 'ᾴ' => 'ΆΙ', + 'ῂ' => 'ῊΙ', + 'ῄ' => 'ΉΙ', + 'ῲ' => 'ῺΙ', + 'ῴ' => 'ΏΙ', + 'ᾷ' => 'Α͂Ι', + 'ῇ' => 'Η͂Ι', + 'ῷ' => 'Ω͂Ι', +); diff --git a/upLoadImage/vendor/symfony/polyfill-mbstring/bootstrap.php b/upLoadImage/vendor/symfony/polyfill-mbstring/bootstrap.php new file mode 100644 index 0000000..ff51ae0 --- /dev/null +++ b/upLoadImage/vendor/symfony/polyfill-mbstring/bootstrap.php @@ -0,0 +1,172 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Polyfill\Mbstring as p; + +if (\PHP_VERSION_ID >= 80000) { + return require __DIR__.'/bootstrap80.php'; +} + +if (!function_exists('mb_convert_encoding')) { + function mb_convert_encoding($string, $to_encoding, $from_encoding = null) { return p\Mbstring::mb_convert_encoding($string, $to_encoding, $from_encoding); } +} +if (!function_exists('mb_decode_mimeheader')) { + function mb_decode_mimeheader($string) { return p\Mbstring::mb_decode_mimeheader($string); } +} +if (!function_exists('mb_encode_mimeheader')) { + function mb_encode_mimeheader($string, $charset = null, $transfer_encoding = null, $newline = "\r\n", $indent = 0) { return p\Mbstring::mb_encode_mimeheader($string, $charset, $transfer_encoding, $newline, $indent); } +} +if (!function_exists('mb_decode_numericentity')) { + function mb_decode_numericentity($string, $map, $encoding = null) { return p\Mbstring::mb_decode_numericentity($string, $map, $encoding); } +} +if (!function_exists('mb_encode_numericentity')) { + function mb_encode_numericentity($string, $map, $encoding = null, $hex = false) { return p\Mbstring::mb_encode_numericentity($string, $map, $encoding, $hex); } +} +if (!function_exists('mb_convert_case')) { + function mb_convert_case($string, $mode, $encoding = null) { return p\Mbstring::mb_convert_case($string, $mode, $encoding); } +} +if (!function_exists('mb_internal_encoding')) { + function mb_internal_encoding($encoding = null) { return p\Mbstring::mb_internal_encoding($encoding); } +} +if (!function_exists('mb_language')) { + function mb_language($language = null) { return p\Mbstring::mb_language($language); } +} +if (!function_exists('mb_list_encodings')) { + function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); } +} +if (!function_exists('mb_encoding_aliases')) { + function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); } +} +if (!function_exists('mb_check_encoding')) { + function mb_check_encoding($value = null, $encoding = null) { return p\Mbstring::mb_check_encoding($value, $encoding); } +} +if (!function_exists('mb_detect_encoding')) { + function mb_detect_encoding($string, $encodings = null, $strict = false) { return p\Mbstring::mb_detect_encoding($string, $encodings, $strict); } +} +if (!function_exists('mb_detect_order')) { + function mb_detect_order($encoding = null) { return p\Mbstring::mb_detect_order($encoding); } +} +if (!function_exists('mb_parse_str')) { + function mb_parse_str($string, &$result = []) { parse_str($string, $result); return (bool) $result; } +} +if (!function_exists('mb_strlen')) { + function mb_strlen($string, $encoding = null) { return p\Mbstring::mb_strlen($string, $encoding); } +} +if (!function_exists('mb_strpos')) { + function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strpos($haystack, $needle, $offset, $encoding); } +} +if (!function_exists('mb_strtolower')) { + function mb_strtolower($string, $encoding = null) { return p\Mbstring::mb_strtolower($string, $encoding); } +} +if (!function_exists('mb_strtoupper')) { + function mb_strtoupper($string, $encoding = null) { return p\Mbstring::mb_strtoupper($string, $encoding); } +} +if (!function_exists('mb_substitute_character')) { + function mb_substitute_character($substitute_character = null) { return p\Mbstring::mb_substitute_character($substitute_character); } +} +if (!function_exists('mb_substr')) { + function mb_substr($string, $start, $length = 2147483647, $encoding = null) { return p\Mbstring::mb_substr($string, $start, $length, $encoding); } +} +if (!function_exists('mb_stripos')) { + function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_stripos($haystack, $needle, $offset, $encoding); } +} +if (!function_exists('mb_stristr')) { + function mb_stristr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_stristr($haystack, $needle, $before_needle, $encoding); } +} +if (!function_exists('mb_strrchr')) { + function mb_strrchr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrchr($haystack, $needle, $before_needle, $encoding); } +} +if (!function_exists('mb_strrichr')) { + function mb_strrichr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrichr($haystack, $needle, $before_needle, $encoding); } +} +if (!function_exists('mb_strripos')) { + function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strripos($haystack, $needle, $offset, $encoding); } +} +if (!function_exists('mb_strrpos')) { + function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strrpos($haystack, $needle, $offset, $encoding); } +} +if (!function_exists('mb_strstr')) { + function mb_strstr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strstr($haystack, $needle, $before_needle, $encoding); } +} +if (!function_exists('mb_get_info')) { + function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); } +} +if (!function_exists('mb_http_output')) { + function mb_http_output($encoding = null) { return p\Mbstring::mb_http_output($encoding); } +} +if (!function_exists('mb_strwidth')) { + function mb_strwidth($string, $encoding = null) { return p\Mbstring::mb_strwidth($string, $encoding); } +} +if (!function_exists('mb_substr_count')) { + function mb_substr_count($haystack, $needle, $encoding = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $encoding); } +} +if (!function_exists('mb_output_handler')) { + function mb_output_handler($string, $status) { return p\Mbstring::mb_output_handler($string, $status); } +} +if (!function_exists('mb_http_input')) { + function mb_http_input($type = null) { return p\Mbstring::mb_http_input($type); } +} + +if (!function_exists('mb_convert_variables')) { + function mb_convert_variables($to_encoding, $from_encoding, &...$vars) { return p\Mbstring::mb_convert_variables($to_encoding, $from_encoding, ...$vars); } +} + +if (!function_exists('mb_ord')) { + function mb_ord($string, $encoding = null) { return p\Mbstring::mb_ord($string, $encoding); } +} +if (!function_exists('mb_chr')) { + function mb_chr($codepoint, $encoding = null) { return p\Mbstring::mb_chr($codepoint, $encoding); } +} +if (!function_exists('mb_scrub')) { + function mb_scrub($string, $encoding = null) { $encoding = null === $encoding ? mb_internal_encoding() : $encoding; return mb_convert_encoding($string, $encoding, $encoding); } +} +if (!function_exists('mb_str_split')) { + function mb_str_split($string, $length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $length, $encoding); } +} + +if (!function_exists('mb_str_pad')) { + function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = STR_PAD_RIGHT, ?string $encoding = null): string { return p\Mbstring::mb_str_pad($string, $length, $pad_string, $pad_type, $encoding); } +} + +if (!function_exists('mb_ucfirst')) { + function mb_ucfirst(string $string, ?string $encoding = null): string { return p\Mbstring::mb_ucfirst($string, $encoding); } +} + +if (!function_exists('mb_lcfirst')) { + function mb_lcfirst(string $string, ?string $encoding = null): string { return p\Mbstring::mb_lcfirst($string, $encoding); } +} + +if (!function_exists('mb_trim')) { + function mb_trim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_trim($string, $characters, $encoding); } +} + +if (!function_exists('mb_ltrim')) { + function mb_ltrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_ltrim($string, $characters, $encoding); } +} + +if (!function_exists('mb_rtrim')) { + function mb_rtrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_rtrim($string, $characters, $encoding); } +} + + +if (extension_loaded('mbstring')) { + return; +} + +if (!defined('MB_CASE_UPPER')) { + define('MB_CASE_UPPER', 0); +} +if (!defined('MB_CASE_LOWER')) { + define('MB_CASE_LOWER', 1); +} +if (!defined('MB_CASE_TITLE')) { + define('MB_CASE_TITLE', 2); +} diff --git a/upLoadImage/vendor/symfony/polyfill-mbstring/bootstrap80.php b/upLoadImage/vendor/symfony/polyfill-mbstring/bootstrap80.php new file mode 100644 index 0000000..5236e6d --- /dev/null +++ b/upLoadImage/vendor/symfony/polyfill-mbstring/bootstrap80.php @@ -0,0 +1,167 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Polyfill\Mbstring as p; + +if (!function_exists('mb_convert_encoding')) { + function mb_convert_encoding(array|string|null $string, ?string $to_encoding, array|string|null $from_encoding = null): array|string|false { return p\Mbstring::mb_convert_encoding($string ?? '', (string) $to_encoding, $from_encoding); } +} +if (!function_exists('mb_decode_mimeheader')) { + function mb_decode_mimeheader(?string $string): string { return p\Mbstring::mb_decode_mimeheader((string) $string); } +} +if (!function_exists('mb_encode_mimeheader')) { + function mb_encode_mimeheader(?string $string, ?string $charset = null, ?string $transfer_encoding = null, ?string $newline = "\r\n", ?int $indent = 0): string { return p\Mbstring::mb_encode_mimeheader((string) $string, $charset, $transfer_encoding, (string) $newline, (int) $indent); } +} +if (!function_exists('mb_decode_numericentity')) { + function mb_decode_numericentity(?string $string, array $map, ?string $encoding = null): string { return p\Mbstring::mb_decode_numericentity((string) $string, $map, $encoding); } +} +if (!function_exists('mb_encode_numericentity')) { + function mb_encode_numericentity(?string $string, array $map, ?string $encoding = null, ?bool $hex = false): string { return p\Mbstring::mb_encode_numericentity((string) $string, $map, $encoding, (bool) $hex); } +} +if (!function_exists('mb_convert_case')) { + function mb_convert_case(?string $string, ?int $mode, ?string $encoding = null): string { return p\Mbstring::mb_convert_case((string) $string, (int) $mode, $encoding); } +} +if (!function_exists('mb_internal_encoding')) { + function mb_internal_encoding(?string $encoding = null): string|bool { return p\Mbstring::mb_internal_encoding($encoding); } +} +if (!function_exists('mb_language')) { + function mb_language(?string $language = null): string|bool { return p\Mbstring::mb_language($language); } +} +if (!function_exists('mb_list_encodings')) { + function mb_list_encodings(): array { return p\Mbstring::mb_list_encodings(); } +} +if (!function_exists('mb_encoding_aliases')) { + function mb_encoding_aliases(?string $encoding): array { return p\Mbstring::mb_encoding_aliases((string) $encoding); } +} +if (!function_exists('mb_check_encoding')) { + function mb_check_encoding(array|string|null $value = null, ?string $encoding = null): bool { return p\Mbstring::mb_check_encoding($value, $encoding); } +} +if (!function_exists('mb_detect_encoding')) { + function mb_detect_encoding(?string $string, array|string|null $encodings = null, ?bool $strict = false): string|false { return p\Mbstring::mb_detect_encoding((string) $string, $encodings, (bool) $strict); } +} +if (!function_exists('mb_detect_order')) { + function mb_detect_order(array|string|null $encoding = null): array|bool { return p\Mbstring::mb_detect_order($encoding); } +} +if (!function_exists('mb_parse_str')) { + function mb_parse_str(?string $string, &$result = []): bool { parse_str((string) $string, $result); return (bool) $result; } +} +if (!function_exists('mb_strlen')) { + function mb_strlen(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strlen((string) $string, $encoding); } +} +if (!function_exists('mb_strpos')) { + function mb_strpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strpos((string) $haystack, (string) $needle, (int) $offset, $encoding); } +} +if (!function_exists('mb_strtolower')) { + function mb_strtolower(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtolower((string) $string, $encoding); } +} +if (!function_exists('mb_strtoupper')) { + function mb_strtoupper(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtoupper((string) $string, $encoding); } +} +if (!function_exists('mb_substitute_character')) { + function mb_substitute_character(string|int|null $substitute_character = null): string|int|bool { return p\Mbstring::mb_substitute_character($substitute_character); } +} +if (!function_exists('mb_substr')) { + function mb_substr(?string $string, ?int $start, ?int $length = null, ?string $encoding = null): string { return p\Mbstring::mb_substr((string) $string, (int) $start, $length, $encoding); } +} +if (!function_exists('mb_stripos')) { + function mb_stripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_stripos((string) $haystack, (string) $needle, (int) $offset, $encoding); } +} +if (!function_exists('mb_stristr')) { + function mb_stristr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_stristr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } +} +if (!function_exists('mb_strrchr')) { + function mb_strrchr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrchr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } +} +if (!function_exists('mb_strrichr')) { + function mb_strrichr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrichr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } +} +if (!function_exists('mb_strripos')) { + function mb_strripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strripos((string) $haystack, (string) $needle, (int) $offset, $encoding); } +} +if (!function_exists('mb_strrpos')) { + function mb_strrpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strrpos((string) $haystack, (string) $needle, (int) $offset, $encoding); } +} +if (!function_exists('mb_strstr')) { + function mb_strstr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strstr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } +} +if (!function_exists('mb_get_info')) { + function mb_get_info(?string $type = 'all'): array|string|int|false|null { return p\Mbstring::mb_get_info((string) $type); } +} +if (!function_exists('mb_http_output')) { + function mb_http_output(?string $encoding = null): string|bool { return p\Mbstring::mb_http_output($encoding); } +} +if (!function_exists('mb_strwidth')) { + function mb_strwidth(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strwidth((string) $string, $encoding); } +} +if (!function_exists('mb_substr_count')) { + function mb_substr_count(?string $haystack, ?string $needle, ?string $encoding = null): int { return p\Mbstring::mb_substr_count((string) $haystack, (string) $needle, $encoding); } +} +if (!function_exists('mb_output_handler')) { + function mb_output_handler(?string $string, ?int $status): string { return p\Mbstring::mb_output_handler((string) $string, (int) $status); } +} +if (!function_exists('mb_http_input')) { + function mb_http_input(?string $type = null): array|string|false { return p\Mbstring::mb_http_input($type); } +} + +if (!function_exists('mb_convert_variables')) { + function mb_convert_variables(?string $to_encoding, array|string|null $from_encoding, mixed &$var, mixed &...$vars): string|false { return p\Mbstring::mb_convert_variables((string) $to_encoding, $from_encoding ?? '', $var, ...$vars); } +} + +if (!function_exists('mb_ord')) { + function mb_ord(?string $string, ?string $encoding = null): int|false { return p\Mbstring::mb_ord((string) $string, $encoding); } +} +if (!function_exists('mb_chr')) { + function mb_chr(?int $codepoint, ?string $encoding = null): string|false { return p\Mbstring::mb_chr((int) $codepoint, $encoding); } +} +if (!function_exists('mb_scrub')) { + function mb_scrub(?string $string, ?string $encoding = null): string { $encoding ??= mb_internal_encoding(); return mb_convert_encoding((string) $string, $encoding, $encoding); } +} +if (!function_exists('mb_str_split')) { + function mb_str_split(?string $string, ?int $length = 1, ?string $encoding = null): array { return p\Mbstring::mb_str_split((string) $string, (int) $length, $encoding); } +} + +if (!function_exists('mb_str_pad')) { + function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = STR_PAD_RIGHT, ?string $encoding = null): string { return p\Mbstring::mb_str_pad($string, $length, $pad_string, $pad_type, $encoding); } +} + +if (!function_exists('mb_ucfirst')) { + function mb_ucfirst(string $string, ?string $encoding = null): string { return p\Mbstring::mb_ucfirst($string, $encoding); } +} + +if (!function_exists('mb_lcfirst')) { + function mb_lcfirst(string $string, ?string $encoding = null): string { return p\Mbstring::mb_lcfirst($string, $encoding); } +} + +if (!function_exists('mb_trim')) { + function mb_trim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_trim($string, $characters, $encoding); } +} + +if (!function_exists('mb_ltrim')) { + function mb_ltrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_ltrim($string, $characters, $encoding); } +} + +if (!function_exists('mb_rtrim')) { + function mb_rtrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Mbstring::mb_rtrim($string, $characters, $encoding); } +} + +if (extension_loaded('mbstring')) { + return; +} + +if (!defined('MB_CASE_UPPER')) { + define('MB_CASE_UPPER', 0); +} +if (!defined('MB_CASE_LOWER')) { + define('MB_CASE_LOWER', 1); +} +if (!defined('MB_CASE_TITLE')) { + define('MB_CASE_TITLE', 2); +} diff --git a/upLoadImage/vendor/symfony/polyfill-mbstring/composer.json b/upLoadImage/vendor/symfony/polyfill-mbstring/composer.json new file mode 100644 index 0000000..daa07f8 --- /dev/null +++ b/upLoadImage/vendor/symfony/polyfill-mbstring/composer.json @@ -0,0 +1,39 @@ +{ + "name": "symfony/polyfill-mbstring", + "type": "library", + "description": "Symfony polyfill for the Mbstring extension", + "keywords": ["polyfill", "shim", "compatibility", "portable", "mbstring"], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=7.2", + "ext-iconv": "*" + }, + "provide": { + "ext-mbstring": "*" + }, + "autoload": { + "psr-4": { "Symfony\\Polyfill\\Mbstring\\": "" }, + "files": [ "bootstrap.php" ] + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "minimum-stability": "dev", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/CHANGELOG.md b/upLoadImage/vendor/symfony/var-dumper/CHANGELOG.md new file mode 100644 index 0000000..209bd96 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/CHANGELOG.md @@ -0,0 +1,122 @@ +CHANGELOG +========= + +7.4 +--- + + * Add support for adding more default casters to `AbstractCloner::addDefaultCasters()` + * Select HtmlDumper only if `Accept` header contains "html" + +7.3 +--- + + * Add casters for `Dba\Connection`, `SQLite3Result`, `OpenSSLAsymmetricKey` and `OpenSSLCertificateSigningRequest` + * Deprecate `ResourceCaster::castCurl()`, `ResourceCaster::castGd()` and `ResourceCaster::castOpensslX509()` + * Mark all casters as `@internal` + +7.2 +--- + + * Add support for `FORCE_COLOR` environment variable + * Add support for virtual properties + +7.1 +--- + + * Add support for new DOM extension classes in `DOMCaster` + +7.0 +--- + + * Add argument `$label` to `VarDumper::dump()` + * Require explicit argument when calling `VarDumper::setHandler()` + * Remove display of backtrace in `Twig_Template`, only `Twig\Template` is supported + +6.4 +--- + + * Dump uninitialized properties + +6.3 +--- + + * Add caster for `WeakMap` + * Add support of named arguments to `dd()` and `dump()` to display the argument name + * Add support for `Relay\Relay` + * Add display of invisible characters + +6.2 +--- + + * Add support for `FFI\CData` and `FFI\CType` + * Deprecate calling `VarDumper::setHandler()` without arguments + +5.4 +--- + + * Add ability to style integer and double values independently + * Add casters for Symfony's UUIDs and ULIDs + * Add support for `Fiber` + +5.2.0 +----- + + * added support for PHPUnit `--colors` option + * added `VAR_DUMPER_FORMAT=server` env var value support + * prevent replacing the handler when the `VAR_DUMPER_FORMAT` env var is set + +5.1.0 +----- + + * added `RdKafka` support + +4.4.0 +----- + + * added `VarDumperTestTrait::setUpVarDumper()` and `VarDumperTestTrait::tearDownVarDumper()` + to configure casters & flags to use in tests + * added `ImagineCaster` and infrastructure to dump images + * added the stamps of a message after it is dispatched in `TraceableMessageBus` and `MessengerDataCollector` collected data + * added `UuidCaster` + * made all casters final + * added support for the `NO_COLOR` env var (https://no-color.org/) + +4.3.0 +----- + + * added `DsCaster` to support dumping the contents of data structures from the Ds extension + +4.2.0 +----- + + * support selecting the format to use by setting the environment variable `VAR_DUMPER_FORMAT` to `html` or `cli` + +4.1.0 +----- + + * added a `ServerDumper` to send serialized Data clones to a server + * added a `ServerDumpCommand` and `DumpServer` to run a server collecting + and displaying dumps on a single place with multiple formats support + * added `CliDescriptor` and `HtmlDescriptor` descriptors for `server:dump` CLI and HTML formats support + +4.0.0 +----- + + * support for passing `\ReflectionClass` instances to the `Caster::castObject()` + method has been dropped, pass class names as strings instead + * the `Data::getRawData()` method has been removed + * the `VarDumperTestTrait::assertDumpEquals()` method expects a 3rd `$filter = 0` + argument and moves `$message = ''` argument at 4th position. + * the `VarDumperTestTrait::assertDumpMatchesFormat()` method expects a 3rd `$filter = 0` + argument and moves `$message = ''` argument at 4th position. + +3.4.0 +----- + + * added `AbstractCloner::setMinDepth()` function to ensure minimum tree depth + * deprecated `MongoCaster` + +2.7.0 +----- + + * deprecated `Cloner\Data::getLimitedClone()`. Use `withMaxDepth`, `withMaxItemsPerDepth` or `withRefHandles` instead. diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/AddressInfoCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/AddressInfoCaster.php new file mode 100644 index 0000000..f341c68 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/AddressInfoCaster.php @@ -0,0 +1,82 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * @author Nicolas Grekas + * + * @internal since Symfony 7.3 + */ +final class AddressInfoCaster +{ + private const MAPS = [ + 'ai_flags' => [ + 1 => 'AI_PASSIVE', + 2 => 'AI_CANONNAME', + 4 => 'AI_NUMERICHOST', + 8 => 'AI_V4MAPPED', + 16 => 'AI_ALL', + 32 => 'AI_ADDRCONFIG', + 64 => 'AI_IDN', + 128 => 'AI_CANONIDN', + 1024 => 'AI_NUMERICSERV', + ], + 'ai_family' => [ + 1 => 'AF_UNIX', + 2 => 'AF_INET', + 10 => 'AF_INET6', + 44 => 'AF_DIVERT', + ], + 'ai_socktype' => [ + 1 => 'SOCK_STREAM', + 2 => 'SOCK_DGRAM', + 3 => 'SOCK_RAW', + 4 => 'SOCK_RDM', + 5 => 'SOCK_SEQPACKET', + ], + 'ai_protocol' => [ + 1 => 'SOL_SOCKET', + 6 => 'SOL_TCP', + 17 => 'SOL_UDP', + 136 => 'SOL_UDPLITE', + ], + ]; + + public static function castAddressInfo(\AddressInfo $h, array $a, Stub $stub, bool $isNested): array + { + static $resolvedMaps; + + if (!$resolvedMaps) { + foreach (self::MAPS as $k => $map) { + foreach ($map as $v => $name) { + if (\defined($name)) { + $resolvedMaps[$k][\constant($name)] = $name; + } elseif (!isset($resolvedMaps[$k][$v])) { + $resolvedMaps[$k][$v] = $name; + } + } + } + } + + foreach (socket_addrinfo_explain($h) as $k => $v) { + $a[Caster::PREFIX_VIRTUAL.$k] = match (true) { + 'ai_flags' === $k => ConstStub::fromBitfield($v, $resolvedMaps[$k]), + isset($resolvedMaps[$k][$v]) => new ConstStub($resolvedMaps[$k][$v], $v), + default => $v, + }; + } + + return $a; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/AmqpCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/AmqpCaster.php new file mode 100644 index 0000000..ff56288 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/AmqpCaster.php @@ -0,0 +1,214 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Casts Amqp related classes to array representation. + * + * @author Grégoire Pineau + * + * @final + * + * @internal since Symfony 7.3 + */ +class AmqpCaster +{ + private const FLAGS = [ + \AMQP_DURABLE => 'AMQP_DURABLE', + \AMQP_PASSIVE => 'AMQP_PASSIVE', + \AMQP_EXCLUSIVE => 'AMQP_EXCLUSIVE', + \AMQP_AUTODELETE => 'AMQP_AUTODELETE', + \AMQP_INTERNAL => 'AMQP_INTERNAL', + \AMQP_NOLOCAL => 'AMQP_NOLOCAL', + \AMQP_AUTOACK => 'AMQP_AUTOACK', + \AMQP_IFEMPTY => 'AMQP_IFEMPTY', + \AMQP_IFUNUSED => 'AMQP_IFUNUSED', + \AMQP_MANDATORY => 'AMQP_MANDATORY', + \AMQP_IMMEDIATE => 'AMQP_IMMEDIATE', + \AMQP_MULTIPLE => 'AMQP_MULTIPLE', + \AMQP_NOWAIT => 'AMQP_NOWAIT', + \AMQP_REQUEUE => 'AMQP_REQUEUE', + ]; + + private const EXCHANGE_TYPES = [ + \AMQP_EX_TYPE_DIRECT => 'AMQP_EX_TYPE_DIRECT', + \AMQP_EX_TYPE_FANOUT => 'AMQP_EX_TYPE_FANOUT', + \AMQP_EX_TYPE_TOPIC => 'AMQP_EX_TYPE_TOPIC', + \AMQP_EX_TYPE_HEADERS => 'AMQP_EX_TYPE_HEADERS', + ]; + + public static function castConnection(\AMQPConnection $c, array $a, Stub $stub, bool $isNested): array + { + $prefix = Caster::PREFIX_VIRTUAL; + + $a += [ + $prefix.'is_connected' => $c->isConnected(), + ]; + + // Recent version of the extension already expose private properties + if (isset($a["\x00AMQPConnection\x00login"])) { + return $a; + } + + // BC layer in the amqp lib + if (method_exists($c, 'getReadTimeout')) { + $timeout = $c->getReadTimeout(); + } else { + $timeout = $c->getTimeout(); + } + + $a += [ + $prefix.'is_connected' => $c->isConnected(), + $prefix.'login' => $c->getLogin(), + $prefix.'password' => $c->getPassword(), + $prefix.'host' => $c->getHost(), + $prefix.'vhost' => $c->getVhost(), + $prefix.'port' => $c->getPort(), + $prefix.'read_timeout' => $timeout, + ]; + + return $a; + } + + public static function castChannel(\AMQPChannel $c, array $a, Stub $stub, bool $isNested): array + { + $prefix = Caster::PREFIX_VIRTUAL; + + $a += [ + $prefix.'is_connected' => $c->isConnected(), + $prefix.'channel_id' => $c->getChannelId(), + ]; + + // Recent version of the extension already expose private properties + if (isset($a["\x00AMQPChannel\x00connection"])) { + return $a; + } + + $a += [ + $prefix.'connection' => $c->getConnection(), + $prefix.'prefetch_size' => $c->getPrefetchSize(), + $prefix.'prefetch_count' => $c->getPrefetchCount(), + ]; + + return $a; + } + + public static function castQueue(\AMQPQueue $c, array $a, Stub $stub, bool $isNested): array + { + $prefix = Caster::PREFIX_VIRTUAL; + + $a += [ + $prefix.'flags' => self::extractFlags($c->getFlags()), + ]; + + // Recent version of the extension already expose private properties + if (isset($a["\x00AMQPQueue\x00name"])) { + return $a; + } + + $a += [ + $prefix.'connection' => $c->getConnection(), + $prefix.'channel' => $c->getChannel(), + $prefix.'name' => $c->getName(), + $prefix.'arguments' => $c->getArguments(), + ]; + + return $a; + } + + public static function castExchange(\AMQPExchange $c, array $a, Stub $stub, bool $isNested): array + { + $prefix = Caster::PREFIX_VIRTUAL; + + $a += [ + $prefix.'flags' => self::extractFlags($c->getFlags()), + ]; + + $type = isset(self::EXCHANGE_TYPES[$c->getType()]) ? new ConstStub(self::EXCHANGE_TYPES[$c->getType()], $c->getType()) : $c->getType(); + + // Recent version of the extension already expose private properties + if (isset($a["\x00AMQPExchange\x00name"])) { + $a["\x00AMQPExchange\x00type"] = $type; + + return $a; + } + + $a += [ + $prefix.'connection' => $c->getConnection(), + $prefix.'channel' => $c->getChannel(), + $prefix.'name' => $c->getName(), + $prefix.'type' => $type, + $prefix.'arguments' => $c->getArguments(), + ]; + + return $a; + } + + public static function castEnvelope(\AMQPEnvelope $c, array $a, Stub $stub, bool $isNested, int $filter = 0): array + { + $prefix = Caster::PREFIX_VIRTUAL; + + $deliveryMode = new ConstStub($c->getDeliveryMode().(2 === $c->getDeliveryMode() ? ' (persistent)' : ' (non-persistent)'), $c->getDeliveryMode()); + + // Recent version of the extension already expose private properties + if (isset($a["\x00AMQPEnvelope\x00body"])) { + $a["\0AMQPEnvelope\0delivery_mode"] = $deliveryMode; + + return $a; + } + + if (!($filter & Caster::EXCLUDE_VERBOSE)) { + $a += [$prefix.'body' => $c->getBody()]; + } + + $a += [ + $prefix.'delivery_tag' => $c->getDeliveryTag(), + $prefix.'is_redelivery' => $c->isRedelivery(), + $prefix.'exchange_name' => $c->getExchangeName(), + $prefix.'routing_key' => $c->getRoutingKey(), + $prefix.'content_type' => $c->getContentType(), + $prefix.'content_encoding' => $c->getContentEncoding(), + $prefix.'headers' => $c->getHeaders(), + $prefix.'delivery_mode' => $deliveryMode, + $prefix.'priority' => $c->getPriority(), + $prefix.'correlation_id' => $c->getCorrelationId(), + $prefix.'reply_to' => $c->getReplyTo(), + $prefix.'expiration' => $c->getExpiration(), + $prefix.'message_id' => $c->getMessageId(), + $prefix.'timestamp' => $c->getTimeStamp(), + $prefix.'type' => $c->getType(), + $prefix.'user_id' => $c->getUserId(), + $prefix.'app_id' => $c->getAppId(), + ]; + + return $a; + } + + private static function extractFlags(int $flags): ConstStub + { + $flagsArray = []; + + foreach (self::FLAGS as $value => $name) { + if ($flags & $value) { + $flagsArray[] = $name; + } + } + + if (!$flagsArray) { + $flagsArray = ['AMQP_NOPARAM']; + } + + return new ConstStub(implode('|', $flagsArray), $flags); + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/ArgsStub.php b/upLoadImage/vendor/symfony/var-dumper/Caster/ArgsStub.php new file mode 100644 index 0000000..aadd033 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/ArgsStub.php @@ -0,0 +1,79 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Represents a list of function arguments. + * + * @author Nicolas Grekas + */ +class ArgsStub extends EnumStub +{ + private static array $parameters = []; + + public function __construct(array $args, string $function, ?string $class) + { + [$variadic, $params] = self::getParameters($function, $class); + + $values = []; + foreach ($args as $k => $v) { + $values[$k] = !\is_scalar($v) && !$v instanceof Stub ? new CutStub($v) : $v; + } + if (null === $params) { + parent::__construct($values, false); + + return; + } + if (\count($values) < \count($params)) { + $params = \array_slice($params, 0, \count($values)); + } elseif (\count($values) > \count($params)) { + $values[] = new EnumStub(array_splice($values, \count($params)), false); + $params[] = $variadic; + } + if (['...'] === $params) { + parent::__construct($values[0]->value, false); + } else { + parent::__construct(array_combine($params, $values)); + } + } + + private static function getParameters(string $function, ?string $class): array + { + if (isset(self::$parameters[$k = $class.'::'.$function])) { + return self::$parameters[$k]; + } + + try { + $r = null !== $class ? new \ReflectionMethod($class, $function) : new \ReflectionFunction($function); + } catch (\ReflectionException) { + return [null, null]; + } + + $variadic = '...'; + $params = []; + foreach ($r->getParameters() as $v) { + $k = '$'.$v->name; + if ($v->isPassedByReference()) { + $k = '&'.$k; + } + if ($v->isVariadic()) { + $variadic .= $k; + } else { + $params[] = $k; + } + } + + return self::$parameters[$k] = [$variadic, $params]; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/Caster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/Caster.php new file mode 100644 index 0000000..c3bc54e --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/Caster.php @@ -0,0 +1,203 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Helper for filtering out properties in casters. + * + * @author Nicolas Grekas + * + * @final + */ +class Caster +{ + public const EXCLUDE_VERBOSE = 1; + public const EXCLUDE_VIRTUAL = 2; + public const EXCLUDE_DYNAMIC = 4; + public const EXCLUDE_PUBLIC = 8; + public const EXCLUDE_PROTECTED = 16; + public const EXCLUDE_PRIVATE = 32; + public const EXCLUDE_NULL = 64; + public const EXCLUDE_EMPTY = 128; + public const EXCLUDE_NOT_IMPORTANT = 256; + public const EXCLUDE_STRICT = 512; + public const EXCLUDE_UNINITIALIZED = 1024; + + public const PREFIX_VIRTUAL = "\0~\0"; + public const PREFIX_DYNAMIC = "\0+\0"; + public const PREFIX_PROTECTED = "\0*\0"; + // usage: sprintf(Caster::PATTERN_PRIVATE, $class, $property) + public const PATTERN_PRIVATE = "\0%s\0%s"; + + private static array $classProperties = []; + + /** + * Casts objects to arrays and adds the dynamic property prefix. + * + * @param bool $hasDebugInfo Whether the __debugInfo method exists on $obj or not + * + * @internal since Symfony 7.3 + */ + public static function castObject(object $obj, string $class, bool $hasDebugInfo = false, ?string $debugClass = null): array + { + if ($hasDebugInfo) { + try { + $debugInfo = $obj->__debugInfo(); + } catch (\Throwable) { + // ignore failing __debugInfo() + $hasDebugInfo = false; + } + } + + $a = $obj instanceof \Closure ? [] : (array) $obj; + + if ($obj instanceof \__PHP_Incomplete_Class) { + return $a; + } + + $classProperties = self::$classProperties[$class] ??= self::getClassProperties(new \ReflectionClass($class)); + $a = array_replace($classProperties, $a); + + if ($a) { + $debugClass ??= get_debug_type($obj); + + $i = 0; + $prefixedKeys = []; + foreach ($a as $k => $v) { + if ("\0" !== ($k[0] ?? '')) { + if (!isset($classProperties[$k])) { + $prefixedKeys[$i] = self::PREFIX_DYNAMIC.$k; + } + } elseif ($debugClass !== $class && 1 === strpos($k, $class)) { + $prefixedKeys[$i] = "\0".$debugClass.strrchr($k, "\0"); + } + ++$i; + } + if ($prefixedKeys) { + $keys = array_keys($a); + foreach ($prefixedKeys as $i => $k) { + $keys[$i] = $k; + } + $a = array_combine($keys, $a); + } + } + + if ($hasDebugInfo && \is_array($debugInfo)) { + foreach ($debugInfo as $k => $v) { + if (!isset($k[0]) || "\0" !== $k[0]) { + if (\array_key_exists(self::PREFIX_DYNAMIC.$k, $a)) { + continue; + } + $k = self::PREFIX_VIRTUAL.$k; + } + + unset($a[$k]); + $a[$k] = $v; + } + } + + return $a; + } + + /** + * Filters out the specified properties. + * + * By default, a single match in the $filter bit field filters properties out, following an "or" logic. + * When EXCLUDE_STRICT is set, an "and" logic is applied: all bits must match for a property to be removed. + * + * @param array $a The array containing the properties to filter + * @param int $filter A bit field of Caster::EXCLUDE_* constants specifying which properties to filter out + * @param string[] $listedProperties List of properties to exclude when Caster::EXCLUDE_VERBOSE is set, and to preserve when Caster::EXCLUDE_NOT_IMPORTANT is set + * @param int|null &$count Set to the number of removed properties + */ + public static function filter(array $a, int $filter, array $listedProperties = [], ?int &$count = 0): array + { + $count = 0; + + foreach ($a as $k => $v) { + $type = self::EXCLUDE_STRICT & $filter; + + if (null === $v) { + $type |= self::EXCLUDE_NULL & $filter; + $type |= self::EXCLUDE_EMPTY & $filter; + } elseif (false === $v || '' === $v || '0' === $v || 0 === $v || 0.0 === $v || [] === $v) { + $type |= self::EXCLUDE_EMPTY & $filter; + } elseif ($v instanceof UninitializedStub) { + $type |= self::EXCLUDE_UNINITIALIZED & $filter; + } + if ((self::EXCLUDE_NOT_IMPORTANT & $filter) && !\in_array($k, $listedProperties, true)) { + $type |= self::EXCLUDE_NOT_IMPORTANT; + } + if ((self::EXCLUDE_VERBOSE & $filter) && \in_array($k, $listedProperties, true)) { + $type |= self::EXCLUDE_VERBOSE; + } + + if (!isset($k[1]) || "\0" !== $k[0]) { + $type |= self::EXCLUDE_PUBLIC & $filter; + } elseif ('~' === $k[1]) { + $type |= self::EXCLUDE_VIRTUAL & $filter; + } elseif ('+' === $k[1]) { + $type |= self::EXCLUDE_DYNAMIC & $filter; + } elseif ('*' === $k[1]) { + $type |= self::EXCLUDE_PROTECTED & $filter; + } else { + $type |= self::EXCLUDE_PRIVATE & $filter; + } + + if ((self::EXCLUDE_STRICT & $filter) ? $type === $filter : $type) { + unset($a[$k]); + ++$count; + } + } + + return $a; + } + + /** + * @internal since Symfony 7.3 + */ + public static function castPhpIncompleteClass(\__PHP_Incomplete_Class $c, array $a, Stub $stub, bool $isNested): array + { + if (isset($a['__PHP_Incomplete_Class_Name'])) { + $stub->class .= '('.$a['__PHP_Incomplete_Class_Name'].')'; + unset($a['__PHP_Incomplete_Class_Name']); + } + + return $a; + } + + private static function getClassProperties(\ReflectionClass $class): array + { + $classProperties = []; + $className = $class->name; + + if ($parent = $class->getParentClass()) { + $classProperties += self::$classProperties[$parent->name] ??= self::getClassProperties($parent); + } + + foreach ($class->getProperties() as $p) { + if ($p->isStatic()) { + continue; + } + + $classProperties[match (true) { + $p->isPublic() => $p->name, + $p->isProtected() => self::PREFIX_PROTECTED.$p->name, + default => "\0".$className."\0".$p->name, + }] = \PHP_VERSION_ID >= 80400 && $p->isVirtual() ? new VirtualStub($p) : new UninitializedStub($p); + } + + return $classProperties; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/ClassStub.php b/upLoadImage/vendor/symfony/var-dumper/Caster/ClassStub.php new file mode 100644 index 0000000..265baa5 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/ClassStub.php @@ -0,0 +1,104 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Represents a PHP class identifier. + * + * @author Nicolas Grekas + */ +class ClassStub extends ConstStub +{ + /** + * @param string $identifier A PHP identifier, e.g. a class, method, interface, etc. name + * @param callable $callable The callable targeted by the identifier when it is ambiguous or not a real PHP identifier + */ + public function __construct(string $identifier, callable|array|string|null $callable = null) + { + $this->value = $identifier; + + try { + if (null !== $callable) { + if ($callable instanceof \Closure) { + $r = new \ReflectionFunction($callable); + } elseif (\is_object($callable)) { + $r = [$callable, '__invoke']; + } elseif (\is_array($callable)) { + $r = $callable; + } elseif (false !== $i = strpos($callable, '::')) { + $r = [substr($callable, 0, $i), substr($callable, 2 + $i)]; + } else { + $r = new \ReflectionFunction($callable); + } + } elseif (0 < $i = strpos($identifier, '::') ?: strpos($identifier, '->')) { + $r = [substr($identifier, 0, $i), substr($identifier, 2 + $i)]; + } else { + $r = new \ReflectionClass($identifier); + } + + if (\is_array($r)) { + try { + $r = new \ReflectionMethod($r[0], $r[1]); + } catch (\ReflectionException) { + $r = new \ReflectionClass($r[0]); + } + } + + if (str_contains($identifier, "@anonymous\0")) { + $this->value = $identifier = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)?[0-9a-fA-F]++/', fn ($m) => class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0], $identifier); + } + + if (null !== $callable && $r instanceof \ReflectionFunctionAbstract) { + $s = ReflectionCaster::castFunctionAbstract($r, [], new Stub(), true, Caster::EXCLUDE_VERBOSE); + $s = ReflectionCaster::getSignature($s); + + if (str_ends_with($identifier, '()')) { + $this->value = substr_replace($identifier, $s, -2); + } else { + $this->value .= $s; + } + } + } catch (\ReflectionException) { + return; + } finally { + if (0 < $i = strrpos($this->value, '\\')) { + $this->attr['ellipsis'] = \strlen($this->value) - $i; + $this->attr['ellipsis-type'] = 'class'; + $this->attr['ellipsis-tail'] = 1; + } + } + + if ($f = $r->getFileName()) { + $this->attr['file'] = $f; + $this->attr['line'] = $r->getStartLine(); + } + } + + public static function wrapCallable(mixed $callable): mixed + { + if (\is_object($callable) || !\is_callable($callable)) { + return $callable; + } + + if (!\is_array($callable)) { + $callable = new static($callable, $callable); + } elseif (\is_string($callable[0])) { + $callable[0] = new static($callable[0], $callable); + } else { + $callable[1] = new static($callable[1], $callable); + } + + return $callable; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/ConstStub.php b/upLoadImage/vendor/symfony/var-dumper/Caster/ConstStub.php new file mode 100644 index 0000000..adea786 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/ConstStub.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Represents a PHP constant and its value. + * + * @author Nicolas Grekas + */ +class ConstStub extends Stub +{ + public function __construct(string $name, string|int|float|null $value = null) + { + $this->class = $name; + $this->value = 1 < \func_num_args() ? $value : $name; + } + + public function __toString(): string + { + return (string) $this->value; + } + + /** + * @param array $values + */ + public static function fromBitfield(int $value, array $values): self + { + $names = []; + foreach ($values as $v => $name) { + if ($value & $v) { + $names[] = $name; + } + } + + if (!$names) { + $names[] = $values[0] ?? 0; + } + + return new self(implode(' | ', $names), $value); + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/CurlCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/CurlCaster.php new file mode 100644 index 0000000..fe4ec52 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/CurlCaster.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * @author Nicolas Grekas + * + * @internal + */ +final class CurlCaster +{ + public static function castCurl(\CurlHandle $h, array $a, Stub $stub, bool $isNested): array + { + foreach (curl_getinfo($h) as $key => $val) { + $a[Caster::PREFIX_VIRTUAL.$key] = $val; + } + + return $a; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/CutArrayStub.php b/upLoadImage/vendor/symfony/var-dumper/Caster/CutArrayStub.php new file mode 100644 index 0000000..5912e13 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/CutArrayStub.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +/** + * Represents a cut array. + * + * @author Nicolas Grekas + */ +class CutArrayStub extends CutStub +{ + public array $preservedSubset; + + public function __construct(array $value, array $preservedKeys) + { + parent::__construct($value); + + $this->preservedSubset = array_intersect_key($value, array_flip($preservedKeys)); + $this->cut -= \count($this->preservedSubset); + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/CutStub.php b/upLoadImage/vendor/symfony/var-dumper/Caster/CutStub.php new file mode 100644 index 0000000..6870a9c --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/CutStub.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Represents the main properties of a PHP variable, pre-casted by a caster. + * + * @author Nicolas Grekas + */ +class CutStub extends Stub +{ + public function __construct(mixed $value) + { + $this->value = $value; + + switch (\gettype($value)) { + case 'object': + $this->type = self::TYPE_OBJECT; + $this->class = get_debug_type($value); + + if ($value instanceof \Closure) { + ReflectionCaster::castClosure($value, [], $this, true, Caster::EXCLUDE_VERBOSE); + } + + $this->cut = -1; + break; + + case 'array': + $this->type = self::TYPE_ARRAY; + $this->class = self::ARRAY_ASSOC; + $this->cut = $this->value = \count($value); + break; + + case 'resource': + case 'unknown type': + case 'resource (closed)': + $this->type = self::TYPE_RESOURCE; + $this->handle = (int) $value; + if ('Unknown' === $this->class = @get_resource_type($value)) { + $this->class = 'Closed'; + } + $this->cut = -1; + break; + + case 'string': + $this->type = self::TYPE_STRING; + $this->class = preg_match('//u', $value) ? self::STRING_UTF8 : self::STRING_BINARY; + $this->cut = self::STRING_BINARY === $this->class ? \strlen($value) : mb_strlen($value, 'UTF-8'); + $this->value = ''; + break; + } + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/DOMCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/DOMCaster.php new file mode 100644 index 0000000..10fefed --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/DOMCaster.php @@ -0,0 +1,209 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Casts DOM related classes to array representation. + * + * @author Nicolas Grekas + * + * @final + * + * @internal since Symfony 7.3 + */ +class DOMCaster +{ + private const ERROR_CODES = [ + 0 => 'DOM_PHP_ERR', + \DOM_INDEX_SIZE_ERR => 'DOM_INDEX_SIZE_ERR', + \DOMSTRING_SIZE_ERR => 'DOMSTRING_SIZE_ERR', + \DOM_HIERARCHY_REQUEST_ERR => 'DOM_HIERARCHY_REQUEST_ERR', + \DOM_WRONG_DOCUMENT_ERR => 'DOM_WRONG_DOCUMENT_ERR', + \DOM_INVALID_CHARACTER_ERR => 'DOM_INVALID_CHARACTER_ERR', + \DOM_NO_DATA_ALLOWED_ERR => 'DOM_NO_DATA_ALLOWED_ERR', + \DOM_NO_MODIFICATION_ALLOWED_ERR => 'DOM_NO_MODIFICATION_ALLOWED_ERR', + \DOM_NOT_FOUND_ERR => 'DOM_NOT_FOUND_ERR', + \DOM_NOT_SUPPORTED_ERR => 'DOM_NOT_SUPPORTED_ERR', + \DOM_INUSE_ATTRIBUTE_ERR => 'DOM_INUSE_ATTRIBUTE_ERR', + \DOM_INVALID_STATE_ERR => 'DOM_INVALID_STATE_ERR', + \DOM_SYNTAX_ERR => 'DOM_SYNTAX_ERR', + \DOM_INVALID_MODIFICATION_ERR => 'DOM_INVALID_MODIFICATION_ERR', + \DOM_NAMESPACE_ERR => 'DOM_NAMESPACE_ERR', + \DOM_INVALID_ACCESS_ERR => 'DOM_INVALID_ACCESS_ERR', + \DOM_VALIDATION_ERR => 'DOM_VALIDATION_ERR', + ]; + + private const NODE_TYPES = [ + \XML_ELEMENT_NODE => 'XML_ELEMENT_NODE', + \XML_ATTRIBUTE_NODE => 'XML_ATTRIBUTE_NODE', + \XML_TEXT_NODE => 'XML_TEXT_NODE', + \XML_CDATA_SECTION_NODE => 'XML_CDATA_SECTION_NODE', + \XML_ENTITY_REF_NODE => 'XML_ENTITY_REF_NODE', + \XML_ENTITY_NODE => 'XML_ENTITY_NODE', + \XML_PI_NODE => 'XML_PI_NODE', + \XML_COMMENT_NODE => 'XML_COMMENT_NODE', + \XML_DOCUMENT_NODE => 'XML_DOCUMENT_NODE', + \XML_DOCUMENT_TYPE_NODE => 'XML_DOCUMENT_TYPE_NODE', + \XML_DOCUMENT_FRAG_NODE => 'XML_DOCUMENT_FRAG_NODE', + \XML_NOTATION_NODE => 'XML_NOTATION_NODE', + \XML_HTML_DOCUMENT_NODE => 'XML_HTML_DOCUMENT_NODE', + \XML_DTD_NODE => 'XML_DTD_NODE', + \XML_ELEMENT_DECL_NODE => 'XML_ELEMENT_DECL_NODE', + \XML_ATTRIBUTE_DECL_NODE => 'XML_ATTRIBUTE_DECL_NODE', + \XML_ENTITY_DECL_NODE => 'XML_ENTITY_DECL_NODE', + \XML_NAMESPACE_DECL_NODE => 'XML_NAMESPACE_DECL_NODE', + ]; + + public static function castException(\DOMException|\Dom\Exception $e, array $a, Stub $stub, bool $isNested): array + { + $k = Caster::PREFIX_PROTECTED.'code'; + if (isset($a[$k], self::ERROR_CODES[$a[$k]])) { + $a[$k] = new ConstStub(self::ERROR_CODES[$a[$k]], $a[$k]); + } + + return $a; + } + + public static function castLength($dom, array $a, Stub $stub, bool $isNested): array + { + return $a; + } + + public static function castImplementation(\DOMImplementation|\Dom\Implementation $dom, array $a, Stub $stub, bool $isNested): array + { + $a += [ + Caster::PREFIX_VIRTUAL.'Core' => '1.0', + Caster::PREFIX_VIRTUAL.'XML' => '2.0', + ]; + + return $a; + } + + public static function castNode(\DOMNode|\Dom\Node $dom, array $a, Stub $stub, bool $isNested): array + { + return self::castDom($dom, $a, $stub, $isNested); + } + + public static function castNameSpaceNode(\DOMNameSpaceNode $dom, array $a, Stub $stub, bool $isNested): array + { + return self::castDom($dom, $a, $stub, $isNested); + } + + public static function castDocument(\DOMDocument $dom, array $a, Stub $stub, bool $isNested, int $filter = 0): array + { + if (!($filter & Caster::EXCLUDE_VERBOSE)) { + $formatOutput = $dom->formatOutput; + $dom->formatOutput = true; + $a += [Caster::PREFIX_VIRTUAL.'xml' => $dom->saveXML()]; + $dom->formatOutput = $formatOutput; + } + + return $a; + } + + public static function castXMLDocument(\Dom\XMLDocument $dom, array $a, Stub $stub, bool $isNested, int $filter = 0): array + { + if (!($filter & Caster::EXCLUDE_VERBOSE)) { + $formatOutput = $dom->formatOutput; + $dom->formatOutput = true; + $a += [Caster::PREFIX_VIRTUAL.'xml' => $dom->saveXML()]; + $dom->formatOutput = $formatOutput; + } + + return $a; + } + + public static function castHTMLDocument(\Dom\HTMLDocument $dom, array $a, Stub $stub, bool $isNested, int $filter = 0): array + { + if (!($filter & Caster::EXCLUDE_VERBOSE)) { + $a += [Caster::PREFIX_VIRTUAL.'html' => $dom->saveHTML()]; + } + + return $a; + } + + public static function castCharacterData(\DOMCharacterData|\Dom\CharacterData $dom, array $a, Stub $stub, bool $isNested): array + { + return $a; + } + + public static function castAttr(\DOMAttr|\Dom\Attr $dom, array $a, Stub $stub, bool $isNested): array + { + return $a; + } + + public static function castElement(\DOMElement|\Dom\Element $dom, array $a, Stub $stub, bool $isNested): array + { + return $a; + } + + public static function castText(\DOMText|\Dom\Text $dom, array $a, Stub $stub, bool $isNested): array + { + return $a; + } + + public static function castDocumentType(\DOMDocumentType|\Dom\DocumentType $dom, array $a, Stub $stub, bool $isNested): array + { + return $a; + } + + public static function castNotation(\DOMNotation|\Dom\Notation $dom, array $a, Stub $stub, bool $isNested): array + { + return $a; + } + + public static function castEntity(\DOMEntity|\Dom\Entity $dom, array $a, Stub $stub, bool $isNested): array + { + return $a; + } + + public static function castProcessingInstruction(\DOMProcessingInstruction|\Dom\ProcessingInstruction $dom, array $a, Stub $stub, bool $isNested): array + { + return $a; + } + + public static function castXPath(\DOMXPath|\Dom\XPath $dom, array $a, Stub $stub, bool $isNested): array + { + return self::castDom($dom, $a, $stub, $isNested); + } + + public static function castDom($dom, array $a, Stub $stub, bool $isNested, int $filter = 0): array + { + foreach ($a as $k => $v) { + if ('encoding' === $k && $dom instanceof \DOMEntity + || \in_array($k, ['actualEncoding', 'config', 'standalone', 'version'], true) + ) { + continue; // deprecated properties + } + + $v = $dom->$k; + + $a[$k] = match (true) { + $v instanceof \DOMNode || $v instanceof \Dom\Node => new CutStub($v), + 'nodeType' === $k => new ConstStub(self::NODE_TYPES[$v], $v), + 'baseURI' === $k && $v, + 'documentURI' === $k && $v => new LinkStub($v), + default => $v, + }; + } + + if ($dom instanceof \IteratorAggregate) { + foreach ($dom as $k => $v) { + $a[Caster::PREFIX_VIRTUAL.$k] = $v; + } + } + + return $a; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/DateCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/DateCaster.php new file mode 100644 index 0000000..453d0cb --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/DateCaster.php @@ -0,0 +1,129 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Casts DateTimeInterface related classes to array representation. + * + * @author Dany Maillard + * + * @final + * + * @internal since Symfony 7.3 + */ +class DateCaster +{ + private const PERIOD_LIMIT = 3; + + public static function castDateTime(\DateTimeInterface $d, array $a, Stub $stub, bool $isNested, int $filter): array + { + $prefix = Caster::PREFIX_VIRTUAL; + $location = $d->getTimezone() ? $d->getTimezone()->getLocation() : null; + $fromNow = (new \DateTimeImmutable())->diff($d); + + $title = $d->format('l, F j, Y') + ."\n".self::formatInterval($fromNow).' from now' + .($location ? ($d->format('I') ? "\nDST On" : "\nDST Off") : '') + ; + + unset( + $a[Caster::PREFIX_DYNAMIC.'date'], + $a[Caster::PREFIX_DYNAMIC.'timezone'], + $a[Caster::PREFIX_DYNAMIC.'timezone_type'] + ); + $a[$prefix.'date'] = new ConstStub(self::formatDateTime($d, $location ? ' e (P)' : ' P'), $title); + + $stub->class .= $d->format(' @U'); + + return $a; + } + + public static function castInterval(\DateInterval $interval, array $a, Stub $stub, bool $isNested, int $filter): array + { + $now = new \DateTimeImmutable('@0', new \DateTimeZone('UTC')); + $numberOfSeconds = $now->add($interval)->getTimestamp() - $now->getTimestamp(); + $title = number_format($numberOfSeconds, 0, '.', ' ').'s'; + + $i = [Caster::PREFIX_VIRTUAL.'interval' => new ConstStub(self::formatInterval($interval), $title)]; + + return $filter & Caster::EXCLUDE_VERBOSE ? $i : $i + $a; + } + + private static function formatInterval(\DateInterval $i): string + { + $format = '%R '; + + if (0 === $i->y && 0 === $i->m && ($i->h >= 24 || $i->i >= 60 || $i->s >= 60)) { + $d = new \DateTimeImmutable('@0', new \DateTimeZone('UTC')); + $i = $d->diff($d->add($i)); // recalculate carry over points + $format .= 0 < $i->days ? '%ad ' : ''; + } else { + $format .= ($i->y ? '%yy ' : '').($i->m ? '%mm ' : '').($i->d ? '%dd ' : ''); + } + + $format .= $i->h || $i->i || $i->s || $i->f ? '%H:%I:'.self::formatSeconds($i->s, substr($i->f, 2)) : ''; + $format = '%R ' === $format ? '0s' : $format; + + return $i->format(rtrim($format)); + } + + public static function castTimeZone(\DateTimeZone $timeZone, array $a, Stub $stub, bool $isNested, int $filter): array + { + $location = $timeZone->getLocation(); + $formatted = (new \DateTimeImmutable('now', $timeZone))->format($location ? 'e (P)' : 'P'); + $title = $location && \extension_loaded('intl') ? \Locale::getDisplayRegion('-'.$location['country_code']) : ''; + + $z = [Caster::PREFIX_VIRTUAL.'timezone' => new ConstStub($formatted, $title)]; + + return $filter & Caster::EXCLUDE_VERBOSE ? $z : $z + $a; + } + + public static function castPeriod(\DatePeriod $p, array $a, Stub $stub, bool $isNested, int $filter): array + { + $dates = []; + foreach (clone $p as $i => $d) { + if (self::PERIOD_LIMIT === $i) { + $now = new \DateTimeImmutable('now', new \DateTimeZone('UTC')); + $dates[] = \sprintf('%s more', ($end = $p->getEndDate()) + ? ceil(($end->format('U.u') - $d->format('U.u')) / ((int) $now->add($p->getDateInterval())->format('U.u') - (int) $now->format('U.u'))) + : $p->recurrences - $i + ); + break; + } + $dates[] = \sprintf('%s) %s', $i + 1, self::formatDateTime($d)); + } + + $period = \sprintf( + 'every %s, from %s%s %s', + self::formatInterval($p->getDateInterval()), + $p->include_start_date ? '[' : ']', + self::formatDateTime($p->getStartDate()), + ($end = $p->getEndDate()) ? 'to '.self::formatDateTime($end).($p->include_end_date ? ']' : '[') : 'recurring '.$p->recurrences.' time/s' + ); + + $p = [Caster::PREFIX_VIRTUAL.'period' => new ConstStub($period, implode("\n", $dates))]; + + return $filter & Caster::EXCLUDE_VERBOSE ? $p : $p + $a; + } + + private static function formatDateTime(\DateTimeInterface $d, string $extra = ''): string + { + return $d->format('Y-m-d H:i:'.self::formatSeconds($d->format('s'), $d->format('u')).$extra); + } + + private static function formatSeconds(string $s, string $us): string + { + return \sprintf('%02d.%s', $s, 0 === ($len = \strlen($t = rtrim($us, '0'))) ? '0' : ($len <= 3 ? str_pad($t, 3, '0') : $us)); + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/DoctrineCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/DoctrineCaster.php new file mode 100644 index 0000000..b963112 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/DoctrineCaster.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Doctrine\Common\Proxy\Proxy as CommonProxy; +use Doctrine\ORM\PersistentCollection; +use Doctrine\ORM\Proxy\Proxy as OrmProxy; +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Casts Doctrine related classes to array representation. + * + * @author Nicolas Grekas + * + * @final + * + * @internal since Symfony 7.3 + */ +class DoctrineCaster +{ + public static function castCommonProxy(CommonProxy $proxy, array $a, Stub $stub, bool $isNested): array + { + foreach (['__cloner__', '__initializer__'] as $k) { + if (\array_key_exists($k, $a)) { + unset($a[$k]); + ++$stub->cut; + } + } + + return $a; + } + + public static function castOrmProxy(OrmProxy $proxy, array $a, Stub $stub, bool $isNested): array + { + foreach (['_entityPersister', '_identifier'] as $k) { + if (\array_key_exists($k = "\0Doctrine\\ORM\\Proxy\\Proxy\0".$k, $a)) { + unset($a[$k]); + ++$stub->cut; + } + } + + return $a; + } + + public static function castPersistentCollection(PersistentCollection $coll, array $a, Stub $stub, bool $isNested): array + { + foreach (['snapshot', 'association', 'typeClass'] as $k) { + if (\array_key_exists($k = "\0Doctrine\\ORM\\PersistentCollection\0".$k, $a)) { + $a[$k] = new CutStub($a[$k]); + } + } + + return $a; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/DsCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/DsCaster.php new file mode 100644 index 0000000..b34b670 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/DsCaster.php @@ -0,0 +1,70 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Ds\Collection; +use Ds\Map; +use Ds\Pair; +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Casts Ds extension classes to array representation. + * + * @author Jáchym Toušek + * + * @final + */ +class DsCaster +{ + public static function castCollection(Collection $c, array $a, Stub $stub, bool $isNested): array + { + $a[Caster::PREFIX_VIRTUAL.'count'] = $c->count(); + $a[Caster::PREFIX_VIRTUAL.'capacity'] = $c->capacity(); + + if (!$c instanceof Map) { + $a += $c->toArray(); + } + + return $a; + } + + public static function castMap(Map $c, array $a, Stub $stub, bool $isNested): array + { + foreach ($c as $k => $v) { + $a[] = new DsPairStub($k, $v); + } + + return $a; + } + + public static function castPair(Pair $c, array $a, Stub $stub, bool $isNested): array + { + foreach ($c->toArray() as $k => $v) { + $a[Caster::PREFIX_VIRTUAL.$k] = $v; + } + + return $a; + } + + public static function castPairStub(DsPairStub $c, array $a, Stub $stub, bool $isNested): array + { + if ($isNested) { + $stub->class = Pair::class; + $stub->value = null; + $stub->handle = 0; + + $a = $c->value; + } + + return $a; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/DsPairStub.php b/upLoadImage/vendor/symfony/var-dumper/Caster/DsPairStub.php new file mode 100644 index 0000000..afa2727 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/DsPairStub.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * @author Nicolas Grekas + */ +class DsPairStub extends Stub +{ + public function __construct(mixed $key, mixed $value) + { + $this->value = [ + Caster::PREFIX_VIRTUAL.'key' => $key, + Caster::PREFIX_VIRTUAL.'value' => $value, + ]; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/EnumStub.php b/upLoadImage/vendor/symfony/var-dumper/Caster/EnumStub.php new file mode 100644 index 0000000..11e0cd9 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/EnumStub.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Represents an enumeration of values. + * + * @author Nicolas Grekas + */ +class EnumStub extends Stub +{ + public function __construct( + array $values, + public bool $dumpKeys = true, + ) { + $this->value = $values; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/ExceptionCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/ExceptionCaster.php new file mode 100644 index 0000000..4473bdc --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/ExceptionCaster.php @@ -0,0 +1,397 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\ErrorHandler\Exception\FlattenException; +use Symfony\Component\ErrorHandler\Exception\SilencedErrorContext; +use Symfony\Component\VarDumper\Cloner\Stub; +use Symfony\Component\VarDumper\Exception\ThrowingCasterException; + +/** + * Casts common Exception classes to array representation. + * + * @author Nicolas Grekas + * + * @final + * + * @internal since Symfony 7.3 + */ +class ExceptionCaster +{ + public static int $srcContext = 1; + public static bool $traceArgs = true; + public static array $errorTypes = [ + \E_DEPRECATED => 'E_DEPRECATED', + \E_USER_DEPRECATED => 'E_USER_DEPRECATED', + \E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR', + \E_ERROR => 'E_ERROR', + \E_WARNING => 'E_WARNING', + \E_PARSE => 'E_PARSE', + \E_NOTICE => 'E_NOTICE', + \E_CORE_ERROR => 'E_CORE_ERROR', + \E_CORE_WARNING => 'E_CORE_WARNING', + \E_COMPILE_ERROR => 'E_COMPILE_ERROR', + \E_COMPILE_WARNING => 'E_COMPILE_WARNING', + \E_USER_ERROR => 'E_USER_ERROR', + \E_USER_WARNING => 'E_USER_WARNING', + \E_USER_NOTICE => 'E_USER_NOTICE', + 2048 => 'E_STRICT', + ]; + + private static array $framesCache = []; + + public static function castError(\Error $e, array $a, Stub $stub, bool $isNested, int $filter = 0): array + { + return self::filterExceptionArray($stub->class, $a, "\0Error\0", $filter); + } + + public static function castException(\Exception $e, array $a, Stub $stub, bool $isNested, int $filter = 0): array + { + return self::filterExceptionArray($stub->class, $a, "\0Exception\0", $filter); + } + + public static function castErrorException(\ErrorException $e, array $a, Stub $stub, bool $isNested): array + { + if (isset($a[$s = Caster::PREFIX_PROTECTED.'severity'], self::$errorTypes[$a[$s]])) { + $a[$s] = new ConstStub(self::$errorTypes[$a[$s]], $a[$s]); + } + + return $a; + } + + public static function castThrowingCasterException(ThrowingCasterException $e, array $a, Stub $stub, bool $isNested): array + { + $trace = Caster::PREFIX_VIRTUAL.'trace'; + $prefix = Caster::PREFIX_PROTECTED; + $xPrefix = "\0Exception\0"; + + if (isset($a[$xPrefix.'previous'], $a[$trace]) && $a[$xPrefix.'previous'] instanceof \Exception) { + $b = (array) $a[$xPrefix.'previous']; + $class = get_debug_type($a[$xPrefix.'previous']); + self::traceUnshift($b[$xPrefix.'trace'], $class, $b[$prefix.'file'], $b[$prefix.'line']); + $a[$trace] = new TraceStub($b[$xPrefix.'trace'], false, 0, -\count($a[$trace]->value)); + } + + unset($a[$xPrefix.'previous'], $a[$prefix.'code'], $a[$prefix.'file'], $a[$prefix.'line']); + + return $a; + } + + public static function castSilencedErrorContext(SilencedErrorContext $e, array $a, Stub $stub, bool $isNested): array + { + $sPrefix = "\0".SilencedErrorContext::class."\0"; + + if (!isset($a[$s = $sPrefix.'severity'])) { + return $a; + } + + if (isset(self::$errorTypes[$a[$s]])) { + $a[$s] = new ConstStub(self::$errorTypes[$a[$s]], $a[$s]); + } + + $trace = [[ + 'file' => $a[$sPrefix.'file'], + 'line' => $a[$sPrefix.'line'], + ]]; + + if (isset($a[$sPrefix.'trace'])) { + $trace = array_merge($trace, $a[$sPrefix.'trace']); + } + + unset($a[$sPrefix.'file'], $a[$sPrefix.'line'], $a[$sPrefix.'trace']); + $a[Caster::PREFIX_VIRTUAL.'trace'] = new TraceStub($trace, self::$traceArgs); + + return $a; + } + + public static function castTraceStub(TraceStub $trace, array $a, Stub $stub, bool $isNested): array + { + if (!$isNested) { + return $a; + } + $stub->class = ''; + $stub->handle = 0; + $frames = $trace->value; + $prefix = Caster::PREFIX_VIRTUAL; + + $a = []; + $j = \count($frames); + if (0 > $i = $trace->sliceOffset) { + $i = max(0, $j + $i); + } + if (!isset($trace->value[$i])) { + return []; + } + $lastCall = isset($frames[$i]['function']) ? (isset($frames[$i]['class']) ? $frames[0]['class'].$frames[$i]['type'] : '').$frames[$i]['function'].'()' : ''; + $frames[] = ['function' => '']; + $collapse = false; + + for ($j += $trace->numberingOffset - $i++; isset($frames[$i]); ++$i, --$j) { + $f = $frames[$i]; + $call = isset($f['function']) ? (isset($f['class']) ? $f['class'].$f['type'] : '').$f['function'] : '???'; + + $frame = new FrameStub( + [ + 'object' => $f['object'] ?? null, + 'class' => $f['class'] ?? null, + 'type' => $f['type'] ?? null, + 'function' => $f['function'] ?? null, + ] + $frames[$i - 1], + false, + true + ); + $f = self::castFrameStub($frame, [], $frame, true); + if (isset($f[$prefix.'src'])) { + foreach ($f[$prefix.'src']->value as $label => $frame) { + if (str_starts_with($label, "\0~collapse=0")) { + if ($collapse) { + $label = substr_replace($label, '1', 11, 1); + } else { + $collapse = true; + } + } + $label = substr_replace($label, "title=Stack level $j.&", 2, 0); + } + $f = $frames[$i - 1]; + if ($trace->keepArgs && !empty($f['args']) && $frame instanceof EnumStub) { + $frame->value['arguments'] = new ArgsStub($f['args'], $f['function'] ?? null, $f['class'] ?? null); + } + } elseif ('???' !== $lastCall) { + $label = new ClassStub($lastCall); + if (isset($label->attr['ellipsis'])) { + $label->attr['ellipsis'] += 2; + $label = substr_replace($prefix, "ellipsis-type=class&ellipsis={$label->attr['ellipsis']}&ellipsis-tail=1&title=Stack level $j.", 2, 0).$label->value.'()'; + } else { + $label = substr_replace($prefix, "title=Stack level $j.", 2, 0).$label->value.'()'; + } + } else { + $label = substr_replace($prefix, "title=Stack level $j.", 2, 0).$lastCall; + } + $a[substr_replace($label, \sprintf('separator=%s&', $frame instanceof EnumStub ? ' ' : ':'), 2, 0)] = $frame; + + $lastCall = $call; + } + if (null !== $trace->sliceLength) { + $a = \array_slice($a, 0, $trace->sliceLength, true); + } + + return $a; + } + + public static function castFrameStub(FrameStub $frame, array $a, Stub $stub, bool $isNested): array + { + if (!$isNested) { + return $a; + } + $f = $frame->value; + $prefix = Caster::PREFIX_VIRTUAL; + + if (isset($f['file'], $f['line'])) { + $cacheKey = $f; + unset($cacheKey['object'], $cacheKey['args']); + $cacheKey[] = self::$srcContext; + $cacheKey = implode('-', $cacheKey); + + if (isset(self::$framesCache[$cacheKey])) { + $a[$prefix.'src'] = self::$framesCache[$cacheKey]; + } else { + if (preg_match('/\((\d+)\)(?:\([\da-f]{32}\))? : (?:eval\(\)\'d code|runtime-created function)$/', $f['file'], $match)) { + $f['file'] = substr($f['file'], 0, -\strlen($match[0])); + $f['line'] = (int) $match[1]; + } + $src = $f['line']; + $srcKey = $f['file']; + $ellipsis = new LinkStub($srcKey, 0); + $srcAttr = 'collapse='.(int) $ellipsis->inVendor; + $ellipsisTail = $ellipsis->attr['ellipsis-tail'] ?? 0; + $ellipsis = $ellipsis->attr['ellipsis'] ?? 0; + + if (is_file($f['file']) && 0 <= self::$srcContext) { + if (!empty($f['class']) && is_subclass_of($f['class'], 'Twig\Template')) { + $template = null; + if (isset($f['object'])) { + $template = $f['object']; + } elseif ((new \ReflectionClass($f['class']))->isInstantiable()) { + $template = unserialize(\sprintf('O:%d:"%s":0:{}', \strlen($f['class']), $f['class'])); + } + if (null !== $template) { + $ellipsis = 0; + $templateSrc = method_exists($template, 'getSourceContext') ? $template->getSourceContext()->getCode() : (method_exists($template, 'getSource') ? $template->getSource() : ''); + $templateInfo = $template->getDebugInfo(); + if (isset($templateInfo[$f['line']])) { + if (!method_exists($template, 'getSourceContext') || !is_file($templatePath = $template->getSourceContext()->getPath())) { + $templatePath = null; + } + if ($templateSrc) { + $src = self::extractSource($templateSrc, $templateInfo[$f['line']], self::$srcContext, 'twig', $templatePath, $f); + $srcKey = ($templatePath ?: $template->getTemplateName()).':'.$templateInfo[$f['line']]; + } + } + } + } + if ($srcKey == $f['file']) { + $src = self::extractSource(file_get_contents($f['file']), $f['line'], self::$srcContext, 'php', $f['file'], $f); + $srcKey .= ':'.$f['line']; + if ($ellipsis) { + $ellipsis += 1 + \strlen($f['line']); + } + } + $srcAttr .= \sprintf('&separator= &file=%s&line=%d', rawurlencode($f['file']), $f['line']); + } else { + $srcAttr .= '&separator=:'; + } + $srcAttr .= $ellipsis ? '&ellipsis-type=path&ellipsis='.$ellipsis.'&ellipsis-tail='.$ellipsisTail : ''; + self::$framesCache[$cacheKey] = $a[$prefix.'src'] = new EnumStub(["\0~$srcAttr\0$srcKey" => $src]); + } + } + + unset($a[$prefix.'args'], $a[$prefix.'line'], $a[$prefix.'file']); + if ($frame->inTraceStub) { + unset($a[$prefix.'class'], $a[$prefix.'type'], $a[$prefix.'function']); + } + foreach ($a as $k => $v) { + if (!$v) { + unset($a[$k]); + } + } + if ($frame->keepArgs && !empty($f['args'])) { + $a[$prefix.'arguments'] = new ArgsStub($f['args'], $f['function'], $f['class']); + } + + return $a; + } + + public static function castFlattenException(FlattenException $e, array $a, Stub $stub, bool $isNested): array + { + if ($isNested) { + $k = \sprintf(Caster::PATTERN_PRIVATE, FlattenException::class, 'traceAsString'); + $a[$k] = new CutStub($a[$k]); + } + + return $a; + } + + private static function filterExceptionArray(string $xClass, array $a, string $xPrefix, int $filter): array + { + if (isset($a[$xPrefix.'trace'])) { + $trace = $a[$xPrefix.'trace']; + unset($a[$xPrefix.'trace']); // Ensures the trace is always last + } else { + $trace = []; + } + + if (!($filter & Caster::EXCLUDE_VERBOSE) && $trace) { + if (isset($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line'])) { + self::traceUnshift($trace, $xClass, $a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line']); + } + $a[Caster::PREFIX_VIRTUAL.'trace'] = new TraceStub($trace, self::$traceArgs); + } + if (empty($a[$xPrefix.'previous'])) { + unset($a[$xPrefix.'previous']); + } + unset($a[$xPrefix.'string'], $a[Caster::PREFIX_DYNAMIC.'xdebug_message']); + + if (isset($a[Caster::PREFIX_PROTECTED.'message']) && str_contains($a[Caster::PREFIX_PROTECTED.'message'], "@anonymous\0")) { + $a[Caster::PREFIX_PROTECTED.'message'] = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)?[0-9a-fA-F]++/', fn ($m) => class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0], $a[Caster::PREFIX_PROTECTED.'message']); + } + + if (isset($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line'])) { + $a[Caster::PREFIX_PROTECTED.'file'] = new LinkStub($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line']); + } + + return $a; + } + + private static function traceUnshift(array &$trace, ?string $class, string $file, int $line): void + { + if (isset($trace[0]['file'], $trace[0]['line']) && $trace[0]['file'] === $file && $trace[0]['line'] === $line) { + return; + } + array_unshift($trace, [ + 'function' => $class ? 'new '.$class : null, + 'file' => $file, + 'line' => $line, + ]); + } + + private static function extractSource(string $srcLines, int $line, int $srcContext, string $lang, ?string $file, array $frame): EnumStub + { + $srcLines = explode("\n", $srcLines); + $src = []; + + for ($i = $line - 1 - $srcContext; $i <= $line - 1 + $srcContext; ++$i) { + $src[] = ($srcLines[$i] ?? '')."\n"; + } + + if ($frame['function'] ?? false) { + $stub = new CutStub(new \stdClass()); + $stub->class = (isset($frame['class']) ? $frame['class'].$frame['type'] : '').$frame['function']; + $stub->type = Stub::TYPE_OBJECT; + $stub->attr['cut_hash'] = true; + $stub->attr['file'] = $frame['file']; + $stub->attr['line'] = $frame['line']; + + try { + $caller = isset($frame['class']) ? new \ReflectionMethod($frame['class'], $frame['function']) : new \ReflectionFunction($frame['function']); + $stub->class .= ReflectionCaster::getSignature(ReflectionCaster::castFunctionAbstract($caller, [], $stub, true, Caster::EXCLUDE_VERBOSE)); + + if ($f = $caller->getFileName()) { + $stub->attr['file'] = $f; + $stub->attr['line'] = $caller->getStartLine(); + } + } catch (\ReflectionException) { + // ignore fake class/function + } + + $srcLines = ["\0~separator=\0" => $stub]; + } else { + $stub = null; + $srcLines = []; + } + + $ltrim = 0; + do { + $pad = null; + for ($i = $srcContext << 1; $i >= 0; --$i) { + if (isset($src[$i][$ltrim]) && "\r" !== ($c = $src[$i][$ltrim]) && "\n" !== $c) { + $pad ??= $c; + if ((' ' !== $c && "\t" !== $c) || $pad !== $c) { + break; + } + } + } + ++$ltrim; + } while (0 > $i && null !== $pad); + + --$ltrim; + + foreach ($src as $i => $c) { + if ($ltrim) { + $c = isset($c[$ltrim]) && "\r" !== $c[$ltrim] ? substr($c, $ltrim) : ltrim($c, " \t"); + } + $c = substr($c, 0, -1); + if ($i !== $srcContext) { + $c = new ConstStub('default', $c); + } else { + $c = new ConstStub($c, $stub ? 'in '.$stub->class : ''); + if (null !== $file) { + $c->attr['file'] = $file; + $c->attr['line'] = $line; + } + } + $c->attr['lang'] = $lang; + $srcLines[\sprintf("\0~separator=› &%d\0", $i + $line - $srcContext)] = $c; + } + + return new EnumStub($srcLines); + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/FFICaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/FFICaster.php new file mode 100644 index 0000000..165d0cf --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/FFICaster.php @@ -0,0 +1,171 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use FFI\CData; +use FFI\CType; +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Casts FFI extension classes to array representation. + * + * @author Nesmeyanov Kirill + */ +final class FFICaster +{ + /** + * In case of "char*" contains a string, the length of which depends on + * some other parameter, then during the generation of the string it is + * possible to go beyond the allowable memory area. + * + * This restriction serves to ensure that processing does not take + * up the entire allowable PHP memory limit. + */ + private const MAX_STRING_LENGTH = 255; + + public static function castCTypeOrCData(CData|CType $data, array $args, Stub $stub): array + { + if ($data instanceof CType) { + $type = $data; + $data = null; + } else { + $type = \FFI::typeof($data); + } + + $stub->class = \sprintf('%s<%s> size %d align %d', ($data ?? $type)::class, $type->getName(), $type->getSize(), $type->getAlignment()); + + return match ($type->getKind()) { + CType::TYPE_FLOAT, + CType::TYPE_DOUBLE, + \defined('\FFI\CType::TYPE_LONGDOUBLE') ? CType::TYPE_LONGDOUBLE : -1, + CType::TYPE_UINT8, + CType::TYPE_SINT8, + CType::TYPE_UINT16, + CType::TYPE_SINT16, + CType::TYPE_UINT32, + CType::TYPE_SINT32, + CType::TYPE_UINT64, + CType::TYPE_SINT64, + CType::TYPE_BOOL, + CType::TYPE_CHAR, + CType::TYPE_ENUM => null !== $data ? [Caster::PREFIX_VIRTUAL.'cdata' => $data->cdata] : [], + CType::TYPE_POINTER => self::castFFIPointer($stub, $type, $data), + CType::TYPE_STRUCT => self::castFFIStructLike($type, $data), + CType::TYPE_FUNC => self::castFFIFunction($stub, $type), + default => $args, + }; + } + + private static function castFFIFunction(Stub $stub, CType $type): array + { + $arguments = []; + + for ($i = 0, $count = $type->getFuncParameterCount(); $i < $count; ++$i) { + $param = $type->getFuncParameterType($i); + + $arguments[] = $param->getName(); + } + + $abi = match ($type->getFuncABI()) { + CType::ABI_DEFAULT, + CType::ABI_CDECL => '[cdecl]', + CType::ABI_FASTCALL => '[fastcall]', + CType::ABI_THISCALL => '[thiscall]', + CType::ABI_STDCALL => '[stdcall]', + CType::ABI_PASCAL => '[pascal]', + CType::ABI_REGISTER => '[register]', + CType::ABI_MS => '[ms]', + CType::ABI_SYSV => '[sysv]', + CType::ABI_VECTORCALL => '[vectorcall]', + default => '[unknown abi]', + }; + + $returnType = $type->getFuncReturnType(); + + $stub->class = $abi.' callable('.implode(', ', $arguments).'): ' + .$returnType->getName(); + + return [Caster::PREFIX_VIRTUAL.'returnType' => $returnType]; + } + + private static function castFFIPointer(Stub $stub, CType $type, ?CData $data = null): array + { + $ptr = $type->getPointerType(); + + if (null === $data) { + return [Caster::PREFIX_VIRTUAL.'0' => $ptr]; + } + + return match ($ptr->getKind()) { + CType::TYPE_CHAR => [Caster::PREFIX_VIRTUAL.'cdata' => self::castFFIStringValue($data)], + CType::TYPE_FUNC => self::castFFIFunction($stub, $ptr), + default => [Caster::PREFIX_VIRTUAL.'cdata' => $data[0]], + }; + } + + private static function castFFIStringValue(CData $data): string|CutStub + { + $result = []; + $ffi = \FFI::cdef(<<zend_get_page_size(); + + // get cdata address + $start = $ffi->cast('uintptr_t', $ffi->cast('char*', $data))->cdata; + // accessing memory in the same page as $start is safe + $max = min(self::MAX_STRING_LENGTH, ($start | ($pageSize - 1)) - $start); + + for ($i = 0; $i < $max; ++$i) { + $result[$i] = $data[$i]; + + if ("\0" === $data[$i]) { + return implode('', $result); + } + } + + $string = implode('', $result); + $stub = new CutStub($string); + $stub->cut = -1; + $stub->value = $string; + + return $stub; + } + + private static function castFFIStructLike(CType $type, ?CData $data = null): array + { + $isUnion = ($type->getAttributes() & CType::ATTR_UNION) === CType::ATTR_UNION; + + $result = []; + + foreach ($type->getStructFieldNames() as $name) { + $field = $type->getStructFieldType($name); + + // Retrieving the value of a field from a union containing + // a pointer is not a safe operation, because may contain + // incorrect data. + $isUnsafe = $isUnion && CType::TYPE_POINTER === $field->getKind(); + + if ($isUnsafe) { + $result[Caster::PREFIX_VIRTUAL.$name.'?'] = $field; + } elseif (null === $data) { + $result[Caster::PREFIX_VIRTUAL.$name] = $field; + } else { + $fieldName = $data->{$name} instanceof CData ? '' : $field->getName().' '; + $result[Caster::PREFIX_VIRTUAL.$fieldName.$name] = $data->{$name}; + } + } + + return $result; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/FiberCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/FiberCaster.php new file mode 100644 index 0000000..c9df708 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/FiberCaster.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Casts Fiber related classes to array representation. + * + * @author Grégoire Pineau + */ +final class FiberCaster +{ + public static function castFiber(\Fiber $fiber, array $a, Stub $stub, bool $isNested, int $filter = 0): array + { + $prefix = Caster::PREFIX_VIRTUAL; + + if ($fiber->isTerminated()) { + $status = 'terminated'; + } elseif ($fiber->isRunning()) { + $status = 'running'; + } elseif ($fiber->isSuspended()) { + $status = 'suspended'; + } elseif ($fiber->isStarted()) { + $status = 'started'; + } else { + $status = 'not started'; + } + + $a[$prefix.'status'] = $status; + + return $a; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/FrameStub.php b/upLoadImage/vendor/symfony/var-dumper/Caster/FrameStub.php new file mode 100644 index 0000000..e57aa46 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/FrameStub.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +/** + * Represents a single backtrace frame as returned by debug_backtrace() or Exception->getTrace(). + * + * @author Nicolas Grekas + */ +class FrameStub extends EnumStub +{ + public function __construct( + array $frame, + public bool $keepArgs = true, + public bool $inTraceStub = false, + ) { + parent::__construct($frame); + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/GdCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/GdCaster.php new file mode 100644 index 0000000..db87653 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/GdCaster.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * @author Nicolas Grekas + * + * @internal + */ +final class GdCaster +{ + public static function castGd(\GdImage $gd, array $a, Stub $stub, bool $isNested): array + { + $a[Caster::PREFIX_VIRTUAL.'size'] = imagesx($gd).'x'.imagesy($gd); + $a[Caster::PREFIX_VIRTUAL.'trueColor'] = imageistruecolor($gd); + + return $a; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/GmpCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/GmpCaster.php new file mode 100644 index 0000000..325d2e9 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/GmpCaster.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Casts GMP objects to array representation. + * + * @author Hamza Amrouche + * @author Nicolas Grekas + * + * @final + * + * @internal since Symfony 7.3 + */ +class GmpCaster +{ + public static function castGmp(\GMP $gmp, array $a, Stub $stub, bool $isNested, int $filter): array + { + $a[Caster::PREFIX_VIRTUAL.'value'] = new ConstStub(gmp_strval($gmp), gmp_strval($gmp)); + + return $a; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/ImagineCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/ImagineCaster.php new file mode 100644 index 0000000..0fb2a90 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/ImagineCaster.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Imagine\Image\ImageInterface; +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * @author Grégoire Pineau + * + * @internal since Symfony 7.3 + */ +final class ImagineCaster +{ + public static function castImage(ImageInterface $c, array $a, Stub $stub, bool $isNested): array + { + $imgData = $c->get('png'); + if (\strlen($imgData) > 1 * 1000 * 1000) { + $a += [ + Caster::PREFIX_VIRTUAL.'image' => new ConstStub($c->getSize()), + ]; + } else { + $a += [ + Caster::PREFIX_VIRTUAL.'image' => new ImgStub($imgData, 'image/png', $c->getSize()), + ]; + } + + return $a; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/ImgStub.php b/upLoadImage/vendor/symfony/var-dumper/Caster/ImgStub.php new file mode 100644 index 0000000..a16681f --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/ImgStub.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +/** + * @author Grégoire Pineau + */ +class ImgStub extends ConstStub +{ + public function __construct(string $data, string $contentType, string $size = '') + { + $this->value = ''; + $this->attr['img-data'] = $data; + $this->attr['img-size'] = $size; + $this->attr['content-type'] = $contentType; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/IntlCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/IntlCaster.php new file mode 100644 index 0000000..529c8f7 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/IntlCaster.php @@ -0,0 +1,174 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * @author Nicolas Grekas + * @author Jan Schädlich + * + * @final + * + * @internal since Symfony 7.3 + */ +class IntlCaster +{ + public static function castMessageFormatter(\MessageFormatter $c, array $a, Stub $stub, bool $isNested): array + { + $a += [ + Caster::PREFIX_VIRTUAL.'locale' => $c->getLocale(), + Caster::PREFIX_VIRTUAL.'pattern' => $c->getPattern(), + ]; + + return self::castError($c, $a); + } + + public static function castNumberFormatter(\NumberFormatter $c, array $a, Stub $stub, bool $isNested, int $filter = 0): array + { + $a += [ + Caster::PREFIX_VIRTUAL.'locale' => $c->getLocale(), + Caster::PREFIX_VIRTUAL.'pattern' => $c->getPattern(), + ]; + + if ($filter & Caster::EXCLUDE_VERBOSE) { + $stub->cut += 3; + + return self::castError($c, $a); + } + + $a += [ + Caster::PREFIX_VIRTUAL.'attributes' => new EnumStub( + [ + 'PARSE_INT_ONLY' => $c->getAttribute(\NumberFormatter::PARSE_INT_ONLY), + 'GROUPING_USED' => $c->getAttribute(\NumberFormatter::GROUPING_USED), + 'DECIMAL_ALWAYS_SHOWN' => $c->getAttribute(\NumberFormatter::DECIMAL_ALWAYS_SHOWN), + 'MAX_INTEGER_DIGITS' => $c->getAttribute(\NumberFormatter::MAX_INTEGER_DIGITS), + 'MIN_INTEGER_DIGITS' => $c->getAttribute(\NumberFormatter::MIN_INTEGER_DIGITS), + 'INTEGER_DIGITS' => $c->getAttribute(\NumberFormatter::INTEGER_DIGITS), + 'MAX_FRACTION_DIGITS' => $c->getAttribute(\NumberFormatter::MAX_FRACTION_DIGITS), + 'MIN_FRACTION_DIGITS' => $c->getAttribute(\NumberFormatter::MIN_FRACTION_DIGITS), + 'FRACTION_DIGITS' => $c->getAttribute(\NumberFormatter::FRACTION_DIGITS), + 'MULTIPLIER' => $c->getAttribute(\NumberFormatter::MULTIPLIER), + 'GROUPING_SIZE' => $c->getAttribute(\NumberFormatter::GROUPING_SIZE), + 'ROUNDING_MODE' => $c->getAttribute(\NumberFormatter::ROUNDING_MODE), + 'ROUNDING_INCREMENT' => $c->getAttribute(\NumberFormatter::ROUNDING_INCREMENT), + 'FORMAT_WIDTH' => $c->getAttribute(\NumberFormatter::FORMAT_WIDTH), + 'PADDING_POSITION' => $c->getAttribute(\NumberFormatter::PADDING_POSITION), + 'SECONDARY_GROUPING_SIZE' => $c->getAttribute(\NumberFormatter::SECONDARY_GROUPING_SIZE), + 'SIGNIFICANT_DIGITS_USED' => $c->getAttribute(\NumberFormatter::SIGNIFICANT_DIGITS_USED), + 'MIN_SIGNIFICANT_DIGITS' => $c->getAttribute(\NumberFormatter::MIN_SIGNIFICANT_DIGITS), + 'MAX_SIGNIFICANT_DIGITS' => $c->getAttribute(\NumberFormatter::MAX_SIGNIFICANT_DIGITS), + 'LENIENT_PARSE' => $c->getAttribute(\NumberFormatter::LENIENT_PARSE), + ] + ), + Caster::PREFIX_VIRTUAL.'text_attributes' => new EnumStub( + [ + 'POSITIVE_PREFIX' => $c->getTextAttribute(\NumberFormatter::POSITIVE_PREFIX), + 'POSITIVE_SUFFIX' => $c->getTextAttribute(\NumberFormatter::POSITIVE_SUFFIX), + 'NEGATIVE_PREFIX' => $c->getTextAttribute(\NumberFormatter::NEGATIVE_PREFIX), + 'NEGATIVE_SUFFIX' => $c->getTextAttribute(\NumberFormatter::NEGATIVE_SUFFIX), + 'PADDING_CHARACTER' => $c->getTextAttribute(\NumberFormatter::PADDING_CHARACTER), + 'CURRENCY_CODE' => $c->getTextAttribute(\NumberFormatter::CURRENCY_CODE), + 'DEFAULT_RULESET' => $c->getTextAttribute(\NumberFormatter::DEFAULT_RULESET), + 'PUBLIC_RULESETS' => $c->getTextAttribute(\NumberFormatter::PUBLIC_RULESETS), + ] + ), + Caster::PREFIX_VIRTUAL.'symbols' => new EnumStub( + [ + 'DECIMAL_SEPARATOR_SYMBOL' => $c->getSymbol(\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL), + 'GROUPING_SEPARATOR_SYMBOL' => $c->getSymbol(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL), + 'PATTERN_SEPARATOR_SYMBOL' => $c->getSymbol(\NumberFormatter::PATTERN_SEPARATOR_SYMBOL), + 'PERCENT_SYMBOL' => $c->getSymbol(\NumberFormatter::PERCENT_SYMBOL), + 'ZERO_DIGIT_SYMBOL' => $c->getSymbol(\NumberFormatter::ZERO_DIGIT_SYMBOL), + 'DIGIT_SYMBOL' => $c->getSymbol(\NumberFormatter::DIGIT_SYMBOL), + 'MINUS_SIGN_SYMBOL' => $c->getSymbol(\NumberFormatter::MINUS_SIGN_SYMBOL), + 'PLUS_SIGN_SYMBOL' => $c->getSymbol(\NumberFormatter::PLUS_SIGN_SYMBOL), + 'CURRENCY_SYMBOL' => $c->getSymbol(\NumberFormatter::CURRENCY_SYMBOL), + 'INTL_CURRENCY_SYMBOL' => $c->getSymbol(\NumberFormatter::INTL_CURRENCY_SYMBOL), + 'MONETARY_SEPARATOR_SYMBOL' => $c->getSymbol(\NumberFormatter::MONETARY_SEPARATOR_SYMBOL), + 'EXPONENTIAL_SYMBOL' => $c->getSymbol(\NumberFormatter::EXPONENTIAL_SYMBOL), + 'PERMILL_SYMBOL' => $c->getSymbol(\NumberFormatter::PERMILL_SYMBOL), + 'PAD_ESCAPE_SYMBOL' => $c->getSymbol(\NumberFormatter::PAD_ESCAPE_SYMBOL), + 'INFINITY_SYMBOL' => $c->getSymbol(\NumberFormatter::INFINITY_SYMBOL), + 'NAN_SYMBOL' => $c->getSymbol(\NumberFormatter::NAN_SYMBOL), + 'SIGNIFICANT_DIGIT_SYMBOL' => $c->getSymbol(\NumberFormatter::SIGNIFICANT_DIGIT_SYMBOL), + 'MONETARY_GROUPING_SEPARATOR_SYMBOL' => $c->getSymbol(\NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL), + ] + ), + ]; + + return self::castError($c, $a); + } + + public static function castIntlTimeZone(\IntlTimeZone $c, array $a, Stub $stub, bool $isNested): array + { + $a += [ + Caster::PREFIX_VIRTUAL.'display_name' => $c->getDisplayName(), + Caster::PREFIX_VIRTUAL.'id' => $c->getID(), + Caster::PREFIX_VIRTUAL.'raw_offset' => $c->getRawOffset(), + ]; + + if ($c->useDaylightTime()) { + $a += [ + Caster::PREFIX_VIRTUAL.'dst_savings' => $c->getDSTSavings(), + ]; + } + + return self::castError($c, $a); + } + + public static function castIntlCalendar(\IntlCalendar $c, array $a, Stub $stub, bool $isNested, int $filter = 0): array + { + $a += [ + Caster::PREFIX_VIRTUAL.'type' => $c->getType(), + Caster::PREFIX_VIRTUAL.'first_day_of_week' => $c->getFirstDayOfWeek(), + Caster::PREFIX_VIRTUAL.'minimal_days_in_first_week' => $c->getMinimalDaysInFirstWeek(), + Caster::PREFIX_VIRTUAL.'repeated_wall_time_option' => $c->getRepeatedWallTimeOption(), + Caster::PREFIX_VIRTUAL.'skipped_wall_time_option' => $c->getSkippedWallTimeOption(), + Caster::PREFIX_VIRTUAL.'time' => $c->getTime(), + Caster::PREFIX_VIRTUAL.'in_daylight_time' => $c->inDaylightTime(), + Caster::PREFIX_VIRTUAL.'is_lenient' => $c->isLenient(), + Caster::PREFIX_VIRTUAL.'time_zone' => ($filter & Caster::EXCLUDE_VERBOSE) ? new CutStub($c->getTimeZone()) : $c->getTimeZone(), + ]; + + return self::castError($c, $a); + } + + public static function castIntlDateFormatter(\IntlDateFormatter $c, array $a, Stub $stub, bool $isNested, int $filter = 0): array + { + $a += [ + Caster::PREFIX_VIRTUAL.'locale' => $c->getLocale(), + Caster::PREFIX_VIRTUAL.'pattern' => $c->getPattern(), + Caster::PREFIX_VIRTUAL.'calendar' => $c->getCalendar(), + Caster::PREFIX_VIRTUAL.'time_zone_id' => $c->getTimeZoneId(), + Caster::PREFIX_VIRTUAL.'time_type' => $c->getTimeType(), + Caster::PREFIX_VIRTUAL.'date_type' => $c->getDateType(), + Caster::PREFIX_VIRTUAL.'calendar_object' => ($filter & Caster::EXCLUDE_VERBOSE) ? new CutStub($c->getCalendarObject()) : $c->getCalendarObject(), + Caster::PREFIX_VIRTUAL.'time_zone' => ($filter & Caster::EXCLUDE_VERBOSE) ? new CutStub($c->getTimeZone()) : $c->getTimeZone(), + ]; + + return self::castError($c, $a); + } + + private static function castError(object $c, array $a): array + { + if ($errorCode = $c->getErrorCode()) { + $a += [ + Caster::PREFIX_VIRTUAL.'error_code' => $errorCode, + Caster::PREFIX_VIRTUAL.'error_message' => $c->getErrorMessage(), + ]; + } + + return $a; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/LinkStub.php b/upLoadImage/vendor/symfony/var-dumper/Caster/LinkStub.php new file mode 100644 index 0000000..3acd4fd --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/LinkStub.php @@ -0,0 +1,105 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +/** + * Represents a file or a URL. + * + * @author Nicolas Grekas + */ +class LinkStub extends ConstStub +{ + public bool $inVendor = false; + + private static array $vendorRoots; + private static array $composerRoots = []; + + public function __construct(string $label, int $line = 0, ?string $href = null) + { + $this->value = $label; + + if (!\is_string($href ??= $label)) { + return; + } + if (str_starts_with($href, 'file://')) { + if ($href === $label) { + $label = substr($label, 7); + } + $href = substr($href, 7); + } elseif (str_contains($href, '://')) { + $this->attr['href'] = $href; + + return; + } + if (!is_file($href)) { + return; + } + if ($line) { + $this->attr['line'] = $line; + } + if ($label !== $this->attr['file'] = realpath($href) ?: $href) { + return; + } + if ($composerRoot = $this->getComposerRoot($href, $this->inVendor)) { + $this->attr['ellipsis'] = \strlen($href) - \strlen($composerRoot) + 1; + $this->attr['ellipsis-type'] = 'path'; + $this->attr['ellipsis-tail'] = 1 + ($this->inVendor ? 2 + \strlen(implode('', \array_slice(explode(\DIRECTORY_SEPARATOR, substr($href, 1 - $this->attr['ellipsis'])), 0, 2))) : 0); + } elseif (3 < \count($ellipsis = explode(\DIRECTORY_SEPARATOR, $href))) { + $this->attr['ellipsis'] = 2 + \strlen(implode('', \array_slice($ellipsis, -2))); + $this->attr['ellipsis-type'] = 'path'; + $this->attr['ellipsis-tail'] = 1; + } + } + + private function getComposerRoot(string $file, bool &$inVendor): string|false + { + if (!isset(self::$vendorRoots)) { + self::$vendorRoots = []; + + foreach (get_declared_classes() as $class) { + if ('C' === $class[0] && str_starts_with($class, 'ComposerAutoloaderInit')) { + $r = new \ReflectionClass($class); + $v = \dirname($r->getFileName(), 2); + if (is_file($v.'/composer/installed.json')) { + self::$vendorRoots[] = $v.\DIRECTORY_SEPARATOR; + } + } + } + } + $inVendor = false; + + if (isset(self::$composerRoots[$dir = \dirname($file)])) { + return self::$composerRoots[$dir]; + } + + foreach (self::$vendorRoots as $root) { + if ($inVendor = str_starts_with($file, $root)) { + return $root; + } + } + + $parent = $dir; + while (!@is_file($parent.'/composer.json')) { + if (!@file_exists($parent)) { + // open_basedir restriction in effect + break; + } + if ($parent === \dirname($parent)) { + return self::$composerRoots[$dir] = false; + } + + $parent = \dirname($parent); + } + + return self::$composerRoots[$dir] = $parent.\DIRECTORY_SEPARATOR; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/MemcachedCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/MemcachedCaster.php new file mode 100644 index 0000000..4e4f611 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/MemcachedCaster.php @@ -0,0 +1,83 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * @author Jan Schädlich + * + * @final + * + * @internal since Symfony 7.3 + */ +class MemcachedCaster +{ + private static array $optionConstants; + private static array $defaultOptions; + + public static function castMemcached(\Memcached $c, array $a, Stub $stub, bool $isNested): array + { + $a += [ + Caster::PREFIX_VIRTUAL.'servers' => $c->getServerList(), + Caster::PREFIX_VIRTUAL.'options' => new EnumStub( + self::getNonDefaultOptions($c) + ), + ]; + + return $a; + } + + private static function getNonDefaultOptions(\Memcached $c): array + { + self::$defaultOptions ??= self::discoverDefaultOptions(); + self::$optionConstants ??= self::getOptionConstants(); + + $nonDefaultOptions = []; + foreach (self::$optionConstants as $constantKey => $value) { + if (self::$defaultOptions[$constantKey] !== $option = $c->getOption($value)) { + $nonDefaultOptions[$constantKey] = $option; + } + } + + return $nonDefaultOptions; + } + + private static function discoverDefaultOptions(): array + { + $defaultMemcached = new \Memcached(); + $defaultMemcached->addServer('127.0.0.1', 11211); + + $defaultOptions = []; + self::$optionConstants ??= self::getOptionConstants(); + + foreach (self::$optionConstants as $constantKey => $value) { + $defaultOptions[$constantKey] = $defaultMemcached->getOption($value); + } + + return $defaultOptions; + } + + private static function getOptionConstants(): array + { + $reflectedMemcached = new \ReflectionClass(\Memcached::class); + + $optionConstants = []; + foreach ($reflectedMemcached->getConstants() as $constantKey => $value) { + if (str_starts_with($constantKey, 'OPT_')) { + $optionConstants[$constantKey] = $value; + } + } + + return $optionConstants; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/MysqliCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/MysqliCaster.php new file mode 100644 index 0000000..bfe6f08 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/MysqliCaster.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * @author Nicolas Grekas + * + * @internal + */ +final class MysqliCaster +{ + public static function castMysqliDriver(\mysqli_driver $c, array $a, Stub $stub, bool $isNested): array + { + foreach ($a as $k => $v) { + if (isset($c->$k)) { + $a[$k] = $c->$k; + } + } + + return $a; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/OpenSSLCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/OpenSSLCaster.php new file mode 100644 index 0000000..4c311ac --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/OpenSSLCaster.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * @author Nicolas Grekas + * @author Alexandre Daubois + * + * @internal + */ +final class OpenSSLCaster +{ + public static function castOpensslX509(\OpenSSLCertificate $h, array $a, Stub $stub, bool $isNested): array + { + $stub->cut = -1; + $info = openssl_x509_parse($h, false); + + $pin = openssl_pkey_get_public($h); + $pin = openssl_pkey_get_details($pin)['key']; + $pin = \array_slice(explode("\n", $pin), 1, -2); + $pin = base64_decode(implode('', $pin)); + $pin = base64_encode(hash('sha256', $pin, true)); + + $a += [ + Caster::PREFIX_VIRTUAL.'subject' => new EnumStub(array_intersect_key($info['subject'], ['organizationName' => true, 'commonName' => true])), + Caster::PREFIX_VIRTUAL.'issuer' => new EnumStub(array_intersect_key($info['issuer'], ['organizationName' => true, 'commonName' => true])), + Caster::PREFIX_VIRTUAL.'expiry' => new ConstStub(date(\DateTimeInterface::ISO8601, $info['validTo_time_t']), $info['validTo_time_t']), + Caster::PREFIX_VIRTUAL.'fingerprint' => new EnumStub([ + 'md5' => new ConstStub(wordwrap(strtoupper(openssl_x509_fingerprint($h, 'md5')), 2, ':', true)), + 'sha1' => new ConstStub(wordwrap(strtoupper(openssl_x509_fingerprint($h, 'sha1')), 2, ':', true)), + 'sha256' => new ConstStub(wordwrap(strtoupper(openssl_x509_fingerprint($h, 'sha256')), 2, ':', true)), + 'pin-sha256' => new ConstStub($pin), + ]), + ]; + + return $a; + } + + public static function castOpensslAsymmetricKey(\OpenSSLAsymmetricKey $key, array $a, Stub $stub, bool $isNested): array + { + foreach (openssl_pkey_get_details($key) as $k => $v) { + $a[Caster::PREFIX_VIRTUAL.$k] = $v; + } + + unset($a[Caster::PREFIX_VIRTUAL.'rsa']); // binary data + + return $a; + } + + public static function castOpensslCsr(\OpenSSLCertificateSigningRequest $csr, array $a, Stub $stub, bool $isNested): array + { + foreach (openssl_csr_get_subject($csr, false) as $k => $v) { + $a[Caster::PREFIX_VIRTUAL.$k] = $v; + } + + return $a; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/PdoCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/PdoCaster.php new file mode 100644 index 0000000..697e412 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/PdoCaster.php @@ -0,0 +1,124 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Casts PDO related classes to array representation. + * + * @author Nicolas Grekas + * + * @final + * + * @internal since Symfony 7.3 + */ +class PdoCaster +{ + private const PDO_ATTRIBUTES = [ + 'CASE' => [ + \PDO::CASE_LOWER => 'LOWER', + \PDO::CASE_NATURAL => 'NATURAL', + \PDO::CASE_UPPER => 'UPPER', + ], + 'ERRMODE' => [ + \PDO::ERRMODE_SILENT => 'SILENT', + \PDO::ERRMODE_WARNING => 'WARNING', + \PDO::ERRMODE_EXCEPTION => 'EXCEPTION', + ], + 'TIMEOUT', + 'PREFETCH', + 'AUTOCOMMIT', + 'PERSISTENT', + 'DRIVER_NAME', + 'SERVER_INFO', + 'ORACLE_NULLS' => [ + \PDO::NULL_NATURAL => 'NATURAL', + \PDO::NULL_EMPTY_STRING => 'EMPTY_STRING', + \PDO::NULL_TO_STRING => 'TO_STRING', + ], + 'CLIENT_VERSION', + 'SERVER_VERSION', + 'STATEMENT_CLASS', + 'EMULATE_PREPARES', + 'CONNECTION_STATUS', + 'STRINGIFY_FETCHES', + 'DEFAULT_FETCH_MODE' => [ + \PDO::FETCH_ASSOC => 'ASSOC', + \PDO::FETCH_BOTH => 'BOTH', + \PDO::FETCH_LAZY => 'LAZY', + \PDO::FETCH_NUM => 'NUM', + \PDO::FETCH_OBJ => 'OBJ', + ], + ]; + + public static function castPdo(\PDO $c, array $a, Stub $stub, bool $isNested): array + { + $attr = []; + $errmode = $c->getAttribute(\PDO::ATTR_ERRMODE); + $c->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); + + foreach (self::PDO_ATTRIBUTES as $k => $v) { + if (!isset($k[0])) { + $k = $v; + $v = []; + } + + try { + $attr[$k] = 'ERRMODE' === $k ? $errmode : $c->getAttribute(\constant('PDO::ATTR_'.$k)); + if ($v && isset($v[$attr[$k]])) { + $attr[$k] = new ConstStub($v[$attr[$k]], $attr[$k]); + } + } catch (\Exception) { + } + } + if (isset($attr[$k = 'STATEMENT_CLASS'][1])) { + if ($attr[$k][1]) { + $attr[$k][1] = new ArgsStub($attr[$k][1], '__construct', $attr[$k][0]); + } + $attr[$k][0] = new ClassStub($attr[$k][0]); + } + + $prefix = Caster::PREFIX_VIRTUAL; + $a += [ + $prefix.'inTransaction' => method_exists($c, 'inTransaction'), + $prefix.'errorInfo' => $c->errorInfo(), + $prefix.'attributes' => new EnumStub($attr), + ]; + + if ($a[$prefix.'inTransaction']) { + $a[$prefix.'inTransaction'] = $c->inTransaction(); + } else { + unset($a[$prefix.'inTransaction']); + } + + if (!isset($a[$prefix.'errorInfo'][1], $a[$prefix.'errorInfo'][2])) { + unset($a[$prefix.'errorInfo']); + } + + $c->setAttribute(\PDO::ATTR_ERRMODE, $errmode); + + return $a; + } + + public static function castPdoStatement(\PDOStatement $c, array $a, Stub $stub, bool $isNested): array + { + $prefix = Caster::PREFIX_VIRTUAL; + $a[$prefix.'errorInfo'] = $c->errorInfo(); + + if (!isset($a[$prefix.'errorInfo'][1], $a[$prefix.'errorInfo'][2])) { + unset($a[$prefix.'errorInfo']); + } + + return $a; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/PgSqlCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/PgSqlCaster.php new file mode 100644 index 0000000..3d6cb7d --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/PgSqlCaster.php @@ -0,0 +1,158 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Casts pgsql resources to array representation. + * + * @author Nicolas Grekas + * + * @final + * + * @internal since Symfony 7.3 + */ +class PgSqlCaster +{ + private const PARAM_CODES = [ + 'server_encoding', + 'client_encoding', + 'is_superuser', + 'session_authorization', + 'DateStyle', + 'TimeZone', + 'IntervalStyle', + 'integer_datetimes', + 'application_name', + 'standard_conforming_strings', + ]; + + private const TRANSACTION_STATUS = [ + \PGSQL_TRANSACTION_IDLE => 'PGSQL_TRANSACTION_IDLE', + \PGSQL_TRANSACTION_ACTIVE => 'PGSQL_TRANSACTION_ACTIVE', + \PGSQL_TRANSACTION_INTRANS => 'PGSQL_TRANSACTION_INTRANS', + \PGSQL_TRANSACTION_INERROR => 'PGSQL_TRANSACTION_INERROR', + \PGSQL_TRANSACTION_UNKNOWN => 'PGSQL_TRANSACTION_UNKNOWN', + ]; + + private const RESULT_STATUS = [ + \PGSQL_EMPTY_QUERY => 'PGSQL_EMPTY_QUERY', + \PGSQL_COMMAND_OK => 'PGSQL_COMMAND_OK', + \PGSQL_TUPLES_OK => 'PGSQL_TUPLES_OK', + \PGSQL_COPY_OUT => 'PGSQL_COPY_OUT', + \PGSQL_COPY_IN => 'PGSQL_COPY_IN', + \PGSQL_BAD_RESPONSE => 'PGSQL_BAD_RESPONSE', + \PGSQL_NONFATAL_ERROR => 'PGSQL_NONFATAL_ERROR', + \PGSQL_FATAL_ERROR => 'PGSQL_FATAL_ERROR', + ]; + + private const DIAG_CODES = [ + 'severity' => \PGSQL_DIAG_SEVERITY, + 'sqlstate' => \PGSQL_DIAG_SQLSTATE, + 'message' => \PGSQL_DIAG_MESSAGE_PRIMARY, + 'detail' => \PGSQL_DIAG_MESSAGE_DETAIL, + 'hint' => \PGSQL_DIAG_MESSAGE_HINT, + 'statement position' => \PGSQL_DIAG_STATEMENT_POSITION, + 'internal position' => \PGSQL_DIAG_INTERNAL_POSITION, + 'internal query' => \PGSQL_DIAG_INTERNAL_QUERY, + 'context' => \PGSQL_DIAG_CONTEXT, + 'file' => \PGSQL_DIAG_SOURCE_FILE, + 'line' => \PGSQL_DIAG_SOURCE_LINE, + 'function' => \PGSQL_DIAG_SOURCE_FUNCTION, + ]; + + public static function castLargeObject($lo, array $a, Stub $stub, bool $isNested): array + { + $a['seek position'] = pg_lo_tell($lo); + + return $a; + } + + public static function castLink($link, array $a, Stub $stub, bool $isNested): array + { + $a['status'] = pg_connection_status($link); + $a['status'] = new ConstStub(\PGSQL_CONNECTION_OK === $a['status'] ? 'PGSQL_CONNECTION_OK' : 'PGSQL_CONNECTION_BAD', $a['status']); + $a['busy'] = pg_connection_busy($link); + + $a['transaction'] = pg_transaction_status($link); + if (isset(self::TRANSACTION_STATUS[$a['transaction']])) { + $a['transaction'] = new ConstStub(self::TRANSACTION_STATUS[$a['transaction']], $a['transaction']); + } + + $a['pid'] = pg_get_pid($link); + $a['last error'] = pg_last_error($link); + $a['last notice'] = pg_last_notice($link); + $a['host'] = pg_host($link); + $a['port'] = pg_port($link); + $a['dbname'] = pg_dbname($link); + $a['options'] = pg_options($link); + $a['version'] = pg_version($link); + + foreach (self::PARAM_CODES as $v) { + if (false !== $s = pg_parameter_status($link, $v)) { + $a['param'][$v] = $s; + } + } + + $a['param']['client_encoding'] = pg_client_encoding($link); + $a['param'] = new EnumStub($a['param']); + + return $a; + } + + public static function castResult($result, array $a, Stub $stub, bool $isNested): array + { + $a['num rows'] = pg_num_rows($result); + $a['status'] = pg_result_status($result); + if (isset(self::RESULT_STATUS[$a['status']])) { + $a['status'] = new ConstStub(self::RESULT_STATUS[$a['status']], $a['status']); + } + $a['command-completion tag'] = pg_result_status($result, \PGSQL_STATUS_STRING); + + if (-1 === $a['num rows']) { + foreach (self::DIAG_CODES as $k => $v) { + $a['error'][$k] = pg_result_error_field($result, $v); + } + } + + $a['affected rows'] = pg_affected_rows($result); + $a['last OID'] = pg_last_oid($result); + + $fields = pg_num_fields($result); + + for ($i = 0; $i < $fields; ++$i) { + $field = [ + 'name' => pg_field_name($result, $i), + 'table' => \sprintf('%s (OID: %s)', pg_field_table($result, $i), pg_field_table($result, $i, true)), + 'type' => \sprintf('%s (OID: %s)', pg_field_type($result, $i), pg_field_type_oid($result, $i)), + 'nullable' => (bool) (\PHP_VERSION_ID >= 80300 ? pg_field_is_null($result, null, $i) : pg_field_is_null($result, $i)), + 'storage' => pg_field_size($result, $i).' bytes', + 'display' => (\PHP_VERSION_ID >= 80300 ? pg_field_prtlen($result, null, $i) : pg_field_prtlen($result, $i)).' chars', + ]; + if (' (OID: )' === $field['table']) { + $field['table'] = null; + } + if ('-1 bytes' === $field['storage']) { + $field['storage'] = 'variable size'; + } elseif ('1 bytes' === $field['storage']) { + $field['storage'] = '1 byte'; + } + if ('1 chars' === $field['display']) { + $field['display'] = '1 char'; + } + $a['fields'][] = new EnumStub($field); + } + + return $a; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/ProxyManagerCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/ProxyManagerCaster.php new file mode 100644 index 0000000..0d954f4 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/ProxyManagerCaster.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use ProxyManager\Proxy\ProxyInterface; +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * @author Nicolas Grekas + * + * @final + * + * @internal since Symfony 7.3 + */ +class ProxyManagerCaster +{ + public static function castProxy(ProxyInterface $c, array $a, Stub $stub, bool $isNested): array + { + if ($parent = get_parent_class($c)) { + $stub->class .= ' - '.$parent; + } + $stub->class .= '@proxy'; + + return $a; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/RdKafkaCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/RdKafkaCaster.php new file mode 100644 index 0000000..bfadef2 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/RdKafkaCaster.php @@ -0,0 +1,188 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use RdKafka\Conf; +use RdKafka\Exception as RdKafkaException; +use RdKafka\KafkaConsumer; +use RdKafka\Message; +use RdKafka\Metadata\Broker as BrokerMetadata; +use RdKafka\Metadata\Collection as CollectionMetadata; +use RdKafka\Metadata\Partition as PartitionMetadata; +use RdKafka\Metadata\Topic as TopicMetadata; +use RdKafka\Topic; +use RdKafka\TopicConf; +use RdKafka\TopicPartition; +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Casts RdKafka related classes to array representation. + * + * @author Romain Neutron + * + * @internal since Symfony 7.3 + */ +class RdKafkaCaster +{ + public static function castKafkaConsumer(KafkaConsumer $c, array $a, Stub $stub, bool $isNested): array + { + $prefix = Caster::PREFIX_VIRTUAL; + + try { + $assignment = $c->getAssignment(); + } catch (RdKafkaException) { + $assignment = []; + } + + $a += [ + $prefix.'subscription' => $c->getSubscription(), + $prefix.'assignment' => $assignment, + ]; + + $a += self::extractMetadata($c); + + return $a; + } + + public static function castTopic(Topic $c, array $a, Stub $stub, bool $isNested): array + { + $prefix = Caster::PREFIX_VIRTUAL; + + $a += [ + $prefix.'name' => $c->getName(), + ]; + + return $a; + } + + public static function castTopicPartition(TopicPartition $c, array $a): array + { + $prefix = Caster::PREFIX_VIRTUAL; + + $a += [ + $prefix.'offset' => $c->getOffset(), + $prefix.'partition' => $c->getPartition(), + $prefix.'topic' => $c->getTopic(), + ]; + + return $a; + } + + public static function castMessage(Message $c, array $a, Stub $stub, bool $isNested): array + { + $prefix = Caster::PREFIX_VIRTUAL; + + $a += [ + $prefix.'errstr' => $c->errstr(), + ]; + + return $a; + } + + public static function castConf(Conf $c, array $a, Stub $stub, bool $isNested): array + { + $prefix = Caster::PREFIX_VIRTUAL; + + foreach ($c->dump() as $key => $value) { + $a[$prefix.$key] = $value; + } + + return $a; + } + + public static function castTopicConf(TopicConf $c, array $a, Stub $stub, bool $isNested): array + { + $prefix = Caster::PREFIX_VIRTUAL; + + foreach ($c->dump() as $key => $value) { + $a[$prefix.$key] = $value; + } + + return $a; + } + + public static function castRdKafka(\RdKafka $c, array $a, Stub $stub, bool $isNested): array + { + $prefix = Caster::PREFIX_VIRTUAL; + + $a += [ + $prefix.'out_q_len' => $c->getOutQLen(), + ]; + + $a += self::extractMetadata($c); + + return $a; + } + + public static function castCollectionMetadata(CollectionMetadata $c, array $a, Stub $stub, bool $isNested): array + { + $a += iterator_to_array($c); + + return $a; + } + + public static function castTopicMetadata(TopicMetadata $c, array $a, Stub $stub, bool $isNested): array + { + $prefix = Caster::PREFIX_VIRTUAL; + + $a += [ + $prefix.'name' => $c->getTopic(), + $prefix.'partitions' => $c->getPartitions(), + ]; + + return $a; + } + + public static function castPartitionMetadata(PartitionMetadata $c, array $a, Stub $stub, bool $isNested): array + { + $prefix = Caster::PREFIX_VIRTUAL; + + $a += [ + $prefix.'id' => $c->getId(), + $prefix.'err' => $c->getErr(), + $prefix.'leader' => $c->getLeader(), + ]; + + return $a; + } + + public static function castBrokerMetadata(BrokerMetadata $c, array $a, Stub $stub, bool $isNested): array + { + $prefix = Caster::PREFIX_VIRTUAL; + + $a += [ + $prefix.'id' => $c->getId(), + $prefix.'host' => $c->getHost(), + $prefix.'port' => $c->getPort(), + ]; + + return $a; + } + + private static function extractMetadata(KafkaConsumer|\RdKafka $c): array + { + $prefix = Caster::PREFIX_VIRTUAL; + + try { + $m = $c->getMetadata(true, null, 500); + } catch (RdKafkaException) { + return []; + } + + return [ + $prefix.'orig_broker_id' => $m->getOrigBrokerId(), + $prefix.'orig_broker_name' => $m->getOrigBrokerName(), + $prefix.'brokers' => $m->getBrokers(), + $prefix.'topics' => $m->getTopics(), + ]; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/RedisCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/RedisCaster.php new file mode 100644 index 0000000..a1ed95d --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/RedisCaster.php @@ -0,0 +1,152 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Relay\Relay; +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Casts Redis class from ext-redis to array representation. + * + * @author Nicolas Grekas + * + * @final + * + * @internal since Symfony 7.3 + */ +class RedisCaster +{ + private const SERIALIZERS = [ + 0 => 'NONE', // Redis::SERIALIZER_NONE + 1 => 'PHP', // Redis::SERIALIZER_PHP + 2 => 'IGBINARY', // Optional Redis::SERIALIZER_IGBINARY + ]; + + private const MODES = [ + 0 => 'ATOMIC', // Redis::ATOMIC + 1 => 'MULTI', // Redis::MULTI + 2 => 'PIPELINE', // Redis::PIPELINE + ]; + + private const COMPRESSION_MODES = [ + 0 => 'NONE', // Redis::COMPRESSION_NONE + 1 => 'LZF', // Redis::COMPRESSION_LZF + ]; + + private const FAILOVER_OPTIONS = [ + \RedisCluster::FAILOVER_NONE => 'NONE', + \RedisCluster::FAILOVER_ERROR => 'ERROR', + \RedisCluster::FAILOVER_DISTRIBUTE => 'DISTRIBUTE', + \RedisCluster::FAILOVER_DISTRIBUTE_SLAVES => 'DISTRIBUTE_SLAVES', + ]; + + public static function castRedis(\Redis|Relay $c, array $a, Stub $stub, bool $isNested): array + { + $prefix = Caster::PREFIX_VIRTUAL; + + if (!$connected = $c->isConnected()) { + return $a + [ + $prefix.'isConnected' => $connected, + ]; + } + + $mode = $c->getMode(); + + return $a + [ + $prefix.'isConnected' => $connected, + $prefix.'host' => $c->getHost(), + $prefix.'port' => $c->getPort(), + $prefix.'auth' => $c->getAuth(), + $prefix.'mode' => isset(self::MODES[$mode]) ? new ConstStub(self::MODES[$mode], $mode) : $mode, + $prefix.'dbNum' => $c->getDbNum(), + $prefix.'timeout' => $c->getTimeout(), + $prefix.'lastError' => $c->getLastError(), + $prefix.'persistentId' => $c->getPersistentID(), + $prefix.'options' => self::getRedisOptions($c), + ]; + } + + public static function castRedisArray(\RedisArray $c, array $a, Stub $stub, bool $isNested): array + { + $prefix = Caster::PREFIX_VIRTUAL; + + return $a + [ + $prefix.'hosts' => $c->_hosts(), + $prefix.'function' => ClassStub::wrapCallable($c->_function()), + $prefix.'lastError' => $c->getLastError(), + $prefix.'options' => self::getRedisOptions($c), + ]; + } + + public static function castRedisCluster(\RedisCluster $c, array $a, Stub $stub, bool $isNested): array + { + $prefix = Caster::PREFIX_VIRTUAL; + $failover = $c->getOption(\RedisCluster::OPT_SLAVE_FAILOVER); + + $a += [ + $prefix.'_masters' => $c->_masters(), + $prefix.'_redir' => $c->_redir(), + $prefix.'mode' => new ConstStub($c->getMode() ? 'MULTI' : 'ATOMIC', $c->getMode()), + $prefix.'lastError' => $c->getLastError(), + $prefix.'options' => self::getRedisOptions($c, [ + 'SLAVE_FAILOVER' => isset(self::FAILOVER_OPTIONS[$failover]) ? new ConstStub(self::FAILOVER_OPTIONS[$failover], $failover) : $failover, + ]), + ]; + + return $a; + } + + private static function getRedisOptions(\Redis|Relay|\RedisArray|\RedisCluster $redis, array $options = []): EnumStub + { + $serializer = $redis->getOption(\defined('Redis::OPT_SERIALIZER') ? \Redis::OPT_SERIALIZER : 1); + if (\is_array($serializer)) { + foreach ($serializer as &$v) { + if (isset(self::SERIALIZERS[$v])) { + $v = new ConstStub(self::SERIALIZERS[$v], $v); + } + } + } elseif (isset(self::SERIALIZERS[$serializer])) { + $serializer = new ConstStub(self::SERIALIZERS[$serializer], $serializer); + } + + $compression = \defined('Redis::OPT_COMPRESSION') ? $redis->getOption(\Redis::OPT_COMPRESSION) : 0; + if (\is_array($compression)) { + foreach ($compression as &$v) { + if (isset(self::COMPRESSION_MODES[$v])) { + $v = new ConstStub(self::COMPRESSION_MODES[$v], $v); + } + } + } elseif (isset(self::COMPRESSION_MODES[$compression])) { + $compression = new ConstStub(self::COMPRESSION_MODES[$compression], $compression); + } + + $retry = \defined('Redis::OPT_SCAN') ? $redis->getOption(\Redis::OPT_SCAN) : 0; + if (\is_array($retry)) { + foreach ($retry as &$v) { + $v = new ConstStub($v ? 'RETRY' : 'NORETRY', $v); + } + } else { + $retry = new ConstStub($retry ? 'RETRY' : 'NORETRY', $retry); + } + + $options += [ + 'TCP_KEEPALIVE' => \defined('Redis::OPT_TCP_KEEPALIVE') ? $redis->getOption(\Redis::OPT_TCP_KEEPALIVE) : Relay::OPT_TCP_KEEPALIVE, + 'READ_TIMEOUT' => $redis->getOption(\defined('Redis::OPT_READ_TIMEOUT') ? \Redis::OPT_READ_TIMEOUT : Relay::OPT_READ_TIMEOUT), + 'COMPRESSION' => $compression, + 'SERIALIZER' => $serializer, + 'PREFIX' => $redis->getOption(\defined('Redis::OPT_PREFIX') ? \Redis::OPT_PREFIX : Relay::OPT_PREFIX), + 'SCAN' => $retry, + ]; + + return new EnumStub($options); + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/ReflectionCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/ReflectionCaster.php new file mode 100644 index 0000000..e7310f4 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/ReflectionCaster.php @@ -0,0 +1,448 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Casts Reflector related classes to array representation. + * + * @author Nicolas Grekas + * + * @final + * + * @internal since Symfony 7.3 + */ +class ReflectionCaster +{ + public const UNSET_CLOSURE_FILE_INFO = ['Closure' => __CLASS__.'::unsetClosureFileInfo']; + + private const EXTRA_MAP = [ + 'docComment' => 'getDocComment', + 'extension' => 'getExtensionName', + 'isDisabled' => 'isDisabled', + 'isDeprecated' => 'isDeprecated', + 'isInternal' => 'isInternal', + 'isUserDefined' => 'isUserDefined', + 'isGenerator' => 'isGenerator', + 'isVariadic' => 'isVariadic', + ]; + + public static function castClosure(\Closure $c, array $a, Stub $stub, bool $isNested, int $filter = 0): array + { + $prefix = Caster::PREFIX_VIRTUAL; + $c = new \ReflectionFunction($c); + + $a = static::castFunctionAbstract($c, $a, $stub, $isNested, $filter); + + if (!$c->isAnonymous()) { + $stub->class = isset($a[$prefix.'class']) ? $a[$prefix.'class']->value.'::'.$c->name : $c->name; + unset($a[$prefix.'class']); + } + unset($a[$prefix.'extra']); + + $stub->class .= self::getSignature($a); + + if ($f = $c->getFileName()) { + $stub->attr['file'] = $f; + $stub->attr['line'] = $c->getStartLine(); + } + + unset($a[$prefix.'parameters']); + + if ($filter & Caster::EXCLUDE_VERBOSE) { + $stub->cut += ($c->getFileName() ? 2 : 0) + \count($a); + + return []; + } + + if ($f) { + $a[$prefix.'file'] = new LinkStub($f, $c->getStartLine()); + $a[$prefix.'line'] = $c->getStartLine().' to '.$c->getEndLine(); + } + + return $a; + } + + public static function unsetClosureFileInfo(\Closure $c, array $a): array + { + unset($a[Caster::PREFIX_VIRTUAL.'file'], $a[Caster::PREFIX_VIRTUAL.'line']); + + return $a; + } + + public static function castGenerator(\Generator $c, array $a, Stub $stub, bool $isNested): array + { + // Cannot create ReflectionGenerator based on a terminated Generator + try { + $reflectionGenerator = new \ReflectionGenerator($c); + + return self::castReflectionGenerator($reflectionGenerator, $a, $stub, $isNested); + } catch (\Exception) { + $a[Caster::PREFIX_VIRTUAL.'closed'] = true; + + return $a; + } + } + + public static function castType(\ReflectionType $c, array $a, Stub $stub, bool $isNested): array + { + $prefix = Caster::PREFIX_VIRTUAL; + + if ($c instanceof \ReflectionNamedType) { + $a += [ + $prefix.'name' => $c->getName(), + $prefix.'allowsNull' => $c->allowsNull(), + $prefix.'isBuiltin' => $c->isBuiltin(), + ]; + } elseif ($c instanceof \ReflectionUnionType || $c instanceof \ReflectionIntersectionType) { + $a[$prefix.'allowsNull'] = $c->allowsNull(); + self::addMap($a, $c, [ + 'types' => 'getTypes', + ]); + } else { + $a[$prefix.'allowsNull'] = $c->allowsNull(); + } + + return $a; + } + + public static function castAttribute(\ReflectionAttribute $c, array $a, Stub $stub, bool $isNested): array + { + $map = [ + 'name' => 'getName', + 'arguments' => 'getArguments', + ]; + + if (\PHP_VERSION_ID >= 80400) { + unset($map['name']); + } + + self::addMap($a, $c, $map); + + return $a; + } + + public static function castReflectionGenerator(\ReflectionGenerator $c, array $a, Stub $stub, bool $isNested): array + { + $prefix = Caster::PREFIX_VIRTUAL; + + if ($c->getThis()) { + $a[$prefix.'this'] = new CutStub($c->getThis()); + } + $function = $c->getFunction(); + $frame = [ + 'class' => $function->class ?? null, + 'type' => isset($function->class) ? ($function->isStatic() ? '::' : '->') : null, + 'function' => $function->name, + 'file' => $c->getExecutingFile(), + 'line' => $c->getExecutingLine(), + ]; + if ($trace = $c->getTrace(\DEBUG_BACKTRACE_IGNORE_ARGS)) { + $function = new \ReflectionGenerator($c->getExecutingGenerator()); + array_unshift($trace, [ + 'function' => 'yield', + 'file' => $function->getExecutingFile(), + 'line' => $function->getExecutingLine(), + ]); + $trace[] = $frame; + $a[$prefix.'trace'] = new TraceStub($trace, false, 0, -1, -1); + } else { + $function = new FrameStub($frame, false, true); + $function = ExceptionCaster::castFrameStub($function, [], $function, true); + $a[$prefix.'executing'] = $function[$prefix.'src']; + } + + $a[Caster::PREFIX_VIRTUAL.'closed'] = false; + + return $a; + } + + public static function castClass(\ReflectionClass $c, array $a, Stub $stub, bool $isNested, int $filter = 0): array + { + $prefix = Caster::PREFIX_VIRTUAL; + + if ($n = \Reflection::getModifierNames($c->getModifiers())) { + $a[$prefix.'modifiers'] = implode(' ', $n); + } + + self::addMap($a, $c, [ + 'extends' => 'getParentClass', + 'implements' => 'getInterfaceNames', + 'constants' => 'getReflectionConstants', + ]); + + foreach ($c->getProperties() as $n) { + $a[$prefix.'properties'][$n->name] = $n; + } + + foreach ($c->getMethods() as $n) { + $a[$prefix.'methods'][$n->name] = $n; + } + + self::addAttributes($a, $c, $prefix); + + if (!($filter & Caster::EXCLUDE_VERBOSE) && !$isNested) { + self::addExtra($a, $c); + } + + return $a; + } + + public static function castFunctionAbstract(\ReflectionFunctionAbstract $c, array $a, Stub $stub, bool $isNested, int $filter = 0): array + { + $prefix = Caster::PREFIX_VIRTUAL; + + self::addMap($a, $c, [ + 'returnsReference' => 'returnsReference', + 'returnType' => 'getReturnType', + 'class' => 'getClosureCalledClass', + 'this' => 'getClosureThis', + ]); + + if (isset($a[$prefix.'returnType'])) { + $v = $a[$prefix.'returnType']; + $v = $v instanceof \ReflectionNamedType ? $v->getName() : (string) $v; + $a[$prefix.'returnType'] = new ClassStub($a[$prefix.'returnType'] instanceof \ReflectionNamedType && $a[$prefix.'returnType']->allowsNull() && !\in_array($v, ['mixed', 'null'], true) ? '?'.$v : $v, [class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', '']); + } + if (isset($a[$prefix.'class'])) { + $a[$prefix.'class'] = new ClassStub($a[$prefix.'class']); + } + if (isset($a[$prefix.'this'])) { + $a[$prefix.'this'] = new CutStub($a[$prefix.'this']); + } + + foreach ($c->getParameters() as $v) { + $k = '$'.$v->name; + if ($v->isVariadic()) { + $k = '...'.$k; + } + if ($v->isPassedByReference()) { + $k = '&'.$k; + } + $a[$prefix.'parameters'][$k] = $v; + } + if (isset($a[$prefix.'parameters'])) { + $a[$prefix.'parameters'] = new EnumStub($a[$prefix.'parameters']); + } + + self::addAttributes($a, $c, $prefix); + + if (!($filter & Caster::EXCLUDE_VERBOSE) && $v = $c->getStaticVariables()) { + foreach ($v as $k => &$v) { + if (\is_object($v)) { + $a[$prefix.'use']['$'.$k] = new CutStub($v); + } else { + $a[$prefix.'use']['$'.$k] = &$v; + } + } + unset($v); + $a[$prefix.'use'] = new EnumStub($a[$prefix.'use']); + } + + if (!($filter & Caster::EXCLUDE_VERBOSE) && !$isNested) { + self::addExtra($a, $c); + } + + return $a; + } + + public static function castClassConstant(\ReflectionClassConstant $c, array $a, Stub $stub, bool $isNested): array + { + $a[Caster::PREFIX_VIRTUAL.'modifiers'] = implode(' ', \Reflection::getModifierNames($c->getModifiers())); + $a[Caster::PREFIX_VIRTUAL.'value'] = $c->getValue(); + + self::addAttributes($a, $c); + + return $a; + } + + public static function castMethod(\ReflectionMethod $c, array $a, Stub $stub, bool $isNested): array + { + $a[Caster::PREFIX_VIRTUAL.'modifiers'] = implode(' ', \Reflection::getModifierNames($c->getModifiers())); + + return $a; + } + + public static function castParameter(\ReflectionParameter $c, array $a, Stub $stub, bool $isNested): array + { + $prefix = Caster::PREFIX_VIRTUAL; + + self::addMap($a, $c, [ + 'position' => 'getPosition', + 'isVariadic' => 'isVariadic', + 'byReference' => 'isPassedByReference', + 'allowsNull' => 'allowsNull', + ]); + + self::addAttributes($a, $c, $prefix); + + if ($v = $c->getType()) { + $a[$prefix.'typeHint'] = $v instanceof \ReflectionNamedType ? $v->getName() : (string) $v; + } + + if (isset($a[$prefix.'typeHint'])) { + $v = $a[$prefix.'typeHint']; + $a[$prefix.'typeHint'] = new ClassStub($v, [class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', '']); + } else { + unset($a[$prefix.'allowsNull']); + } + + if ($c->isOptional()) { + try { + $a[$prefix.'default'] = $v = $c->getDefaultValue(); + if ($c->isDefaultValueConstant() && !\is_object($v)) { + $a[$prefix.'default'] = new ConstStub($c->getDefaultValueConstantName(), $v); + } + if (null === $v) { + unset($a[$prefix.'allowsNull']); + } + } catch (\ReflectionException) { + } + } + + return $a; + } + + public static function castProperty(\ReflectionProperty $c, array $a, Stub $stub, bool $isNested): array + { + $a[Caster::PREFIX_VIRTUAL.'modifiers'] = implode(' ', \Reflection::getModifierNames($c->getModifiers())); + + self::addAttributes($a, $c); + self::addExtra($a, $c); + + return $a; + } + + public static function castReference(\ReflectionReference $c, array $a, Stub $stub, bool $isNested): array + { + $a[Caster::PREFIX_VIRTUAL.'id'] = $c->getId(); + + return $a; + } + + public static function castExtension(\ReflectionExtension $c, array $a, Stub $stub, bool $isNested): array + { + self::addMap($a, $c, [ + 'version' => 'getVersion', + 'dependencies' => 'getDependencies', + 'iniEntries' => 'getIniEntries', + 'isPersistent' => 'isPersistent', + 'isTemporary' => 'isTemporary', + 'constants' => 'getConstants', + 'functions' => 'getFunctions', + 'classes' => 'getClasses', + ]); + + return $a; + } + + public static function castZendExtension(\ReflectionZendExtension $c, array $a, Stub $stub, bool $isNested): array + { + self::addMap($a, $c, [ + 'version' => 'getVersion', + 'author' => 'getAuthor', + 'copyright' => 'getCopyright', + 'url' => 'getURL', + ]); + + return $a; + } + + public static function getSignature(array $a): string + { + $prefix = Caster::PREFIX_VIRTUAL; + $signature = ''; + + if (isset($a[$prefix.'parameters'])) { + foreach ($a[$prefix.'parameters']->value as $k => $param) { + $signature .= ', '; + if ($type = $param->getType()) { + if (!$type instanceof \ReflectionNamedType) { + $signature .= $type.' '; + } else { + if ($param->allowsNull() && !\in_array($type->getName(), ['mixed', 'null'], true)) { + $signature .= '?'; + } + $signature .= substr(strrchr('\\'.$type->getName(), '\\'), 1).' '; + } + } + $signature .= $k; + + if (!$param->isDefaultValueAvailable()) { + continue; + } + $v = $param->getDefaultValue(); + $signature .= ' = '; + + if ($param->isDefaultValueConstant()) { + $signature .= substr(strrchr('\\'.$param->getDefaultValueConstantName(), '\\'), 1); + } elseif (null === $v) { + $signature .= 'null'; + } elseif (\is_array($v)) { + $signature .= $v ? '[…'.\count($v).']' : '[]'; + } elseif (\is_string($v)) { + $signature .= 10 > \strlen($v) && !str_contains($v, '\\') ? "'{$v}'" : "'…".\strlen($v)."'"; + } elseif (\is_bool($v)) { + $signature .= $v ? 'true' : 'false'; + } elseif (\is_object($v)) { + $signature .= 'new '.substr(strrchr('\\'.get_debug_type($v), '\\'), 1); + } else { + $signature .= $v; + } + } + } + $signature = (empty($a[$prefix.'returnsReference']) ? '' : '&').'('.substr($signature, 2).')'; + + if (isset($a[$prefix.'returnType'])) { + $signature .= ': '.substr(strrchr('\\'.$a[$prefix.'returnType'], '\\'), 1); + } + + return $signature; + } + + private static function addExtra(array &$a, \Reflector $c): void + { + $x = isset($a[Caster::PREFIX_VIRTUAL.'extra']) ? $a[Caster::PREFIX_VIRTUAL.'extra']->value : []; + + if (method_exists($c, 'getFileName') && $m = $c->getFileName()) { + $x['file'] = new LinkStub($m, $c->getStartLine()); + $x['line'] = $c->getStartLine().' to '.$c->getEndLine(); + } + + self::addMap($x, $c, self::EXTRA_MAP, ''); + + if ($x) { + $a[Caster::PREFIX_VIRTUAL.'extra'] = new EnumStub($x); + } + } + + private static function addMap(array &$a, object $c, array $map, string $prefix = Caster::PREFIX_VIRTUAL): void + { + foreach ($map as $k => $m) { + if ('isDisabled' === $k) { + continue; + } + + if (method_exists($c, $m) && false !== ($m = $c->$m()) && null !== $m) { + $a[$prefix.$k] = $m instanceof \Reflector ? $m->name : $m; + } + } + } + + private static function addAttributes(array &$a, \Reflector $c, string $prefix = Caster::PREFIX_VIRTUAL): void + { + foreach ($c->getAttributes() as $n) { + $a[$prefix.'attributes'][] = $n; + } + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/ResourceCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/ResourceCaster.php new file mode 100644 index 0000000..47c2efc --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/ResourceCaster.php @@ -0,0 +1,92 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Casts common resource types to array representation. + * + * @author Nicolas Grekas + * + * @final + * + * @internal since Symfony 7.3 + */ +class ResourceCaster +{ + /** + * @deprecated since Symfony 7.3 + */ + public static function castCurl(\CurlHandle $h, array $a, Stub $stub, bool $isNested): array + { + trigger_deprecation('symfony/var-dumper', '7.3', 'The "%s()" method is deprecated without replacement.', __METHOD__); + + return CurlCaster::castCurl($h, $a, $stub, $isNested); + } + + /** + * @param resource|\Dba\Connection $dba + */ + public static function castDba(mixed $dba, array $a, Stub $stub, bool $isNested): array + { + if (\PHP_VERSION_ID < 80402 && !\is_resource($dba)) { + // @see https://github.com/php/php-src/issues/16990 + return $a; + } + + $list = dba_list(); + $a['file'] = $list[(int) $dba]; + + return $a; + } + + public static function castProcess($process, array $a, Stub $stub, bool $isNested): array + { + return proc_get_status($process); + } + + public static function castStream($stream, array $a, Stub $stub, bool $isNested): array + { + $a = stream_get_meta_data($stream) + static::castStreamContext($stream, $a, $stub, $isNested); + if ($a['uri'] ?? false) { + $a['uri'] = new LinkStub($a['uri']); + } + + return $a; + } + + public static function castStreamContext($stream, array $a, Stub $stub, bool $isNested): array + { + return @stream_context_get_params($stream) ?: $a; + } + + /** + * @deprecated since Symfony 7.3 + */ + public static function castGd(\GdImage $gd, array $a, Stub $stub, bool $isNested): array + { + trigger_deprecation('symfony/var-dumper', '7.3', 'The "%s()" method is deprecated without replacement.', __METHOD__); + + return GdCaster::castGd($gd, $a, $stub, $isNested); + } + + /** + * @deprecated since Symfony 7.3 + */ + public static function castOpensslX509(\OpenSSLCertificate $h, array $a, Stub $stub, bool $isNested): array + { + trigger_deprecation('symfony/var-dumper', '7.3', 'The "%s()" method is deprecated without replacement.', __METHOD__); + + return OpenSSLCaster::castOpensslX509($h, $a, $stub, $isNested); + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/ScalarStub.php b/upLoadImage/vendor/symfony/var-dumper/Caster/ScalarStub.php new file mode 100644 index 0000000..3bb1935 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/ScalarStub.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Represents any arbitrary value. + * + * @author Alexandre Daubois + */ +class ScalarStub extends Stub +{ + public function __construct(mixed $value) + { + $this->value = $value; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/SocketCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/SocketCaster.php new file mode 100644 index 0000000..6b95cd1 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/SocketCaster.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * @author Nicolas Grekas + * @author Alexandre Daubois + * + * @internal + */ +final class SocketCaster +{ + public static function castSocket(\Socket $socket, array $a, Stub $stub, bool $isNested): array + { + socket_getsockname($socket, $addr, $port); + $info = stream_get_meta_data(socket_export_stream($socket)); + + if (\PHP_VERSION_ID >= 80300) { + $uri = ($info['uri'] ?? '//'); + if (str_starts_with($uri, 'unix://')) { + $uri .= $addr; + } else { + $uri .= \sprintf(str_contains($addr, ':') ? '[%s]:%s' : '%s:%s', $addr, $port); + } + + $a[Caster::PREFIX_VIRTUAL.'uri'] = $uri; + + if (@socket_atmark($socket)) { + $a[Caster::PREFIX_VIRTUAL.'atmark'] = true; + } + } + + $a += [ + Caster::PREFIX_VIRTUAL.'timed_out' => $info['timed_out'], + Caster::PREFIX_VIRTUAL.'blocked' => $info['blocked'], + ]; + + if (!$lastError = socket_last_error($socket)) { + return $a; + } + + static $errors; + + if (!$errors) { + $errors = get_defined_constants(true)['sockets'] ?? []; + $errors = array_flip(array_filter($errors, static fn ($k) => str_starts_with($k, 'SOCKET_E'), \ARRAY_FILTER_USE_KEY)); + } + + $a[Caster::PREFIX_VIRTUAL.'last_error'] = new ConstStub($errors[$lastError], socket_strerror($lastError)); + + return $a; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/SplCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/SplCaster.php new file mode 100644 index 0000000..31f4b11 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/SplCaster.php @@ -0,0 +1,258 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Casts SPL related classes to array representation. + * + * @author Nicolas Grekas + * + * @final + * + * @internal since Symfony 7.3 + */ +class SplCaster +{ + private const SPL_FILE_OBJECT_FLAGS = [ + \SplFileObject::DROP_NEW_LINE => 'DROP_NEW_LINE', + \SplFileObject::READ_AHEAD => 'READ_AHEAD', + \SplFileObject::SKIP_EMPTY => 'SKIP_EMPTY', + \SplFileObject::READ_CSV => 'READ_CSV', + ]; + + public static function castArrayObject(\ArrayObject $c, array $a, Stub $stub, bool $isNested): array + { + return self::castSplArray($c, $a, $stub, $isNested); + } + + public static function castArrayIterator(\ArrayIterator $c, array $a, Stub $stub, bool $isNested): array + { + return self::castSplArray($c, $a, $stub, $isNested); + } + + public static function castHeap(\Iterator $c, array $a, Stub $stub, bool $isNested): array + { + $a += [ + Caster::PREFIX_VIRTUAL.'heap' => iterator_to_array(clone $c), + ]; + + return $a; + } + + public static function castDoublyLinkedList(\SplDoublyLinkedList $c, array $a, Stub $stub, bool $isNested): array + { + $prefix = Caster::PREFIX_VIRTUAL; + $mode = $c->getIteratorMode(); + $c->setIteratorMode(\SplDoublyLinkedList::IT_MODE_KEEP | $mode & ~\SplDoublyLinkedList::IT_MODE_DELETE); + + $a += [ + $prefix.'mode' => new ConstStub((($mode & \SplDoublyLinkedList::IT_MODE_LIFO) ? 'IT_MODE_LIFO' : 'IT_MODE_FIFO').' | '.(($mode & \SplDoublyLinkedList::IT_MODE_DELETE) ? 'IT_MODE_DELETE' : 'IT_MODE_KEEP'), $mode), + $prefix.'dllist' => iterator_to_array($c), + ]; + $c->setIteratorMode($mode); + + return $a; + } + + public static function castFileInfo(\SplFileInfo $c, array $a, Stub $stub, bool $isNested): array + { + static $map = [ + 'path' => 'getPath', + 'filename' => 'getFilename', + 'basename' => 'getBasename', + 'pathname' => 'getPathname', + 'extension' => 'getExtension', + 'realPath' => 'getRealPath', + 'aTime' => 'getATime', + 'mTime' => 'getMTime', + 'cTime' => 'getCTime', + 'inode' => 'getInode', + 'size' => 'getSize', + 'perms' => 'getPerms', + 'owner' => 'getOwner', + 'group' => 'getGroup', + 'type' => 'getType', + 'writable' => 'isWritable', + 'readable' => 'isReadable', + 'executable' => 'isExecutable', + 'file' => 'isFile', + 'dir' => 'isDir', + 'link' => 'isLink', + 'linkTarget' => 'getLinkTarget', + ]; + + $prefix = Caster::PREFIX_VIRTUAL; + unset($a["\0SplFileInfo\0fileName"]); + unset($a["\0SplFileInfo\0pathName"]); + + try { + $c->isReadable(); + } catch (\RuntimeException $e) { + if ('Object not initialized' !== $e->getMessage()) { + throw $e; + } + + $a[$prefix.'⚠'] = 'The parent constructor was not called: the object is in an invalid state'; + + return $a; + } catch (\Error $e) { + if ('Object not initialized' !== $e->getMessage()) { + throw $e; + } + + $a[$prefix.'⚠'] = 'The parent constructor was not called: the object is in an invalid state'; + + return $a; + } + + foreach ($map as $key => $accessor) { + try { + $a[$prefix.$key] = $c->$accessor(); + } catch (\Exception) { + } + } + + if ($a[$prefix.'realPath'] ?? false) { + $a[$prefix.'realPath'] = new LinkStub($a[$prefix.'realPath']); + } + + if (isset($a[$prefix.'perms'])) { + $a[$prefix.'perms'] = new ConstStub(\sprintf('0%o', $a[$prefix.'perms']), $a[$prefix.'perms']); + } + + static $mapDate = ['aTime', 'mTime', 'cTime']; + foreach ($mapDate as $key) { + if (isset($a[$prefix.$key])) { + $a[$prefix.$key] = new ConstStub(date('Y-m-d H:i:s', $a[$prefix.$key]), $a[$prefix.$key]); + } + } + + return $a; + } + + public static function castFileObject(\SplFileObject $c, array $a, Stub $stub, bool $isNested): array + { + static $map = [ + 'csvControl' => 'getCsvControl', + 'flags' => 'getFlags', + 'maxLineLen' => 'getMaxLineLen', + 'fstat' => 'fstat', + 'eof' => 'eof', + 'key' => 'key', + ]; + + $prefix = Caster::PREFIX_VIRTUAL; + + foreach ($map as $key => $accessor) { + try { + $a[$prefix.$key] = $c->$accessor(); + } catch (\Exception) { + } + } + + if (isset($a[$prefix.'flags'])) { + $flagsArray = []; + foreach (self::SPL_FILE_OBJECT_FLAGS as $value => $name) { + if ($a[$prefix.'flags'] & $value) { + $flagsArray[] = $name; + } + } + $a[$prefix.'flags'] = new ConstStub(implode('|', $flagsArray), $a[$prefix.'flags']); + } + + if (isset($a[$prefix.'fstat'])) { + $a[$prefix.'fstat'] = new CutArrayStub($a[$prefix.'fstat'], ['dev', 'ino', 'nlink', 'rdev', 'blksize', 'blocks']); + } + + return $a; + } + + public static function castObjectStorage(\SplObjectStorage $c, array $a, Stub $stub, bool $isNested): array + { + $storage = []; + unset($a[Caster::PREFIX_DYNAMIC."\0gcdata"]); // Don't hit https://bugs.php.net/65967 + unset($a["\0SplObjectStorage\0storage"]); + + $clone = clone $c; + foreach ($clone as $obj) { + $storage[] = new EnumStub([ + 'object' => $obj, + 'info' => $clone->getInfo(), + ]); + } + + $a += [ + Caster::PREFIX_VIRTUAL.'storage' => $storage, + ]; + + return $a; + } + + public static function castOuterIterator(\OuterIterator $c, array $a, Stub $stub, bool $isNested): array + { + $a[Caster::PREFIX_VIRTUAL.'innerIterator'] = $c->getInnerIterator(); + + return $a; + } + + public static function castWeakReference(\WeakReference $c, array $a, Stub $stub, bool $isNested): array + { + $a[Caster::PREFIX_VIRTUAL.'object'] = $c->get(); + + return $a; + } + + public static function castWeakMap(\WeakMap $c, array $a, Stub $stub, bool $isNested): array + { + $map = []; + + foreach (clone $c as $obj => $data) { + $map[] = new EnumStub([ + 'object' => $obj, + 'data' => $data, + ]); + } + + $a += [ + Caster::PREFIX_VIRTUAL.'map' => $map, + ]; + + return $a; + } + + private static function castSplArray(\ArrayObject|\ArrayIterator $c, array $a, Stub $stub, bool $isNested): array + { + $prefix = Caster::PREFIX_VIRTUAL; + $flags = $c->getFlags(); + + if (!($flags & \ArrayObject::STD_PROP_LIST)) { + $c->setFlags(\ArrayObject::STD_PROP_LIST); + $a = Caster::castObject($c, $c::class, method_exists($c, '__debugInfo'), $stub->class); + $c->setFlags($flags); + } + + unset($a["\0ArrayObject\0storage"], $a["\0ArrayIterator\0storage"]); + + $a += [ + $prefix.'storage' => $c->getArrayCopy(), + $prefix.'flag::STD_PROP_LIST' => (bool) ($flags & \ArrayObject::STD_PROP_LIST), + $prefix.'flag::ARRAY_AS_PROPS' => (bool) ($flags & \ArrayObject::ARRAY_AS_PROPS), + ]; + if ($c instanceof \ArrayObject) { + $a[$prefix.'iteratorClass'] = new ClassStub($c->getIteratorClass()); + } + + return $a; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/SqliteCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/SqliteCaster.php new file mode 100644 index 0000000..25d47ac --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/SqliteCaster.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * @author Alexandre Daubois + * + * @internal + */ +final class SqliteCaster +{ + public static function castSqlite3Result(\SQLite3Result $result, array $a, Stub $stub, bool $isNested): array + { + $numColumns = $result->numColumns(); + for ($i = 0; $i < $numColumns; ++$i) { + $a[Caster::PREFIX_VIRTUAL.'columnNames'][$i] = $result->columnName($i); + } + + return $a; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/StubCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/StubCaster.php new file mode 100644 index 0000000..85cf997 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/StubCaster.php @@ -0,0 +1,94 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Casts a caster's Stub. + * + * @author Nicolas Grekas + * + * @final + * + * @internal since Symfony 7.3 + */ +class StubCaster +{ + public static function castStub(Stub $c, array $a, Stub $stub, bool $isNested): array + { + if ($isNested) { + $stub->type = $c->type; + $stub->class = $c->class; + $stub->value = $c->value; + $stub->handle = $c->handle; + $stub->cut = $c->cut; + $stub->attr = $c->attr; + + if (Stub::TYPE_REF === $c->type && !$c->class && \is_string($c->value) && !preg_match('//u', $c->value)) { + $stub->type = Stub::TYPE_STRING; + $stub->class = Stub::STRING_BINARY; + } + + $a = []; + } + + return $a; + } + + public static function castCutArray(CutArrayStub $c, array $a, Stub $stub, bool $isNested): array + { + return $isNested ? $c->preservedSubset : $a; + } + + public static function cutInternals($obj, array $a, Stub $stub, bool $isNested): array + { + if ($isNested) { + $stub->cut += \count($a); + + return []; + } + + return $a; + } + + public static function castEnum(EnumStub $c, array $a, Stub $stub, bool $isNested): array + { + if ($isNested) { + $stub->class = $c->dumpKeys ? '' : null; + $stub->handle = 0; + $stub->value = null; + $stub->cut = $c->cut; + $stub->attr = $c->attr; + + $a = []; + + if ($c->value) { + foreach (array_keys($c->value) as $k) { + $keys[] = !isset($k[0]) || "\0" !== $k[0] ? Caster::PREFIX_VIRTUAL.$k : $k; + } + // Preserve references with array_combine() + $a = array_combine($keys, $c->value); + } + } + + return $a; + } + + public static function castScalar(ScalarStub $scalarStub, array $a, Stub $stub): array + { + $stub->type = Stub::TYPE_SCALAR; + $stub->attr['value'] = $scalarStub->value; + + return $a; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/SymfonyCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/SymfonyCaster.php new file mode 100644 index 0000000..a81d399 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/SymfonyCaster.php @@ -0,0 +1,125 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Uid\Ulid; +use Symfony\Component\Uid\Uuid; +use Symfony\Component\VarDumper\Cloner\Stub; +use Symfony\Component\VarExporter\Internal\LazyObjectState; + +/** + * @final + * + * @internal since Symfony 7.3 + */ +class SymfonyCaster +{ + private const REQUEST_GETTERS = [ + 'pathInfo' => 'getPathInfo', + 'requestUri' => 'getRequestUri', + 'baseUrl' => 'getBaseUrl', + 'basePath' => 'getBasePath', + 'method' => 'getMethod', + 'format' => 'getRequestFormat', + ]; + + public static function castRequest(Request $request, array $a, Stub $stub, bool $isNested): array + { + $clone = null; + + foreach (self::REQUEST_GETTERS as $prop => $getter) { + $key = Caster::PREFIX_PROTECTED.$prop; + if (\array_key_exists($key, $a) && null === $a[$key]) { + $clone ??= clone $request; + $a[Caster::PREFIX_VIRTUAL.$prop] = $clone->{$getter}(); + } + } + + return $a; + } + + public static function castHttpClient($client, array $a, Stub $stub, bool $isNested): array + { + $multiKey = \sprintf("\0%s\0multi", $client::class); + if (isset($a[$multiKey]) && !$a[$multiKey] instanceof Stub) { + $a[$multiKey] = new CutStub($a[$multiKey]); + } + + return $a; + } + + public static function castHttpClientResponse($response, array $a, Stub $stub, bool $isNested): array + { + $stub->cut += \count($a); + $a = []; + + foreach ($response->getInfo() as $k => $v) { + $a[Caster::PREFIX_VIRTUAL.$k] = $v; + } + + return $a; + } + + public static function castLazyObjectState($state, array $a, Stub $stub, bool $isNested): array + { + if (!$isNested) { + return $a; + } + + $stub->cut += \count($a) - 1; + + $instance = $a['realInstance'] ?? null; + + if (isset($a['status'])) { // forward-compat with Symfony 8 + $a = ['status' => new ConstStub(match ($a['status']) { + LazyObjectState::STATUS_INITIALIZED_FULL => 'INITIALIZED_FULL', + LazyObjectState::STATUS_INITIALIZED_PARTIAL => 'INITIALIZED_PARTIAL', + LazyObjectState::STATUS_UNINITIALIZED_FULL => 'UNINITIALIZED_FULL', + LazyObjectState::STATUS_UNINITIALIZED_PARTIAL => 'UNINITIALIZED_PARTIAL', + }, $a['status'])]; + } + + if ($instance) { + $a['realInstance'] = $instance; + --$stub->cut; + } + + return $a; + } + + public static function castUuid(Uuid $uuid, array $a, Stub $stub, bool $isNested): array + { + $a[Caster::PREFIX_VIRTUAL.'toBase58'] = $uuid->toBase58(); + $a[Caster::PREFIX_VIRTUAL.'toBase32'] = $uuid->toBase32(); + + // symfony/uid >= 5.3 + if (method_exists($uuid, 'getDateTime')) { + $a[Caster::PREFIX_VIRTUAL.'time'] = $uuid->getDateTime()->format('Y-m-d H:i:s.u \U\T\C'); + } + + return $a; + } + + public static function castUlid(Ulid $ulid, array $a, Stub $stub, bool $isNested): array + { + $a[Caster::PREFIX_VIRTUAL.'toBase58'] = $ulid->toBase58(); + $a[Caster::PREFIX_VIRTUAL.'toRfc4122'] = $ulid->toRfc4122(); + + // symfony/uid >= 5.3 + if (method_exists($ulid, 'getDateTime')) { + $a[Caster::PREFIX_VIRTUAL.'time'] = $ulid->getDateTime()->format('Y-m-d H:i:s.v \U\T\C'); + } + + return $a; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/TraceStub.php b/upLoadImage/vendor/symfony/var-dumper/Caster/TraceStub.php new file mode 100644 index 0000000..b732eb2 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/TraceStub.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Represents a backtrace as returned by debug_backtrace() or Exception->getTrace(). + * + * @author Nicolas Grekas + */ +class TraceStub extends Stub +{ + public function __construct( + array $trace, + public bool $keepArgs = true, + public int $sliceOffset = 0, + public ?int $sliceLength = null, + public int $numberingOffset = 0, + ) { + $this->value = $trace; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/UninitializedStub.php b/upLoadImage/vendor/symfony/var-dumper/Caster/UninitializedStub.php new file mode 100644 index 0000000..a9bdd9b --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/UninitializedStub.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +/** + * Represents an uninitialized property. + * + * @author Nicolas Grekas + */ +class UninitializedStub extends ConstStub +{ + public function __construct(\ReflectionProperty $property) + { + parent::__construct('?'.($property->hasType() ? ' '.$property->getType() : ''), 'Uninitialized property'); + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/UuidCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/UuidCaster.php new file mode 100644 index 0000000..732ad7c --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/UuidCaster.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Ramsey\Uuid\UuidInterface; +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * @author Grégoire Pineau + * + * @internal since Symfony 7.3 + */ +final class UuidCaster +{ + public static function castRamseyUuid(UuidInterface $c, array $a, Stub $stub, bool $isNested): array + { + $a += [ + Caster::PREFIX_VIRTUAL.'uuid' => (string) $c, + ]; + + return $a; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/VirtualStub.php b/upLoadImage/vendor/symfony/var-dumper/Caster/VirtualStub.php new file mode 100644 index 0000000..60b58fa --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/VirtualStub.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +class VirtualStub extends ConstStub +{ + public function __construct(\ReflectionProperty $property) + { + parent::__construct('~'.($property->hasType() ? ' '.$property->getType() : ''), 'Virtual property'); + $this->attr['virtual'] = true; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/XmlReaderCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/XmlReaderCaster.php new file mode 100644 index 0000000..00420c7 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/XmlReaderCaster.php @@ -0,0 +1,94 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Casts XmlReader class to array representation. + * + * @author Baptiste Clavié + * + * @final + * + * @internal since Symfony 7.3 + */ +class XmlReaderCaster +{ + private const NODE_TYPES = [ + \XMLReader::NONE => 'NONE', + \XMLReader::ELEMENT => 'ELEMENT', + \XMLReader::ATTRIBUTE => 'ATTRIBUTE', + \XMLReader::TEXT => 'TEXT', + \XMLReader::CDATA => 'CDATA', + \XMLReader::ENTITY_REF => 'ENTITY_REF', + \XMLReader::ENTITY => 'ENTITY', + \XMLReader::PI => 'PI (Processing Instruction)', + \XMLReader::COMMENT => 'COMMENT', + \XMLReader::DOC => 'DOC', + \XMLReader::DOC_TYPE => 'DOC_TYPE', + \XMLReader::DOC_FRAGMENT => 'DOC_FRAGMENT', + \XMLReader::NOTATION => 'NOTATION', + \XMLReader::WHITESPACE => 'WHITESPACE', + \XMLReader::SIGNIFICANT_WHITESPACE => 'SIGNIFICANT_WHITESPACE', + \XMLReader::END_ELEMENT => 'END_ELEMENT', + \XMLReader::END_ENTITY => 'END_ENTITY', + \XMLReader::XML_DECLARATION => 'XML_DECLARATION', + ]; + + public static function castXmlReader(\XMLReader $reader, array $a, Stub $stub, bool $isNested): array + { + try { + $properties = [ + 'LOADDTD' => @$reader->getParserProperty(\XMLReader::LOADDTD), + 'DEFAULTATTRS' => @$reader->getParserProperty(\XMLReader::DEFAULTATTRS), + 'VALIDATE' => @$reader->getParserProperty(\XMLReader::VALIDATE), + 'SUBST_ENTITIES' => @$reader->getParserProperty(\XMLReader::SUBST_ENTITIES), + ]; + } catch (\Error) { + $properties = [ + 'LOADDTD' => false, + 'DEFAULTATTRS' => false, + 'VALIDATE' => false, + 'SUBST_ENTITIES' => false, + ]; + } + + $props = Caster::PREFIX_VIRTUAL.'parserProperties'; + $info = [ + 'localName' => $reader->localName, + 'prefix' => $reader->prefix, + 'nodeType' => new ConstStub(self::NODE_TYPES[$reader->nodeType], $reader->nodeType), + 'depth' => $reader->depth, + 'isDefault' => $reader->isDefault, + 'isEmptyElement' => \XMLReader::NONE === $reader->nodeType ? null : $reader->isEmptyElement, + 'xmlLang' => $reader->xmlLang, + 'attributeCount' => $reader->attributeCount, + 'value' => $reader->value, + 'namespaceURI' => $reader->namespaceURI, + 'baseURI' => $reader->baseURI ? new LinkStub($reader->baseURI) : $reader->baseURI, + $props => $properties, + ]; + + if ($info[$props] = Caster::filter($info[$props], Caster::EXCLUDE_EMPTY, [], $count)) { + $info[$props] = new EnumStub($info[$props]); + $info[$props]->cut = $count; + } + + $a = Caster::filter($a, Caster::EXCLUDE_UNINITIALIZED, [], $count); + $info = Caster::filter($info, Caster::EXCLUDE_EMPTY, [], $count); + // +2 because hasValue and hasAttributes are always filtered + $stub->cut += $count + 2; + + return $a + $info; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Caster/XmlResourceCaster.php b/upLoadImage/vendor/symfony/var-dumper/Caster/XmlResourceCaster.php new file mode 100644 index 0000000..f6b0896 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Caster/XmlResourceCaster.php @@ -0,0 +1,65 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Casts XML resources to array representation. + * + * @author Nicolas Grekas + * + * @final + * + * @internal since Symfony 7.3 + */ +class XmlResourceCaster +{ + private const XML_ERRORS = [ + \XML_ERROR_NONE => 'XML_ERROR_NONE', + \XML_ERROR_NO_MEMORY => 'XML_ERROR_NO_MEMORY', + \XML_ERROR_SYNTAX => 'XML_ERROR_SYNTAX', + \XML_ERROR_NO_ELEMENTS => 'XML_ERROR_NO_ELEMENTS', + \XML_ERROR_INVALID_TOKEN => 'XML_ERROR_INVALID_TOKEN', + \XML_ERROR_UNCLOSED_TOKEN => 'XML_ERROR_UNCLOSED_TOKEN', + \XML_ERROR_PARTIAL_CHAR => 'XML_ERROR_PARTIAL_CHAR', + \XML_ERROR_TAG_MISMATCH => 'XML_ERROR_TAG_MISMATCH', + \XML_ERROR_DUPLICATE_ATTRIBUTE => 'XML_ERROR_DUPLICATE_ATTRIBUTE', + \XML_ERROR_JUNK_AFTER_DOC_ELEMENT => 'XML_ERROR_JUNK_AFTER_DOC_ELEMENT', + \XML_ERROR_PARAM_ENTITY_REF => 'XML_ERROR_PARAM_ENTITY_REF', + \XML_ERROR_UNDEFINED_ENTITY => 'XML_ERROR_UNDEFINED_ENTITY', + \XML_ERROR_RECURSIVE_ENTITY_REF => 'XML_ERROR_RECURSIVE_ENTITY_REF', + \XML_ERROR_ASYNC_ENTITY => 'XML_ERROR_ASYNC_ENTITY', + \XML_ERROR_BAD_CHAR_REF => 'XML_ERROR_BAD_CHAR_REF', + \XML_ERROR_BINARY_ENTITY_REF => 'XML_ERROR_BINARY_ENTITY_REF', + \XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF => 'XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF', + \XML_ERROR_MISPLACED_XML_PI => 'XML_ERROR_MISPLACED_XML_PI', + \XML_ERROR_UNKNOWN_ENCODING => 'XML_ERROR_UNKNOWN_ENCODING', + \XML_ERROR_INCORRECT_ENCODING => 'XML_ERROR_INCORRECT_ENCODING', + \XML_ERROR_UNCLOSED_CDATA_SECTION => 'XML_ERROR_UNCLOSED_CDATA_SECTION', + \XML_ERROR_EXTERNAL_ENTITY_HANDLING => 'XML_ERROR_EXTERNAL_ENTITY_HANDLING', + ]; + + public static function castXml($h, array $a, Stub $stub, bool $isNested): array + { + $a['current_byte_index'] = xml_get_current_byte_index($h); + $a['current_column_number'] = xml_get_current_column_number($h); + $a['current_line_number'] = xml_get_current_line_number($h); + $a['error_code'] = xml_get_error_code($h); + + if (isset(self::XML_ERRORS[$a['error_code']])) { + $a['error_code'] = new ConstStub(self::XML_ERRORS[$a['error_code']], $a['error_code']); + } + + return $a; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Cloner/AbstractCloner.php b/upLoadImage/vendor/symfony/var-dumper/Cloner/AbstractCloner.php new file mode 100644 index 0000000..2f7d940 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Cloner/AbstractCloner.php @@ -0,0 +1,413 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Cloner; + +use Symfony\Component\VarDumper\Caster\Caster; +use Symfony\Component\VarDumper\Exception\ThrowingCasterException; + +/** + * AbstractCloner implements a generic caster mechanism for objects and resources. + * + * @author Nicolas Grekas + */ +abstract class AbstractCloner implements ClonerInterface +{ + public static array $defaultCasters = [ + '__PHP_Incomplete_Class' => ['Symfony\Component\VarDumper\Caster\Caster', 'castPhpIncompleteClass'], + + 'AddressInfo' => ['Symfony\Component\VarDumper\Caster\AddressInfoCaster', 'castAddressInfo'], + 'Socket' => ['Symfony\Component\VarDumper\Caster\SocketCaster', 'castSocket'], + + 'Symfony\Component\VarDumper\Caster\CutStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castStub'], + 'Symfony\Component\VarDumper\Caster\CutArrayStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castCutArray'], + 'Symfony\Component\VarDumper\Caster\ConstStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castStub'], + 'Symfony\Component\VarDumper\Caster\EnumStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castEnum'], + 'Symfony\Component\VarDumper\Caster\ScalarStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castScalar'], + + 'Fiber' => ['Symfony\Component\VarDumper\Caster\FiberCaster', 'castFiber'], + + 'Closure' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castClosure'], + 'Generator' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castGenerator'], + 'ReflectionType' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castType'], + 'ReflectionAttribute' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castAttribute'], + 'ReflectionGenerator' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castReflectionGenerator'], + 'ReflectionClass' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castClass'], + 'ReflectionClassConstant' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castClassConstant'], + 'ReflectionFunctionAbstract' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castFunctionAbstract'], + 'ReflectionMethod' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castMethod'], + 'ReflectionParameter' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castParameter'], + 'ReflectionProperty' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castProperty'], + 'ReflectionReference' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castReference'], + 'ReflectionExtension' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castExtension'], + 'ReflectionZendExtension' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castZendExtension'], + + 'Doctrine\Common\Persistence\ObjectManager' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], + 'Doctrine\Common\Proxy\Proxy' => ['Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castCommonProxy'], + 'Doctrine\ORM\Proxy\Proxy' => ['Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castOrmProxy'], + 'Doctrine\ORM\PersistentCollection' => ['Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castPersistentCollection'], + 'Doctrine\Persistence\ObjectManager' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], + + 'DOMException' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castException'], + 'Dom\Exception' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castException'], + 'DOMStringList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], + 'DOMNameList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], + 'DOMImplementation' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castImplementation'], + 'Dom\Implementation' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castImplementation'], + 'DOMImplementationList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], + 'DOMNode' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], + 'Dom\Node' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], + 'DOMNameSpaceNode' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], + 'DOMDocument' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDocument'], + 'Dom\XMLDocument' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castXMLDocument'], + 'Dom\HTMLDocument' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castHTMLDocument'], + 'DOMNodeList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], + 'Dom\NodeList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], + 'DOMNamedNodeMap' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], + 'Dom\DTDNamedNodeMap' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], + 'DOMXPath' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], + 'Dom\XPath' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], + 'Dom\HTMLCollection' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], + 'Dom\TokenList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDom'], + + 'XMLReader' => ['Symfony\Component\VarDumper\Caster\XmlReaderCaster', 'castXmlReader'], + + 'ErrorException' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castErrorException'], + 'Exception' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castException'], + 'Error' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castError'], + 'Symfony\Bridge\Monolog\Logger' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], + 'Symfony\Component\DependencyInjection\ContainerInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], + 'Symfony\Component\EventDispatcher\EventDispatcherInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], + 'Symfony\Component\HttpClient\AmpHttpClient' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClient'], + 'Symfony\Component\HttpClient\CurlHttpClient' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClient'], + 'Symfony\Component\HttpClient\NativeHttpClient' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClient'], + 'Symfony\Component\HttpClient\Response\AmpResponse' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClientResponse'], + 'Symfony\Component\HttpClient\Response\AmpResponseV4' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClientResponse'], + 'Symfony\Component\HttpClient\Response\AmpResponseV5' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClientResponse'], + 'Symfony\Component\HttpClient\Response\CurlResponse' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClientResponse'], + 'Symfony\Component\HttpClient\Response\NativeResponse' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castHttpClientResponse'], + 'Symfony\Component\HttpFoundation\Request' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castRequest'], + 'Symfony\Component\Uid\Ulid' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castUlid'], + 'Symfony\Component\Uid\Uuid' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castUuid'], + 'Symfony\Component\VarExporter\Internal\LazyObjectState' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castLazyObjectState'], + 'Symfony\Component\VarDumper\Exception\ThrowingCasterException' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castThrowingCasterException'], + 'Symfony\Component\VarDumper\Caster\TraceStub' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castTraceStub'], + 'Symfony\Component\VarDumper\Caster\FrameStub' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castFrameStub'], + 'Symfony\Component\VarDumper\Cloner\AbstractCloner' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], + 'Symfony\Component\ErrorHandler\Exception\FlattenException' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castFlattenException'], + 'Symfony\Component\ErrorHandler\Exception\SilencedErrorContext' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castSilencedErrorContext'], + + 'Imagine\Image\ImageInterface' => ['Symfony\Component\VarDumper\Caster\ImagineCaster', 'castImage'], + + 'Ramsey\Uuid\UuidInterface' => ['Symfony\Component\VarDumper\Caster\UuidCaster', 'castRamseyUuid'], + + 'ProxyManager\Proxy\ProxyInterface' => ['Symfony\Component\VarDumper\Caster\ProxyManagerCaster', 'castProxy'], + 'PHPUnit_Framework_MockObject_MockObject' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], + 'PHPUnit\Framework\MockObject\MockObject' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], + 'PHPUnit\Framework\MockObject\Stub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], + 'Prophecy\Prophecy\ProphecySubjectInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], + 'Mockery\MockInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], + + 'PDO' => ['Symfony\Component\VarDumper\Caster\PdoCaster', 'castPdo'], + 'PDOStatement' => ['Symfony\Component\VarDumper\Caster\PdoCaster', 'castPdoStatement'], + + 'AMQPConnection' => ['Symfony\Component\VarDumper\Caster\AmqpCaster', 'castConnection'], + 'AMQPChannel' => ['Symfony\Component\VarDumper\Caster\AmqpCaster', 'castChannel'], + 'AMQPQueue' => ['Symfony\Component\VarDumper\Caster\AmqpCaster', 'castQueue'], + 'AMQPExchange' => ['Symfony\Component\VarDumper\Caster\AmqpCaster', 'castExchange'], + 'AMQPEnvelope' => ['Symfony\Component\VarDumper\Caster\AmqpCaster', 'castEnvelope'], + + 'ArrayObject' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castArrayObject'], + 'ArrayIterator' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castArrayIterator'], + 'SplDoublyLinkedList' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castDoublyLinkedList'], + 'SplFileInfo' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castFileInfo'], + 'SplFileObject' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castFileObject'], + 'SplHeap' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castHeap'], + 'SplObjectStorage' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castObjectStorage'], + 'SplPriorityQueue' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castHeap'], + 'OuterIterator' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castOuterIterator'], + 'WeakMap' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castWeakMap'], + 'WeakReference' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castWeakReference'], + + 'Redis' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedis'], + 'Relay\Relay' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedis'], + 'RedisArray' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedisArray'], + 'RedisCluster' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedisCluster'], + + 'DateTimeInterface' => ['Symfony\Component\VarDumper\Caster\DateCaster', 'castDateTime'], + 'DateInterval' => ['Symfony\Component\VarDumper\Caster\DateCaster', 'castInterval'], + 'DateTimeZone' => ['Symfony\Component\VarDumper\Caster\DateCaster', 'castTimeZone'], + 'DatePeriod' => ['Symfony\Component\VarDumper\Caster\DateCaster', 'castPeriod'], + + 'GMP' => ['Symfony\Component\VarDumper\Caster\GmpCaster', 'castGmp'], + + 'MessageFormatter' => ['Symfony\Component\VarDumper\Caster\IntlCaster', 'castMessageFormatter'], + 'NumberFormatter' => ['Symfony\Component\VarDumper\Caster\IntlCaster', 'castNumberFormatter'], + 'IntlTimeZone' => ['Symfony\Component\VarDumper\Caster\IntlCaster', 'castIntlTimeZone'], + 'IntlCalendar' => ['Symfony\Component\VarDumper\Caster\IntlCaster', 'castIntlCalendar'], + 'IntlDateFormatter' => ['Symfony\Component\VarDumper\Caster\IntlCaster', 'castIntlDateFormatter'], + + 'Memcached' => ['Symfony\Component\VarDumper\Caster\MemcachedCaster', 'castMemcached'], + + 'Ds\Collection' => ['Symfony\Component\VarDumper\Caster\DsCaster', 'castCollection'], + 'Ds\Map' => ['Symfony\Component\VarDumper\Caster\DsCaster', 'castMap'], + 'Ds\Pair' => ['Symfony\Component\VarDumper\Caster\DsCaster', 'castPair'], + 'Symfony\Component\VarDumper\Caster\DsPairStub' => ['Symfony\Component\VarDumper\Caster\DsCaster', 'castPairStub'], + + 'mysqli_driver' => ['Symfony\Component\VarDumper\Caster\MysqliCaster', 'castMysqliDriver'], + + 'CurlHandle' => ['Symfony\Component\VarDumper\Caster\CurlCaster', 'castCurl'], + + 'Dba\Connection' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'], + ':dba' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'], + ':dba persistent' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'], + + 'GdImage' => ['Symfony\Component\VarDumper\Caster\GdCaster', 'castGd'], + + 'SQLite3Result' => ['Symfony\Component\VarDumper\Caster\SqliteCaster', 'castSqlite3Result'], + + 'PgSql\Lob' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLargeObject'], + 'PgSql\Connection' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLink'], + 'PgSql\Result' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castResult'], + + ':process' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castProcess'], + ':stream' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStream'], + + 'OpenSSLAsymmetricKey' => ['Symfony\Component\VarDumper\Caster\OpenSSLCaster', 'castOpensslAsymmetricKey'], + 'OpenSSLCertificateSigningRequest' => ['Symfony\Component\VarDumper\Caster\OpenSSLCaster', 'castOpensslCsr'], + 'OpenSSLCertificate' => ['Symfony\Component\VarDumper\Caster\OpenSSLCaster', 'castOpensslX509'], + + ':persistent stream' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStream'], + ':stream-context' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStreamContext'], + + 'XmlParser' => ['Symfony\Component\VarDumper\Caster\XmlResourceCaster', 'castXml'], + + 'RdKafka' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castRdKafka'], + 'RdKafka\Conf' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castConf'], + 'RdKafka\KafkaConsumer' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castKafkaConsumer'], + 'RdKafka\Metadata\Broker' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castBrokerMetadata'], + 'RdKafka\Metadata\Collection' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castCollectionMetadata'], + 'RdKafka\Metadata\Partition' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castPartitionMetadata'], + 'RdKafka\Metadata\Topic' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castTopicMetadata'], + 'RdKafka\Message' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castMessage'], + 'RdKafka\Topic' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castTopic'], + 'RdKafka\TopicPartition' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castTopicPartition'], + 'RdKafka\TopicConf' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castTopicConf'], + + 'FFI\CData' => ['Symfony\Component\VarDumper\Caster\FFICaster', 'castCTypeOrCData'], + 'FFI\CType' => ['Symfony\Component\VarDumper\Caster\FFICaster', 'castCTypeOrCData'], + ]; + + protected int $maxItems = 2500; + protected int $maxString = -1; + protected int $minDepth = 1; + + /** + * @var array> + */ + private array $casters = []; + + /** + * @var callable|null + */ + private $prevErrorHandler; + + private array $classInfo = []; + private int $filter = 0; + + /** + * @param callable[]|null $casters A map of casters + * + * @see addCasters + */ + public function __construct(?array $casters = null) + { + $this->addCasters($casters ?? static::$defaultCasters); + } + + /** + * Adds casters for resources and objects. + * + * Maps resources or object types to a callback. + * Use types as keys and callable casters as values. + * Prefix types with `::`, + * see e.g. self::$defaultCasters. + * + * @param array $casters A map of casters + */ + public function addCasters(array $casters): void + { + foreach ($casters as $type => $callback) { + $this->casters[$type][] = $callback; + } + } + + /** + * Adds default casters for resources and objects. + * + * Maps resources or object types to a callback. + * Use types as keys and callable casters as values. + * Prefix types with `::`, + * see e.g. self::$defaultCasters. + * + * @param array $casters A map of casters + */ + public static function addDefaultCasters(array $casters): void + { + self::$defaultCasters = [...self::$defaultCasters, ...$casters]; + } + + /** + * Sets the maximum number of items to clone past the minimum depth in nested structures. + */ + public function setMaxItems(int $maxItems): void + { + $this->maxItems = $maxItems; + } + + /** + * Sets the maximum cloned length for strings. + */ + public function setMaxString(int $maxString): void + { + $this->maxString = $maxString; + } + + /** + * Sets the minimum tree depth where we are guaranteed to clone all the items. After this + * depth is reached, only setMaxItems items will be cloned. + */ + public function setMinDepth(int $minDepth): void + { + $this->minDepth = $minDepth; + } + + /** + * Clones a PHP variable. + * + * @param int $filter A bit field of Caster::EXCLUDE_* constants + */ + public function cloneVar(mixed $var, int $filter = 0): Data + { + $this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) { + if (\E_RECOVERABLE_ERROR === $type || \E_USER_ERROR === $type) { + // Cloner never dies + throw new \ErrorException($msg, 0, $type, $file, $line); + } + + if ($this->prevErrorHandler) { + return ($this->prevErrorHandler)($type, $msg, $file, $line, $context); + } + + return false; + }); + $this->filter = $filter; + + if ($gc = gc_enabled()) { + gc_disable(); + } + try { + return new Data($this->doClone($var)); + } finally { + if ($gc) { + gc_enable(); + } + restore_error_handler(); + $this->prevErrorHandler = null; + } + } + + /** + * Effectively clones the PHP variable. + */ + abstract protected function doClone(mixed $var): array; + + /** + * Casts an object to an array representation. + * + * @param bool $isNested True if the object is nested in the dumped structure + */ + protected function castObject(Stub $stub, bool $isNested): array + { + $obj = $stub->value; + $class = $stub->class; + + if (str_contains($class, "@anonymous\0")) { + $stub->class = get_debug_type($obj); + } + if (isset($this->classInfo[$class])) { + [$i, $parents, $hasDebugInfo, $fileInfo] = $this->classInfo[$class]; + } else { + $i = 2; + $parents = [$class]; + $hasDebugInfo = method_exists($class, '__debugInfo'); + + foreach (class_parents($class) as $p) { + $parents[] = $p; + ++$i; + } + foreach (class_implements($class) as $p) { + $parents[] = $p; + ++$i; + } + $parents[] = '*'; + + $r = new \ReflectionClass($class); + $fileInfo = $r->isInternal() || $r->isSubclassOf(Stub::class) ? [] : [ + 'file' => $r->getFileName(), + 'line' => $r->getStartLine(), + ]; + + $this->classInfo[$class] = [$i, $parents, $hasDebugInfo, $fileInfo]; + } + + $stub->attr += $fileInfo; + $a = Caster::castObject($obj, $class, $hasDebugInfo, $stub->class); + + try { + while ($i--) { + if (!empty($this->casters[$p = $parents[$i]])) { + foreach ($this->casters[$p] as $callback) { + $a = $callback($obj, $a, $stub, $isNested, $this->filter); + } + } + } + } catch (\Exception $e) { + $a = [(Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠' => new ThrowingCasterException($e)] + $a; + } + + return $a; + } + + /** + * Casts a resource to an array representation. + * + * @param bool $isNested True if the object is nested in the dumped structure + */ + protected function castResource(Stub $stub, bool $isNested): array + { + $a = []; + $res = $stub->value; + $type = $stub->class; + + try { + if (!empty($this->casters[':'.$type])) { + foreach ($this->casters[':'.$type] as $callback) { + $a = $callback($res, $a, $stub, $isNested, $this->filter); + } + } + } catch (\Exception $e) { + $a = [(Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠' => new ThrowingCasterException($e)] + $a; + } + + return $a; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Cloner/ClonerInterface.php b/upLoadImage/vendor/symfony/var-dumper/Cloner/ClonerInterface.php new file mode 100644 index 0000000..5a8e2e4 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Cloner/ClonerInterface.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Cloner; + +/** + * @author Nicolas Grekas + */ +interface ClonerInterface +{ + /** + * Clones a PHP variable. + */ + public function cloneVar(mixed $var): Data; +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Cloner/Cursor.php b/upLoadImage/vendor/symfony/var-dumper/Cloner/Cursor.php new file mode 100644 index 0000000..8923007 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Cloner/Cursor.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Cloner; + +/** + * Represents the current state of a dumper while dumping. + * + * @author Nicolas Grekas + */ +class Cursor +{ + public const HASH_INDEXED = Stub::ARRAY_INDEXED; + public const HASH_ASSOC = Stub::ARRAY_ASSOC; + public const HASH_OBJECT = Stub::TYPE_OBJECT; + public const HASH_RESOURCE = Stub::TYPE_RESOURCE; + + public int $depth = 0; + public int $refIndex = 0; + public int $softRefTo = 0; + public int $softRefCount = 0; + public int $softRefHandle = 0; + public int $hardRefTo = 0; + public int $hardRefCount = 0; + public int $hardRefHandle = 0; + public int $hashType; + public string|int|null $hashKey = null; + public bool $hashKeyIsBinary; + public int $hashIndex = 0; + public int $hashLength = 0; + public int $hashCut = 0; + public bool $stop = false; + public array $attr = []; + public bool $skipChildren = false; +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Cloner/Data.php b/upLoadImage/vendor/symfony/var-dumper/Cloner/Data.php new file mode 100644 index 0000000..21727f9 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Cloner/Data.php @@ -0,0 +1,429 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Cloner; + +use Symfony\Component\VarDumper\Caster\Caster; +use Symfony\Component\VarDumper\Dumper\ContextProvider\SourceContextProvider; + +/** + * @author Nicolas Grekas + */ +class Data implements \ArrayAccess, \Countable, \IteratorAggregate, \Stringable +{ + private array $data; + private int $position = 0; + private int|string $key = 0; + private int $maxDepth = 20; + private int $maxItemsPerDepth = -1; + private int $useRefHandles = -1; + private array $context = []; + + /** + * @param array $data An array as returned by ClonerInterface::cloneVar() + */ + public function __construct(array $data) + { + $this->data = $data; + } + + public function getType(): ?string + { + $item = $this->data[$this->position][$this->key]; + + if ($item instanceof Stub && Stub::TYPE_REF === $item->type && !$item->position) { + $item = $item->value; + } + if (!$item instanceof Stub) { + return \gettype($item); + } + if (Stub::TYPE_STRING === $item->type) { + return 'string'; + } + if (Stub::TYPE_ARRAY === $item->type) { + return 'array'; + } + if (Stub::TYPE_OBJECT === $item->type) { + return $item->class; + } + if (Stub::TYPE_RESOURCE === $item->type) { + return $item->class.' resource'; + } + + return null; + } + + /** + * Returns a native representation of the original value. + * + * @param array|bool $recursive Whether values should be resolved recursively or not + * + * @return string|int|float|bool|array|Data[]|null + */ + public function getValue(array|bool $recursive = false): string|int|float|bool|array|null + { + $item = $this->data[$this->position][$this->key]; + + if ($item instanceof Stub && Stub::TYPE_REF === $item->type && !$item->position) { + $item = $item->value; + } + if (!($item = $this->getStub($item)) instanceof Stub) { + return $item; + } + if (Stub::TYPE_STRING === $item->type) { + return $item->value; + } + + $children = $item->position ? $this->data[$item->position] : []; + + foreach ($children as $k => $v) { + if ($recursive && !($v = $this->getStub($v)) instanceof Stub) { + continue; + } + $children[$k] = clone $this; + $children[$k]->key = $k; + $children[$k]->position = $item->position; + + if ($recursive) { + if (Stub::TYPE_REF === $v->type && ($v = $this->getStub($v->value)) instanceof Stub) { + $recursive = (array) $recursive; + if (isset($recursive[$v->position])) { + continue; + } + $recursive[$v->position] = true; + } + $children[$k] = $children[$k]->getValue($recursive); + } + } + + return $children; + } + + public function count(): int + { + return \count($this->getValue()); + } + + public function getIterator(): \Traversable + { + if (!\is_array($value = $this->getValue())) { + throw new \LogicException(\sprintf('"%s" object holds non-iterable type "%s".', self::class, get_debug_type($value))); + } + + yield from $value; + } + + public function __get(string $key): mixed + { + if (null !== $data = $this->seek($key)) { + $item = $this->getStub($data->data[$data->position][$data->key]); + + return $item instanceof Stub || [] === $item ? $data : $item; + } + + return null; + } + + public function __isset(string $key): bool + { + return null !== $this->seek($key); + } + + public function offsetExists(mixed $key): bool + { + return $this->__isset($key); + } + + public function offsetGet(mixed $key): mixed + { + return $this->__get($key); + } + + public function offsetSet(mixed $key, mixed $value): void + { + throw new \BadMethodCallException(self::class.' objects are immutable.'); + } + + public function offsetUnset(mixed $key): void + { + throw new \BadMethodCallException(self::class.' objects are immutable.'); + } + + public function __toString(): string + { + $value = $this->getValue(); + + if (!\is_array($value)) { + return (string) $value; + } + + return \sprintf('%s (count=%d)', $this->getType(), \count($value)); + } + + /** + * Returns a depth limited clone of $this. + */ + public function withMaxDepth(int $maxDepth): static + { + $data = clone $this; + $data->maxDepth = $maxDepth; + + return $data; + } + + /** + * Limits the number of elements per depth level. + */ + public function withMaxItemsPerDepth(int $maxItemsPerDepth): static + { + $data = clone $this; + $data->maxItemsPerDepth = $maxItemsPerDepth; + + return $data; + } + + /** + * Enables/disables objects' identifiers tracking. + * + * @param bool $useRefHandles False to hide global ref. handles + */ + public function withRefHandles(bool $useRefHandles): static + { + $data = clone $this; + $data->useRefHandles = $useRefHandles ? -1 : 0; + + return $data; + } + + public function withContext(array $context): static + { + $data = clone $this; + $data->context = $context; + + return $data; + } + + public function getContext(): array + { + return $this->context; + } + + /** + * Seeks to a specific key in nested data structures. + */ + public function seek(string|int $key): ?static + { + $item = $this->data[$this->position][$this->key]; + + if ($item instanceof Stub && Stub::TYPE_REF === $item->type && !$item->position) { + $item = $item->value; + } + if (!($item = $this->getStub($item)) instanceof Stub || !$item->position) { + return null; + } + $keys = [$key]; + + switch ($item->type) { + case Stub::TYPE_OBJECT: + $keys[] = Caster::PREFIX_DYNAMIC.$key; + $keys[] = Caster::PREFIX_PROTECTED.$key; + $keys[] = Caster::PREFIX_VIRTUAL.$key; + $keys[] = "\0$item->class\0$key"; + // no break + case Stub::TYPE_ARRAY: + case Stub::TYPE_RESOURCE: + break; + default: + return null; + } + + $data = null; + $children = $this->data[$item->position]; + + foreach ($keys as $key) { + if (isset($children[$key]) || \array_key_exists($key, $children)) { + $data = clone $this; + $data->key = $key; + $data->position = $item->position; + break; + } + } + + return $data; + } + + /** + * Dumps data with a DumperInterface dumper. + */ + public function dump(DumperInterface $dumper): void + { + $refs = [0]; + $cursor = new Cursor(); + $cursor->hashType = -1; + $cursor->attr = $this->context[SourceContextProvider::class] ?? []; + $label = $this->context['label'] ?? ''; + + if ($cursor->attr || '' !== $label) { + $dumper->dumpScalar($cursor, 'label', $label); + } + $cursor->hashType = 0; + $this->dumpItem($dumper, $cursor, $refs, $this->data[$this->position][$this->key]); + } + + /** + * Depth-first dumping of items. + * + * @param mixed $item A Stub object or the original value being dumped + */ + private function dumpItem(DumperInterface $dumper, Cursor $cursor, array &$refs, mixed $item): void + { + $cursor->refIndex = 0; + $cursor->softRefTo = $cursor->softRefHandle = $cursor->softRefCount = 0; + $cursor->hardRefTo = $cursor->hardRefHandle = $cursor->hardRefCount = 0; + $firstSeen = true; + + if (!$item instanceof Stub) { + $cursor->attr = []; + $type = \gettype($item); + if ('array' === $type && $item) { + $item = $this->getStub($item); + } + } elseif (Stub::TYPE_REF === $item->type) { + if ($item->handle) { + if (!isset($refs[$r = $item->handle - (\PHP_INT_MAX >> 1)])) { + $cursor->refIndex = $refs[$r] = $cursor->refIndex ?: ++$refs[0]; + } else { + $firstSeen = false; + } + $cursor->hardRefTo = $refs[$r]; + $cursor->hardRefHandle = $this->useRefHandles & $item->handle; + $cursor->hardRefCount = 0 < $item->handle ? $item->refCount : 0; + } + $cursor->attr = $item->attr; + $type = $item->class ?: \gettype($item->value); + $item = $this->getStub($item->value); + } + if ($item instanceof Stub) { + if ($item->refCount) { + if (!isset($refs[$r = $item->handle])) { + $cursor->refIndex = $refs[$r] = $cursor->refIndex ?: ++$refs[0]; + } else { + $firstSeen = false; + } + $cursor->softRefTo = $refs[$r]; + } + $cursor->softRefHandle = $this->useRefHandles & $item->handle; + $cursor->softRefCount = $item->refCount; + $cursor->attr = $item->attr; + $cut = $item->cut; + + if ($item->position && $firstSeen) { + $children = $this->data[$item->position]; + + if ($cursor->stop) { + if ($cut >= 0) { + $cut += \count($children); + } + $children = []; + } + } else { + $children = []; + } + switch ($item->type) { + case Stub::TYPE_STRING: + $dumper->dumpString($cursor, $item->value, Stub::STRING_BINARY === $item->class, $cut); + break; + + case Stub::TYPE_ARRAY: + $item = clone $item; + $item->type = $item->class; + $item->class = $item->value; + // no break + case Stub::TYPE_OBJECT: + case Stub::TYPE_RESOURCE: + $withChildren = $children && $cursor->depth !== $this->maxDepth && $this->maxItemsPerDepth; + $dumper->enterHash($cursor, $item->type, $item->class, $withChildren); + if ($withChildren) { + if ($cursor->skipChildren) { + $withChildren = false; + $cut = -1; + } else { + $cut = $this->dumpChildren($dumper, $cursor, $refs, $children, $cut, $item->type, null !== $item->class); + } + } elseif ($children && 0 <= $cut) { + $cut += \count($children); + } + $cursor->skipChildren = false; + $dumper->leaveHash($cursor, $item->type, $item->class, $withChildren, $cut); + break; + + case Stub::TYPE_SCALAR: + $dumper->dumpScalar($cursor, 'default', $item->attr['value']); + break; + + default: + throw new \RuntimeException(\sprintf('Unexpected Stub type: "%s".', $item->type)); + } + } elseif ('array' === $type) { + $dumper->enterHash($cursor, Cursor::HASH_INDEXED, 0, false); + $dumper->leaveHash($cursor, Cursor::HASH_INDEXED, 0, false, 0); + } elseif ('string' === $type) { + $dumper->dumpString($cursor, $item, false, 0); + } else { + $dumper->dumpScalar($cursor, $type, $item); + } + } + + /** + * Dumps children of hash structures. + * + * @return int The final number of removed items + */ + private function dumpChildren(DumperInterface $dumper, Cursor $parentCursor, array &$refs, array $children, int $hashCut, int $hashType, bool $dumpKeys): int + { + $cursor = clone $parentCursor; + ++$cursor->depth; + $cursor->hashType = $hashType; + $cursor->hashIndex = 0; + $cursor->hashLength = \count($children); + $cursor->hashCut = $hashCut; + foreach ($children as $key => $child) { + $cursor->hashKeyIsBinary = isset($key[0]) && !preg_match('//u', $key); + $cursor->hashKey = $dumpKeys ? $key : null; + $this->dumpItem($dumper, $cursor, $refs, $child); + if (++$cursor->hashIndex === $this->maxItemsPerDepth || $cursor->stop) { + $parentCursor->stop = true; + + return $hashCut >= 0 ? $hashCut + $cursor->hashLength - $cursor->hashIndex : $hashCut; + } + } + + return $hashCut; + } + + private function getStub(mixed $item): mixed + { + if (!$item || !\is_array($item)) { + return $item; + } + + $stub = new Stub(); + $stub->type = Stub::TYPE_ARRAY; + foreach ($item as $stub->class => $stub->position) { + } + if (isset($item[0])) { + $stub->cut = $item[0]; + } + $stub->value = $stub->cut + ($stub->position ? \count($this->data[$stub->position]) : 0); + + return $stub; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Cloner/DumperInterface.php b/upLoadImage/vendor/symfony/var-dumper/Cloner/DumperInterface.php new file mode 100644 index 0000000..10f2da0 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Cloner/DumperInterface.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Cloner; + +/** + * DumperInterface used by Data objects. + * + * @author Nicolas Grekas + */ +interface DumperInterface +{ + /** + * Dumps a scalar value. + */ + public function dumpScalar(Cursor $cursor, string $type, string|int|float|bool|null $value): void; + + /** + * Dumps a string. + * + * @param string $str The string being dumped + * @param bool $bin Whether $str is UTF-8 or binary encoded + * @param int $cut The number of characters $str has been cut by + */ + public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut): void; + + /** + * Dumps while entering an hash. + * + * @param int $type A Cursor::HASH_* const for the type of hash + * @param string|int|null $class The object class, resource type or array count + * @param bool $hasChild When the dump of the hash has child item + */ + public function enterHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild): void; + + /** + * Dumps while leaving an hash. + * + * @param int $type A Cursor::HASH_* const for the type of hash + * @param string|int|null $class The object class, resource type or array count + * @param bool $hasChild When the dump of the hash has child item + * @param int $cut The number of items the hash has been cut by + */ + public function leaveHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild, int $cut): void; +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Cloner/Stub.php b/upLoadImage/vendor/symfony/var-dumper/Cloner/Stub.php new file mode 100644 index 0000000..18577f4 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Cloner/Stub.php @@ -0,0 +1,76 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Cloner; + +/** + * Represents the main properties of a PHP variable. + * + * @author Nicolas Grekas + */ +class Stub +{ + public const TYPE_REF = 1; + public const TYPE_STRING = 2; + public const TYPE_ARRAY = 3; + public const TYPE_OBJECT = 4; + public const TYPE_RESOURCE = 5; + public const TYPE_SCALAR = 6; + + public const STRING_BINARY = 1; + public const STRING_UTF8 = 2; + + public const ARRAY_ASSOC = 1; + public const ARRAY_INDEXED = 2; + + public int $type = self::TYPE_REF; + public string|int|null $class = ''; + public mixed $value = null; + public int $cut = 0; + public int $handle = 0; + public int $refCount = 0; + public int $position = 0; + public array $attr = []; + + /** + * @internal + */ + protected static array $propertyDefaults = []; + + public function __serialize(): array + { + static $noDefault = new \stdClass(); + + if (self::class === static::class) { + $data = []; + foreach ($this as $k => $v) { + $default = self::$propertyDefaults[$this::class][$k] ??= ($p = new \ReflectionProperty($this, $k))->hasDefaultValue() ? $p->getDefaultValue() : ($p->hasType() ? $noDefault : null); + if ($noDefault === $default || $default !== $v) { + $data[$k] = $v; + } + } + + return $data; + } + + return \Closure::bind(function () use ($noDefault) { + $data = []; + foreach ($this as $k => $v) { + $default = self::$propertyDefaults[$this::class][$k] ??= ($p = new \ReflectionProperty($this, $k))->hasDefaultValue() ? $p->getDefaultValue() : ($p->hasType() ? $noDefault : null); + if ($noDefault === $default || $default !== $v) { + $data[$k] = $v; + } + } + + return $data; + }, $this, $this::class)(); + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Cloner/VarCloner.php b/upLoadImage/vendor/symfony/var-dumper/Cloner/VarCloner.php new file mode 100644 index 0000000..6a7ec28 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Cloner/VarCloner.php @@ -0,0 +1,218 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Cloner; + +/** + * @author Nicolas Grekas + */ +class VarCloner extends AbstractCloner +{ + private static array $arrayCache = []; + + protected function doClone(mixed $var): array + { + $len = 1; // Length of $queue + $pos = 0; // Number of cloned items past the minimum depth + $refsCounter = 0; // Hard references counter + $queue = [[$var]]; // This breadth-first queue is the return value + $hardRefs = []; // Map of original zval ids to stub objects + $objRefs = []; // Map of original object handles to their stub object counterpart + $objects = []; // Keep a ref to objects to ensure their handle cannot be reused while cloning + $resRefs = []; // Map of original resource handles to their stub object counterpart + $maxItems = $this->maxItems; + $maxString = $this->maxString; + $minDepth = $this->minDepth; + $currentDepth = 0; // Current tree depth + $currentDepthFinalIndex = 0; // Final $queue index for current tree depth + $minimumDepthReached = 0 === $minDepth; // Becomes true when minimum tree depth has been reached + $a = null; // Array cast for nested structures + $stub = null; // Stub capturing the main properties of an original item value + // or null if the original value is used directly + + $arrayStub = new Stub(); + $arrayStub->type = Stub::TYPE_ARRAY; + + for ($i = 0; $i < $len; ++$i) { + // Detect when we move on to the next tree depth + if ($i > $currentDepthFinalIndex) { + ++$currentDepth; + $currentDepthFinalIndex = $len - 1; + if ($currentDepth >= $minDepth) { + $minimumDepthReached = true; + } + } + + $vals = $queue[$i]; + foreach ($vals as $k => $v) { + // $v is the original value or a stub object in case of hard references + + $zvalRef = ($r = \ReflectionReference::fromArrayElement($vals, $k)) ? $r->getId() : null; + + if ($zvalRef) { + $vals[$k] = &$stub; // Break hard references to make $queue completely + unset($stub); // independent from the original structure + if (null !== $vals[$k] = $hardRefs[$zvalRef] ?? null) { + $v = $vals[$k]; + if ($v->value instanceof Stub && (Stub::TYPE_OBJECT === $v->value->type || Stub::TYPE_RESOURCE === $v->value->type)) { + ++$v->value->refCount; + } + ++$v->refCount; + continue; + } + $vals[$k] = new Stub(); + $vals[$k]->value = $v; + $vals[$k]->handle = ++$refsCounter; + $hardRefs[$zvalRef] = $vals[$k]; + } + // Create $stub when the original value $v cannot be used directly + // If $v is a nested structure, put that structure in array $a + switch (true) { + case null === $v: + case \is_bool($v): + case \is_int($v): + case \is_float($v): + continue 2; + case \is_string($v): + if ('' === $v) { + continue 2; + } + if (!preg_match('//u', $v)) { + $stub = new Stub(); + $stub->type = Stub::TYPE_STRING; + $stub->class = Stub::STRING_BINARY; + if (0 <= $maxString && 0 < $cut = \strlen($v) - $maxString) { + $stub->cut = $cut; + $stub->value = substr($v, 0, -$cut); + } else { + $stub->value = $v; + } + } elseif (0 <= $maxString && isset($v[1 + ($maxString >> 2)]) && 0 < $cut = mb_strlen($v, 'UTF-8') - $maxString) { + $stub = new Stub(); + $stub->type = Stub::TYPE_STRING; + $stub->class = Stub::STRING_UTF8; + $stub->cut = $cut; + $stub->value = mb_substr($v, 0, $maxString, 'UTF-8'); + } else { + continue 2; + } + $a = null; + break; + + case \is_array($v): + if (!$v) { + continue 2; + } + $stub = $arrayStub; + + $stub->class = array_is_list($v) ? Stub::ARRAY_INDEXED : Stub::ARRAY_ASSOC; + $a = $v; + break; + + case \is_object($v): + if (empty($objRefs[$h = spl_object_id($v)])) { + $stub = new Stub(); + $stub->type = Stub::TYPE_OBJECT; + $stub->class = $v::class; + $stub->value = $v; + $stub->handle = $h; + $a = $this->castObject($stub, 0 < $i); + if ($v !== $stub->value) { + if (Stub::TYPE_OBJECT !== $stub->type || null === $stub->value) { + break; + } + $stub->handle = $h = spl_object_id($stub->value); + } + $stub->value = null; + if (0 <= $maxItems && $maxItems <= $pos && $minimumDepthReached) { + $stub->cut = \count($a); + $a = null; + } + } + if (empty($objRefs[$h])) { + $objRefs[$h] = $stub; + $objects[] = $v; + } else { + $stub = $objRefs[$h]; + ++$stub->refCount; + $a = null; + } + break; + + default: // resource + if (empty($resRefs[$h = (int) $v])) { + $stub = new Stub(); + $stub->type = Stub::TYPE_RESOURCE; + if ('Unknown' === $stub->class = @get_resource_type($v)) { + $stub->class = 'Closed'; + } + $stub->value = $v; + $stub->handle = $h; + $a = $this->castResource($stub, 0 < $i); + $stub->value = null; + if (0 <= $maxItems && $maxItems <= $pos && $minimumDepthReached) { + $stub->cut = \count($a); + $a = null; + } + } + if (empty($resRefs[$h])) { + $resRefs[$h] = $stub; + } else { + $stub = $resRefs[$h]; + ++$stub->refCount; + $a = null; + } + break; + } + + if ($a) { + if (!$minimumDepthReached || 0 > $maxItems) { + $queue[$len] = $a; + $stub->position = $len++; + } elseif ($pos < $maxItems) { + if ($maxItems < $pos += \count($a)) { + $a = \array_slice($a, 0, $maxItems - $pos, true); + if ($stub->cut >= 0) { + $stub->cut += $pos - $maxItems; + } + } + $queue[$len] = $a; + $stub->position = $len++; + } elseif ($stub->cut >= 0) { + $stub->cut += \count($a); + $stub->position = 0; + } + } + + if ($arrayStub === $stub) { + if ($arrayStub->cut) { + $stub = [$arrayStub->cut, $arrayStub->class => $arrayStub->position]; + $arrayStub->cut = 0; + } elseif (isset(self::$arrayCache[$arrayStub->class][$arrayStub->position])) { + $stub = self::$arrayCache[$arrayStub->class][$arrayStub->position]; + } else { + self::$arrayCache[$arrayStub->class][$arrayStub->position] = $stub = [$arrayStub->class => $arrayStub->position]; + } + } + + if (!$zvalRef) { + $vals[$k] = $stub; + } else { + $hardRefs[$zvalRef]->value = $stub; + } + } + + $queue[$i] = $vals; + } + + return $queue; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Command/Descriptor/CliDescriptor.php b/upLoadImage/vendor/symfony/var-dumper/Command/Descriptor/CliDescriptor.php new file mode 100644 index 0000000..24590fc --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Command/Descriptor/CliDescriptor.php @@ -0,0 +1,78 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Command\Descriptor; + +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\VarDumper\Cloner\Data; +use Symfony\Component\VarDumper\Dumper\CliDumper; + +/** + * Describe collected data clones for cli output. + * + * @author Maxime Steinhausser + * + * @final + */ +class CliDescriptor implements DumpDescriptorInterface +{ + private mixed $lastIdentifier = null; + + public function __construct( + private CliDumper $dumper, + ) { + } + + public function describe(OutputInterface $output, Data $data, array $context, int $clientId): void + { + $io = $output instanceof SymfonyStyle ? $output : new SymfonyStyle(new ArrayInput([]), $output); + $this->dumper->setColors($output->isDecorated()); + + $rows = [['date', date('r', (int) $context['timestamp'])]]; + $lastIdentifier = $this->lastIdentifier; + $this->lastIdentifier = $clientId; + + $section = "Received from client #$clientId"; + if (isset($context['request'])) { + $request = $context['request']; + $this->lastIdentifier = $request['identifier']; + $section = \sprintf('%s %s', $request['method'], $request['uri']); + if ($controller = $request['controller']) { + $rows[] = ['controller', rtrim($this->dumper->dump($controller, true), "\n")]; + } + } elseif (isset($context['cli'])) { + $this->lastIdentifier = $context['cli']['identifier']; + $section = '$ '.$context['cli']['command_line']; + } + + if ($this->lastIdentifier !== $lastIdentifier) { + $io->section($section); + } + + if (isset($context['source'])) { + $source = $context['source']; + $sourceInfo = \sprintf('%s on line %d', $source['name'], $source['line']); + if ($fileLink = $source['file_link'] ?? null) { + $sourceInfo = \sprintf('%s', $fileLink, $sourceInfo); + } + $rows[] = ['source', $sourceInfo]; + $file = $source['file_relative'] ?? $source['file']; + $rows[] = ['file', $file]; + } + + $io->table([], $rows); + + $this->dumper->dump($data); + $io->newLine(); + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Command/Descriptor/DumpDescriptorInterface.php b/upLoadImage/vendor/symfony/var-dumper/Command/Descriptor/DumpDescriptorInterface.php new file mode 100644 index 0000000..267d27b --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Command/Descriptor/DumpDescriptorInterface.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Command\Descriptor; + +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\VarDumper\Cloner\Data; + +/** + * @author Maxime Steinhausser + */ +interface DumpDescriptorInterface +{ + public function describe(OutputInterface $output, Data $data, array $context, int $clientId): void; +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Command/Descriptor/HtmlDescriptor.php b/upLoadImage/vendor/symfony/var-dumper/Command/Descriptor/HtmlDescriptor.php new file mode 100644 index 0000000..18f9f65 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Command/Descriptor/HtmlDescriptor.php @@ -0,0 +1,118 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Command\Descriptor; + +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\VarDumper\Cloner\Data; +use Symfony\Component\VarDumper\Dumper\HtmlDumper; + +/** + * Describe collected data clones for html output. + * + * @author Maxime Steinhausser + * + * @final + */ +class HtmlDescriptor implements DumpDescriptorInterface +{ + private bool $initialized = false; + + public function __construct( + private HtmlDumper $dumper, + ) { + } + + public function describe(OutputInterface $output, Data $data, array $context, int $clientId): void + { + if (!$this->initialized) { + $styles = file_get_contents(__DIR__.'/../../Resources/css/htmlDescriptor.css'); + $scripts = file_get_contents(__DIR__.'/../../Resources/js/htmlDescriptor.js'); + $output->writeln(""); + $this->initialized = true; + } + + $title = '-'; + if (isset($context['request'])) { + $request = $context['request']; + $controller = "{$this->dumper->dump($request['controller'], true, ['maxDepth' => 0])}"; + $title = \sprintf('%s %s', $request['method'], $uri = $request['uri'], $uri); + $dedupIdentifier = $request['identifier']; + } elseif (isset($context['cli'])) { + $title = '$ '.$context['cli']['command_line']; + $dedupIdentifier = $context['cli']['identifier']; + } else { + $dedupIdentifier = bin2hex(random_bytes(4)); + } + + $sourceDescription = ''; + if (isset($context['source'])) { + $source = $context['source']; + $projectDir = $source['project_dir'] ?? null; + $sourceDescription = \sprintf('%s on line %d', $source['name'], $source['line']); + if (isset($source['file_link'])) { + $sourceDescription = \sprintf('%s', $source['file_link'], $sourceDescription); + } + } + + $isoDate = $this->extractDate($context, 'c'); + $tags = array_filter([ + 'controller' => $controller ?? null, + 'project dir' => $projectDir ?? null, + ]); + + $output->writeln(<< +
+
+

$title

+ +
+ {$this->renderTags($tags)} +
+
+

+ $sourceDescription +

+ {$this->dumper->dump($data, true)} +
+ + HTML + ); + } + + private function extractDate(array $context, string $format = 'r'): string + { + return date($format, (int) $context['timestamp']); + } + + private function renderTags(array $tags): string + { + if (!$tags) { + return ''; + } + + $renderedTags = ''; + foreach ($tags as $key => $value) { + $renderedTags .= \sprintf('
  • %s%s
  • ', $key, $value); + } + + return << +
      + $renderedTags +
    + + HTML; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Command/ServerDumpCommand.php b/upLoadImage/vendor/symfony/var-dumper/Command/ServerDumpCommand.php new file mode 100644 index 0000000..424a7e6 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Command/ServerDumpCommand.php @@ -0,0 +1,111 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Command; + +use Symfony\Component\Console\Attribute\AsCommand; +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Completion\CompletionInput; +use Symfony\Component\Console\Completion\CompletionSuggestions; +use Symfony\Component\Console\Exception\InvalidArgumentException; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\VarDumper\Cloner\Data; +use Symfony\Component\VarDumper\Command\Descriptor\CliDescriptor; +use Symfony\Component\VarDumper\Command\Descriptor\DumpDescriptorInterface; +use Symfony\Component\VarDumper\Command\Descriptor\HtmlDescriptor; +use Symfony\Component\VarDumper\Dumper\CliDumper; +use Symfony\Component\VarDumper\Dumper\HtmlDumper; +use Symfony\Component\VarDumper\Server\DumpServer; + +/** + * Starts a dump server to collect and output dumps on a single place with multiple formats support. + * + * @author Maxime Steinhausser + * + * @final + */ +#[AsCommand(name: 'server:dump', description: 'Start a dump server that collects and displays dumps in a single place')] +class ServerDumpCommand extends Command +{ + /** @var DumpDescriptorInterface[] */ + private array $descriptors; + + public function __construct( + private DumpServer $server, + array $descriptors = [], + ) { + $this->descriptors = $descriptors + [ + 'cli' => new CliDescriptor(new CliDumper()), + 'html' => new HtmlDescriptor(new HtmlDumper()), + ]; + + parent::__construct(); + } + + protected function configure(): void + { + $this + ->addOption('format', null, InputOption::VALUE_REQUIRED, \sprintf('The output format (%s)', implode(', ', $this->getAvailableFormats())), 'cli') + ->setHelp(<<<'EOF' + %command.name% starts a dump server that collects and displays + dumps in a single place for debugging you application: + + php %command.full_name% + + You can consult dumped data in HTML format in your browser by providing the --format=html option + and redirecting the output to a file: + + php %command.full_name% --format="html" > dump.html + + EOF + ) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output): int + { + $io = new SymfonyStyle($input, $output); + $format = $input->getOption('format'); + + if (!$descriptor = $this->descriptors[$format] ?? null) { + throw new InvalidArgumentException(\sprintf('Unsupported format "%s".', $format)); + } + + $errorIo = $io->getErrorStyle(); + $errorIo->title('Symfony Var Dumper Server'); + + $this->server->start(); + + $errorIo->success(\sprintf('Server listening on %s', $this->server->getHost())); + $errorIo->comment('Quit the server with CONTROL-C.'); + + $this->server->listen(function (Data $data, array $context, int $clientId) use ($descriptor, $io) { + $descriptor->describe($io, $data, $context, $clientId); + }); + + return 0; + } + + public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void + { + if ($input->mustSuggestOptionValuesFor('format')) { + $suggestions->suggestValues($this->getAvailableFormats()); + } + } + + private function getAvailableFormats(): array + { + return array_keys($this->descriptors); + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Dumper/AbstractDumper.php b/upLoadImage/vendor/symfony/var-dumper/Dumper/AbstractDumper.php new file mode 100644 index 0000000..593a2c6 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Dumper/AbstractDumper.php @@ -0,0 +1,232 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Dumper; + +use Symfony\Component\VarDumper\Cloner\Data; +use Symfony\Component\VarDumper\Cloner\DumperInterface; + +/** + * Abstract mechanism for dumping a Data object. + * + * @author Nicolas Grekas + */ +abstract class AbstractDumper implements DataDumperInterface, DumperInterface +{ + public const DUMP_LIGHT_ARRAY = 1; + public const DUMP_STRING_LENGTH = 2; + public const DUMP_COMMA_SEPARATOR = 4; + public const DUMP_TRAILING_COMMA = 8; + + /** @var callable|resource|string|null */ + public static $defaultOutput = 'php://output'; + + protected string $line = ''; + /** @var callable|null */ + protected $lineDumper; + /** @var resource|null */ + protected $outputStream; + protected string $decimalPoint = '.'; + protected string $indentPad = ' '; + + private string $charset = ''; + + /** + * @param callable|resource|string|null $output A line dumper callable, an opened stream or an output path, defaults to static::$defaultOutput + * @param string|null $charset The default character encoding to use for non-UTF8 strings + * @param int $flags A bit field of static::DUMP_* constants to fine tune dumps representation + */ + public function __construct( + $output = null, + ?string $charset = null, + protected int $flags = 0, + ) { + $this->setCharset($charset ?: \ini_get('php.output_encoding') ?: \ini_get('default_charset') ?: 'UTF-8'); + $this->setOutput($output ?: static::$defaultOutput); + if (!$output && \is_string(static::$defaultOutput)) { + static::$defaultOutput = $this->outputStream; + } + } + + /** + * Sets the output destination of the dumps. + * + * @param callable|resource|string|null $output A line dumper callable, an opened stream or an output path + * + * @return callable|resource|string|null The previous output destination + */ + public function setOutput($output) + { + $prev = $this->outputStream ?? $this->lineDumper; + + if (\is_callable($output)) { + $this->outputStream = null; + $this->lineDumper = $output; + } else { + if (\is_string($output)) { + $output = fopen($output, 'w'); + } + $this->outputStream = $output; + $this->lineDumper = $this->echoLine(...); + } + + return $prev; + } + + /** + * Sets the default character encoding to use for non-UTF8 strings. + * + * @return string The previous charset + */ + public function setCharset(string $charset): string + { + $prev = $this->charset; + + $charset = strtoupper($charset); + $charset = 'UTF-8' === $charset || 'UTF8' === $charset ? 'CP1252' : $charset; + + $this->charset = $charset; + + return $prev; + } + + /** + * Sets the indentation pad string. + * + * @param string $pad A string that will be prepended to dumped lines, repeated by nesting level + * + * @return string The previous indent pad + */ + public function setIndentPad(string $pad): string + { + $prev = $this->indentPad; + $this->indentPad = $pad; + + return $prev; + } + + /** + * Dumps a Data object. + * + * @param callable|resource|string|true|null $output A line dumper callable, an opened stream, an output path or true to return the dump + * + * @return string|null The dump as string when $output is true + */ + public function dump(Data $data, $output = null): ?string + { + if ($locale = $this->flags & (self::DUMP_COMMA_SEPARATOR | self::DUMP_TRAILING_COMMA) ? setlocale(\LC_NUMERIC, 0) : null) { + setlocale(\LC_NUMERIC, 'C'); + } + + if ($returnDump = true === $output) { + $output = fopen('php://memory', 'r+'); + } + if ($output) { + $prevOutput = $this->setOutput($output); + } + try { + $data->dump($this); + $this->dumpLine(-1); + + if ($returnDump) { + $result = stream_get_contents($output, -1, 0); + fclose($output); + + return $result; + } + } finally { + if ($output) { + $this->setOutput($prevOutput); + } + if ($locale) { + setlocale(\LC_NUMERIC, $locale); + } + } + + return null; + } + + /** + * Dumps the current line. + * + * @param int $depth The recursive depth in the dumped structure for the line being dumped, + * or -1 to signal the end-of-dump to the line dumper callable + */ + protected function dumpLine(int $depth): void + { + ($this->lineDumper)($this->line, $depth, $this->indentPad); + $this->line = ''; + } + + /** + * Generic line dumper callback. + */ + protected function echoLine(string $line, int $depth, string $indentPad): void + { + if (-1 !== $depth) { + fwrite($this->outputStream, str_repeat($indentPad, $depth).$line."\n"); + } + } + + /** + * Converts a non-UTF-8 string to UTF-8. + */ + protected function utf8Encode(?string $s): ?string + { + if (null === $s || preg_match('//u', $s)) { + return $s; + } + + if (\function_exists('iconv')) { + if (false !== $c = @iconv($this->charset, 'UTF-8', $s)) { + return $c; + } + if ('CP1252' !== $this->charset && false !== $c = @iconv('CP1252', 'UTF-8', $s)) { + return $c; + } + } + + $s .= $s; + $len = \strlen($s); + $mapCp1252 = false; + + for ($i = $len >> 1, $j = 0; $i < $len; ++$i, ++$j) { + if ($s[$i] < "\x80") { + $s[$j] = $s[$i]; + } elseif ($s[$i] < "\xC0") { + $s[$j] = "\xC2"; + $s[++$j] = $s[$i]; + if ($s[$i] < "\xA0") { + $mapCp1252 = true; + } + } else { + $s[$j] = "\xC3"; + $s[++$j] = \chr(\ord($s[$i]) - 64); + } + } + + $s = substr($s, 0, $j); + + if (!$mapCp1252) { + return $s; + } + + return strtr($s, [ + "\xC2\x80" => '€', "\xC2\x82" => '‚', "\xC2\x83" => 'ƒ', "\xC2\x84" => '„', + "\xC2\x85" => '…', "\xC2\x86" => '†', "\xC2\x87" => '‡', "\xC2\x88" => 'ˆ', + "\xC2\x89" => '‰', "\xC2\x8A" => 'Š', "\xC2\x8B" => '‹', "\xC2\x8C" => 'Œ', + "\xC2\x8D" => 'Ž', "\xC2\x91" => '‘', "\xC2\x92" => '’', "\xC2\x93" => '“', + "\xC2\x94" => '”', "\xC2\x95" => '•', "\xC2\x96" => '–', "\xC2\x97" => '—', + "\xC2\x98" => '˜', "\xC2\x99" => '™', "\xC2\x9A" => 'š', "\xC2\x9B" => '›', + "\xC2\x9C" => 'œ', "\xC2\x9E" => 'ž', + ]); + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Dumper/CliDumper.php b/upLoadImage/vendor/symfony/var-dumper/Dumper/CliDumper.php new file mode 100644 index 0000000..c6dd88c --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Dumper/CliDumper.php @@ -0,0 +1,667 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Dumper; + +use Symfony\Component\ErrorHandler\ErrorRenderer\FileLinkFormatter; +use Symfony\Component\VarDumper\Cloner\Cursor; +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * CliDumper dumps variables for command line output. + * + * @author Nicolas Grekas + */ +class CliDumper extends AbstractDumper +{ + public static bool $defaultColors; + /** @var callable|resource|string|null */ + public static $defaultOutput = 'php://stdout'; + + protected bool $colors; + protected int $maxStringWidth = 0; + protected array $styles = [ + // See http://en.wikipedia.org/wiki/ANSI_escape_code#graphics + 'default' => '0;38;5;208', + 'num' => '1;38;5;38', + 'const' => '1;38;5;208', + 'virtual' => '3', + 'str' => '1;38;5;113', + 'note' => '38;5;38', + 'ref' => '38;5;247', + 'public' => '39', + 'protected' => '39', + 'private' => '39', + 'meta' => '38;5;170', + 'key' => '38;5;113', + 'index' => '38;5;38', + ]; + + protected static string $controlCharsRx = '/[\x00-\x1F\x7F]+/'; + protected static array $controlCharsMap = [ + "\t" => '\t', + "\n" => '\n', + "\v" => '\v', + "\f" => '\f', + "\r" => '\r', + "\033" => '\e', + ]; + protected static string $unicodeCharsRx = "/[\u{00A0}\u{00AD}\u{034F}\u{061C}\u{115F}\u{1160}\u{17B4}\u{17B5}\u{180E}\u{2000}-\u{200F}\u{202F}\u{205F}\u{2060}-\u{2064}\u{206A}-\u{206F}\u{3000}\u{2800}\u{3164}\u{FEFF}\u{FFA0}\u{1D159}\u{1D173}-\u{1D17A}]/u"; + + protected bool $collapseNextHash = false; + protected bool $expandNextHash = false; + + private array $displayOptions = [ + 'fileLinkFormat' => null, + ]; + + private bool $handlesHrefGracefully; + + public function __construct($output = null, ?string $charset = null, int $flags = 0) + { + parent::__construct($output, $charset, $flags); + + if ('\\' === \DIRECTORY_SEPARATOR && !$this->isWindowsTrueColor()) { + // Use only the base 16 xterm colors when using ANSICON or standard Windows 10 CLI + $this->setStyles([ + 'default' => '31', + 'num' => '1;34', + 'const' => '1;31', + 'str' => '1;32', + 'note' => '34', + 'ref' => '1;30', + 'meta' => '35', + 'key' => '32', + 'index' => '34', + ]); + } + + $this->displayOptions['fileLinkFormat'] = class_exists(FileLinkFormatter::class) ? new FileLinkFormatter() : (\ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format') ?: 'file://%f#L%l'); + } + + /** + * Enables/disables colored output. + */ + public function setColors(bool $colors): void + { + $this->colors = $colors; + } + + /** + * Sets the maximum number of characters per line for dumped strings. + */ + public function setMaxStringWidth(int $maxStringWidth): void + { + $this->maxStringWidth = $maxStringWidth; + } + + /** + * Configures styles. + * + * @param array $styles A map of style names to style definitions + */ + public function setStyles(array $styles): void + { + $this->styles = $styles + $this->styles; + } + + /** + * Configures display options. + * + * @param array $displayOptions A map of display options to customize the behavior + */ + public function setDisplayOptions(array $displayOptions): void + { + $this->displayOptions = $displayOptions + $this->displayOptions; + } + + public function dumpScalar(Cursor $cursor, string $type, string|int|float|bool|null $value): void + { + $this->dumpKey($cursor); + $this->collapseNextHash = $this->expandNextHash = false; + + $style = 'const'; + $attr = $cursor->attr; + + switch ($type) { + case 'default': + $style = 'default'; + break; + + case 'label': + $this->styles += ['label' => $this->styles['default']]; + $style = 'label'; + break; + + case 'integer': + $style = 'num'; + + if (isset($this->styles['integer'])) { + $style = 'integer'; + } + + break; + + case 'double': + $style = 'num'; + + if (isset($this->styles['float'])) { + $style = 'float'; + } + + $value = match (true) { + \INF === $value => 'INF', + -\INF === $value => '-INF', + is_nan($value) => 'NAN', + default => !str_contains($value = (string) $value, $this->decimalPoint) ? $value .= $this->decimalPoint.'0' : $value, + }; + break; + + case 'NULL': + $value = 'null'; + break; + + case 'boolean': + $value = $value ? 'true' : 'false'; + break; + + default: + $attr += ['value' => $this->utf8Encode($value)]; + $value = $this->utf8Encode($type); + break; + } + + $this->line .= $this->style($style, $value, $attr); + + $this->endValue($cursor); + } + + public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut): void + { + $this->dumpKey($cursor); + $this->collapseNextHash = $this->expandNextHash = false; + $attr = $cursor->attr; + + if ($bin) { + $str = $this->utf8Encode($str); + } + if ('' === $str) { + $this->line .= '""'; + if ($cut) { + $this->line .= '…'.$cut; + } + $this->endValue($cursor); + } else { + $attr += [ + 'length' => 0 <= $cut ? mb_strlen($str, 'UTF-8') + $cut : 0, + 'binary' => $bin, + ]; + $str = $bin && str_contains($str, "\0") ? [$str] : explode("\n", $str); + if (isset($str[1]) && !isset($str[2]) && !isset($str[1][0])) { + unset($str[1]); + $str[0] .= "\n"; + } + $m = \count($str) - 1; + $i = $lineCut = 0; + + if (self::DUMP_STRING_LENGTH & $this->flags) { + $this->line .= '('.$attr['length'].') '; + } + if ($bin) { + $this->line .= 'b'; + } + + if ($m) { + $this->line .= '"""'; + $this->dumpLine($cursor->depth); + } else { + $this->line .= '"'; + } + + foreach ($str as $str) { + if ($i < $m) { + $str .= "\n"; + } + if (0 < $this->maxStringWidth && $this->maxStringWidth < $len = mb_strlen($str, 'UTF-8')) { + $str = mb_substr($str, 0, $this->maxStringWidth, 'UTF-8'); + $lineCut = $len - $this->maxStringWidth; + } + if ($m && 0 < $cursor->depth) { + $this->line .= $this->indentPad; + } + if ('' !== $str) { + $this->line .= $this->style('str', $str, $attr); + } + if ($i++ == $m) { + if ($m) { + if ('' !== $str) { + $this->dumpLine($cursor->depth); + if (0 < $cursor->depth) { + $this->line .= $this->indentPad; + } + } + $this->line .= '"""'; + } else { + $this->line .= '"'; + } + if ($cut < 0) { + $this->line .= '…'; + $lineCut = 0; + } elseif ($cut) { + $lineCut += $cut; + } + } + if ($lineCut) { + $this->line .= '…'.$lineCut; + $lineCut = 0; + } + + if ($i > $m) { + $this->endValue($cursor); + } else { + $this->dumpLine($cursor->depth); + } + } + } + } + + public function enterHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild): void + { + $this->colors ??= $this->supportsColors(); + + $this->dumpKey($cursor); + $this->expandNextHash = false; + $attr = $cursor->attr; + + if ($this->collapseNextHash) { + $cursor->skipChildren = true; + $this->collapseNextHash = $hasChild = false; + } + + $class = $this->utf8Encode($class); + if (Cursor::HASH_OBJECT === $type) { + $prefix = $class && 'stdClass' !== $class ? $this->style('note', $class, $attr).(empty($attr['cut_hash']) ? ' {' : '') : '{'; + } elseif (Cursor::HASH_RESOURCE === $type) { + $prefix = $this->style('note', $class.' resource', $attr).($hasChild ? ' {' : ' '); + } else { + $prefix = $class && !(self::DUMP_LIGHT_ARRAY & $this->flags) ? $this->style('note', 'array:'.$class).' [' : '['; + } + + if (($cursor->softRefCount || 0 < $cursor->softRefHandle) && empty($attr['cut_hash'])) { + $prefix .= $this->style('ref', (Cursor::HASH_RESOURCE === $type ? '@' : '#').(0 < $cursor->softRefHandle ? $cursor->softRefHandle : $cursor->softRefTo), ['count' => $cursor->softRefCount]); + } elseif ($cursor->hardRefTo && !$cursor->refIndex && $class) { + $prefix .= $this->style('ref', '&'.$cursor->hardRefTo, ['count' => $cursor->hardRefCount]); + } elseif (!$hasChild && Cursor::HASH_RESOURCE === $type) { + $prefix = substr($prefix, 0, -1); + } + + $this->line .= $prefix; + + if ($hasChild) { + $this->dumpLine($cursor->depth); + } + } + + public function leaveHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild, int $cut): void + { + if (empty($cursor->attr['cut_hash'])) { + $this->dumpEllipsis($cursor, $hasChild, $cut); + $this->line .= Cursor::HASH_OBJECT === $type ? '}' : (Cursor::HASH_RESOURCE !== $type ? ']' : ($hasChild ? '}' : '')); + } + + $this->endValue($cursor); + } + + /** + * Dumps an ellipsis for cut children. + * + * @param bool $hasChild When the dump of the hash has child item + * @param int $cut The number of items the hash has been cut by + */ + protected function dumpEllipsis(Cursor $cursor, bool $hasChild, int $cut): void + { + if ($cut) { + $this->line .= ' …'; + if (0 < $cut) { + $this->line .= $cut; + } + if ($hasChild) { + $this->dumpLine($cursor->depth + 1); + } + } + } + + /** + * Dumps a key in a hash structure. + */ + protected function dumpKey(Cursor $cursor): void + { + if (null !== $key = $cursor->hashKey) { + if ($cursor->hashKeyIsBinary) { + $key = $this->utf8Encode($key); + } + $attr = [ + 'binary' => $cursor->hashKeyIsBinary, + 'virtual' => $cursor->attr['virtual'] ?? false, + ]; + $bin = $cursor->hashKeyIsBinary ? 'b' : ''; + $style = 'key'; + switch ($cursor->hashType) { + default: + case Cursor::HASH_INDEXED: + if (self::DUMP_LIGHT_ARRAY & $this->flags) { + break; + } + $style = 'index'; + // no break + case Cursor::HASH_ASSOC: + if (\is_int($key)) { + $this->line .= $this->style($style, $key).' => '; + } else { + $this->line .= $bin.'"'.$this->style($style, $key).'" => '; + } + break; + + case Cursor::HASH_RESOURCE: + $key = "\0~\0".$key; + // no break + case Cursor::HASH_OBJECT: + if (!isset($key[0]) || "\0" !== $key[0]) { + $this->line .= '+'.$bin.$this->style('public', $key, $attr).': '; + } elseif (0 < strpos($key, "\0", 1)) { + $key = explode("\0", substr($key, 1), 2); + + switch ($key[0][0]) { + case '+': // User inserted keys + $attr['dynamic'] = true; + $this->line .= '+'.$bin.'"'.$this->style('public', $key[1], $attr).'": '; + break 2; + case '~': + $style = 'meta'; + if (isset($key[0][1])) { + parse_str(substr($key[0], 1), $attr); + $attr += ['binary' => $cursor->hashKeyIsBinary]; + } + break; + case '*': + $style = 'protected'; + $bin = '#'.$bin; + break; + default: + $attr['class'] = $key[0]; + $style = 'private'; + $bin = '-'.$bin; + break; + } + + if (isset($attr['collapse'])) { + if ($attr['collapse']) { + $this->collapseNextHash = true; + } else { + $this->expandNextHash = true; + } + } + + $this->line .= $bin.$this->style($style, $key[1], $attr).($attr['separator'] ?? ': '); + } else { + // This case should not happen + $this->line .= '-'.$bin.'"'.$this->style('private', $key, ['class' => '']).'": '; + } + break; + } + + if ($cursor->hardRefTo) { + $this->line .= $this->style('ref', '&'.($cursor->hardRefCount ? $cursor->hardRefTo : ''), ['count' => $cursor->hardRefCount]).' '; + } + } + } + + /** + * Decorates a value with some style. + * + * @param string $style The type of style being applied + * @param string $value The value being styled + * @param array $attr Optional context information + */ + protected function style(string $style, string $value, array $attr = []): string + { + $this->colors ??= $this->supportsColors(); + + $this->handlesHrefGracefully ??= 'JetBrains-JediTerm' !== getenv('TERMINAL_EMULATOR') + && (!getenv('KONSOLE_VERSION') || (int) getenv('KONSOLE_VERSION') > 201100) + && !isset($_SERVER['IDEA_INITIAL_DIRECTORY']); + + if (isset($attr['ellipsis'], $attr['ellipsis-type'])) { + $prefix = substr($value, 0, -$attr['ellipsis']); + if ('cli' === \PHP_SAPI && 'path' === $attr['ellipsis-type'] && isset($_SERVER[$pwd = '\\' === \DIRECTORY_SEPARATOR ? 'CD' : 'PWD']) && str_starts_with($prefix, $_SERVER[$pwd])) { + $prefix = '.'.substr($prefix, \strlen($_SERVER[$pwd])); + } + if (!empty($attr['ellipsis-tail'])) { + $prefix .= substr($value, -$attr['ellipsis'], $attr['ellipsis-tail']); + $value = substr($value, -$attr['ellipsis'] + $attr['ellipsis-tail']); + } else { + $value = substr($value, -$attr['ellipsis']); + } + + $value = $this->style('default', $prefix).$this->style($style, $value); + + goto href; + } + + $map = static::$controlCharsMap; + $startCchr = $this->colors ? "\033[m\033[{$this->styles['default']}m" : ''; + $endCchr = $this->colors ? "\033[m\033[{$this->styles[$style]}m" : ''; + $value = preg_replace_callback(static::$controlCharsRx, function ($c) use ($map, $startCchr, $endCchr) { + $s = $startCchr; + $c = $c[$i = 0]; + do { + $s .= $map[$c[$i]] ?? \sprintf('\x%02X', \ord($c[$i])); + } while (isset($c[++$i])); + + return $s.$endCchr; + }, $value, -1, $cchrCount); + + if (!($attr['binary'] ?? false)) { + $value = preg_replace_callback(static::$unicodeCharsRx, function ($c) use (&$cchrCount, $startCchr, $endCchr) { + ++$cchrCount; + + return $startCchr.'\u{'.strtoupper(dechex(mb_ord($c[0]))).'}'.$endCchr; + }, $value); + } + + if ($this->colors && '' !== $value) { + if ($cchrCount && "\033" === $value[0]) { + $value = substr($value, \strlen($startCchr)); + } else { + $value = "\033[{$this->styles[$style]}m".$value; + } + if ($cchrCount && str_ends_with($value, $endCchr)) { + $value = substr($value, 0, -\strlen($endCchr)); + } else { + $value .= "\033[{$this->styles['default']}m"; + } + } + + href: + if ($this->colors && $this->handlesHrefGracefully) { + if (isset($attr['file']) && $href = $this->getSourceLink($attr['file'], $attr['line'] ?? 0)) { + if ('note' === $style) { + $value .= "\033]8;;{$href}\033\\^\033]8;;\033\\"; + } else { + $attr['href'] = $href; + } + } + if (isset($attr['href'])) { + if ('label' === $style) { + $value .= '^'; + } + $value = "\033]8;;{$attr['href']}\033\\{$value}\033]8;;\033\\"; + } + } + + if ('label' === $style && '' !== $value) { + $value .= ' '; + } + if ($this->colors && ($attr['virtual'] ?? false)) { + $value = "\033[{$this->styles['virtual']}m".$value; + } + + return $value; + } + + protected function supportsColors(): bool + { + if ($this->outputStream !== static::$defaultOutput) { + return $this->hasColorSupport($this->outputStream); + } + if (isset(static::$defaultColors)) { + return static::$defaultColors; + } + if (isset($_SERVER['argv'][1])) { + $colors = $_SERVER['argv']; + $i = \count($colors); + while (--$i > 0) { + if (isset($colors[$i][5])) { + switch ($colors[$i]) { + case '--ansi': + case '--color': + case '--color=yes': + case '--color=force': + case '--color=always': + case '--colors=always': + return static::$defaultColors = true; + + case '--no-ansi': + case '--color=no': + case '--color=none': + case '--color=never': + case '--colors=never': + return static::$defaultColors = false; + } + } + } + } + + $h = stream_get_meta_data($this->outputStream) + ['wrapper_type' => null]; + $h = 'Output' === $h['stream_type'] && 'PHP' === $h['wrapper_type'] ? fopen('php://stdout', 'w') : $this->outputStream; + + return static::$defaultColors = $this->hasColorSupport($h); + } + + protected function dumpLine(int $depth, bool $endOfValue = false): void + { + if ($this->colors ??= $this->supportsColors()) { + $this->line = \sprintf("\033[%sm%s\033[m", $this->styles['default'], $this->line); + } + parent::dumpLine($depth); + } + + protected function endValue(Cursor $cursor): void + { + if (-1 === $cursor->hashType) { + return; + } + + if (Stub::ARRAY_INDEXED === $cursor->hashType || Stub::ARRAY_ASSOC === $cursor->hashType) { + if (self::DUMP_TRAILING_COMMA & $this->flags && 0 < $cursor->depth) { + $this->line .= ','; + } elseif (self::DUMP_COMMA_SEPARATOR & $this->flags && 1 < $cursor->hashLength - $cursor->hashIndex) { + $this->line .= ','; + } + } + + $this->dumpLine($cursor->depth, true); + } + + /** + * Returns true if the stream supports colorization. + * + * Reference: Composer\XdebugHandler\Process::supportsColor + * https://github.com/composer/xdebug-handler + */ + private function hasColorSupport(mixed $stream): bool + { + if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) { + return false; + } + + // Follow https://no-color.org/ + if ('' !== (($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR'))[0] ?? '')) { + return false; + } + + // Follow https://force-color.org/ + if ('' !== (($_SERVER['FORCE_COLOR'] ?? getenv('FORCE_COLOR'))[0] ?? '')) { + return true; + } + + // Detect msysgit/mingw and assume this is a tty because detection + // does not work correctly, see https://github.com/composer/composer/issues/9690 + if (!@stream_isatty($stream) && !\in_array(strtoupper((string) getenv('MSYSTEM')), ['MINGW32', 'MINGW64'], true)) { + return false; + } + + if ('\\' === \DIRECTORY_SEPARATOR && @sapi_windows_vt100_support($stream)) { + return true; + } + + if ('Hyper' === getenv('TERM_PROGRAM') + || false !== getenv('COLORTERM') + || false !== getenv('ANSICON') + || 'ON' === getenv('ConEmuANSI') + ) { + return true; + } + + if ('dumb' === $term = (string) getenv('TERM')) { + return false; + } + + // See https://github.com/chalk/supports-color/blob/d4f413efaf8da045c5ab440ed418ef02dbb28bf1/index.js#L157 + return preg_match('/^((screen|xterm|vt100|vt220|putty|rxvt|ansi|cygwin|linux).*)|(.*-256(color)?(-bce)?)$/', $term); + } + + /** + * Returns true if the Windows terminal supports true color. + * + * Note that this does not check an output stream, but relies on environment + * variables from known implementations, or a PHP and Windows version that + * supports true color. + */ + private function isWindowsTrueColor(): bool + { + $result = 183 <= getenv('ANSICON_VER') + || 'ON' === getenv('ConEmuANSI') + || 'xterm' === getenv('TERM') + || 'Hyper' === getenv('TERM_PROGRAM'); + + if (!$result) { + $version = \sprintf( + '%s.%s.%s', + PHP_WINDOWS_VERSION_MAJOR, + PHP_WINDOWS_VERSION_MINOR, + PHP_WINDOWS_VERSION_BUILD + ); + $result = $version >= '10.0.15063'; + } + + return $result; + } + + private function getSourceLink(string $file, int $line): string|false + { + if ($fmt = $this->displayOptions['fileLinkFormat']) { + return \is_string($fmt) ? strtr($fmt, ['%f' => $file, '%l' => $line]) : ($fmt->format($file, $line) ?: 'file://'.$file.'#L'.$line); + } + + return false; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Dumper/ContextProvider/CliContextProvider.php b/upLoadImage/vendor/symfony/var-dumper/Dumper/ContextProvider/CliContextProvider.php new file mode 100644 index 0000000..292b1a4 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Dumper/ContextProvider/CliContextProvider.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Dumper\ContextProvider; + +/** + * Tries to provide context on CLI. + * + * @author Maxime Steinhausser + */ +final class CliContextProvider implements ContextProviderInterface +{ + public function getContext(): ?array + { + if ('cli' !== \PHP_SAPI) { + return null; + } + + return [ + 'command_line' => $commandLine = implode(' ', $_SERVER['argv'] ?? []), + 'identifier' => hash('xxh128', $commandLine.'@'.$_SERVER['REQUEST_TIME_FLOAT']), + ]; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Dumper/ContextProvider/ContextProviderInterface.php b/upLoadImage/vendor/symfony/var-dumper/Dumper/ContextProvider/ContextProviderInterface.php new file mode 100644 index 0000000..532aa0f --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Dumper/ContextProvider/ContextProviderInterface.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Dumper\ContextProvider; + +/** + * Interface to provide contextual data about dump data clones sent to a server. + * + * @author Maxime Steinhausser + */ +interface ContextProviderInterface +{ + public function getContext(): ?array; +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Dumper/ContextProvider/RequestContextProvider.php b/upLoadImage/vendor/symfony/var-dumper/Dumper/ContextProvider/RequestContextProvider.php new file mode 100644 index 0000000..e3ee487 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Dumper/ContextProvider/RequestContextProvider.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Dumper\ContextProvider; + +use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\VarDumper\Caster\ReflectionCaster; +use Symfony\Component\VarDumper\Cloner\VarCloner; + +/** + * Tries to provide context from a request. + * + * @author Maxime Steinhausser + */ +final class RequestContextProvider implements ContextProviderInterface +{ + private VarCloner $cloner; + + public function __construct( + private RequestStack $requestStack, + ) { + $this->cloner = new VarCloner(); + $this->cloner->setMaxItems(0); + $this->cloner->addCasters(ReflectionCaster::UNSET_CLOSURE_FILE_INFO); + } + + public function getContext(): ?array + { + if (null === $request = $this->requestStack->getCurrentRequest()) { + return null; + } + + $controller = $request->attributes->get('_controller'); + + return [ + 'uri' => $request->getUri(), + 'method' => $request->getMethod(), + 'controller' => $controller ? $this->cloner->cloneVar($controller) : $controller, + 'identifier' => hash('xxh128', spl_object_id($request).'@'.$_SERVER['REQUEST_TIME_FLOAT']), + ]; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Dumper/ContextProvider/SourceContextProvider.php b/upLoadImage/vendor/symfony/var-dumper/Dumper/ContextProvider/SourceContextProvider.php new file mode 100644 index 0000000..01e730a --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Dumper/ContextProvider/SourceContextProvider.php @@ -0,0 +1,121 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Dumper\ContextProvider; + +use Symfony\Component\ErrorHandler\ErrorRenderer\FileLinkFormatter; +use Symfony\Component\VarDumper\Cloner\VarCloner; +use Symfony\Component\VarDumper\Dumper\HtmlDumper; +use Symfony\Component\VarDumper\VarDumper; +use Twig\Template; + +/** + * Tries to provide context from sources (class name, file, line, code excerpt, ...). + * + * @author Nicolas Grekas + * @author Maxime Steinhausser + */ +final class SourceContextProvider implements ContextProviderInterface +{ + public function __construct( + private ?string $charset = null, + private ?string $projectDir = null, + private ?FileLinkFormatter $fileLinkFormatter = null, + private int $limit = 9, + ) { + } + + public function getContext(): ?array + { + $trace = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS, $this->limit); + + $file = $trace[1]['file']; + $line = $trace[1]['line']; + $name = '-' === $file || 'Standard input code' === $file ? 'Standard input code' : false; + $fileExcerpt = false; + + for ($i = 2; $i < $this->limit; ++$i) { + if (isset($trace[$i]['class'], $trace[$i]['function']) + && 'dump' === $trace[$i]['function'] + && VarDumper::class === $trace[$i]['class'] + ) { + $file = $trace[$i]['file'] ?? $file; + $line = $trace[$i]['line'] ?? $line; + + while (++$i < $this->limit) { + if (isset($trace[$i]['function'], $trace[$i]['file']) && empty($trace[$i]['class']) && !str_starts_with($trace[$i]['function'], 'call_user_func')) { + $file = $trace[$i]['file']; + $line = $trace[$i]['line']; + + break; + } elseif (isset($trace[$i]['object']) && $trace[$i]['object'] instanceof Template) { + $template = $trace[$i]['object']; + $name = $template->getTemplateName(); + $src = method_exists($template, 'getSourceContext') ? $template->getSourceContext()->getCode() : (method_exists($template, 'getSource') ? $template->getSource() : false); + $info = $template->getDebugInfo(); + if (isset($info[$trace[$i - 1]['line']])) { + $line = $info[$trace[$i - 1]['line']]; + $file = method_exists($template, 'getSourceContext') ? $template->getSourceContext()->getPath() : null; + + if ($src) { + $src = explode("\n", $src); + $fileExcerpt = []; + + for ($i = max($line - 3, 1), $max = min($line + 3, \count($src)); $i <= $max; ++$i) { + $fileExcerpt[] = ''.$this->htmlEncode($src[$i - 1]).''; + } + + $fileExcerpt = '
      '.implode("\n", $fileExcerpt).'
    '; + } + } + break; + } + } + break; + } + } + + if (false === $name) { + $name = str_replace('\\', '/', $file); + $name = substr($name, strrpos($name, '/') + 1); + } + + $context = ['name' => $name, 'file' => $file, 'line' => $line]; + $context['file_excerpt'] = $fileExcerpt; + + if (null !== $this->projectDir) { + $context['project_dir'] = $this->projectDir; + if (str_starts_with($file, $this->projectDir)) { + $context['file_relative'] = ltrim(substr($file, \strlen($this->projectDir)), \DIRECTORY_SEPARATOR); + } + } + + if ($this->fileLinkFormatter && $fileLink = $this->fileLinkFormatter->format($context['file'], $context['line'])) { + $context['file_link'] = $fileLink; + } + + return $context; + } + + private function htmlEncode(string $s): string + { + $html = ''; + + $dumper = new HtmlDumper(function ($line) use (&$html) { $html .= $line; }, $this->charset); + $dumper->setDumpHeader(''); + $dumper->setDumpBoundaries('', ''); + + $cloner = new VarCloner(); + $dumper->dump($cloner->cloneVar($s)); + + return substr(strip_tags($html), 1, -1); + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Dumper/ContextualizedDumper.php b/upLoadImage/vendor/symfony/var-dumper/Dumper/ContextualizedDumper.php new file mode 100644 index 0000000..6102c47 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Dumper/ContextualizedDumper.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Dumper; + +use Symfony\Component\VarDumper\Cloner\Data; +use Symfony\Component\VarDumper\Dumper\ContextProvider\ContextProviderInterface; + +/** + * @author Kévin Thérage + */ +class ContextualizedDumper implements DataDumperInterface +{ + /** + * @param ContextProviderInterface[] $contextProviders + */ + public function __construct( + private DataDumperInterface $wrappedDumper, + private array $contextProviders, + ) { + } + + public function dump(Data $data): ?string + { + $context = $data->getContext(); + foreach ($this->contextProviders as $contextProvider) { + $context[$contextProvider::class] = $contextProvider->getContext(); + } + + return $this->wrappedDumper->dump($data->withContext($context)); + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Dumper/DataDumperInterface.php b/upLoadImage/vendor/symfony/var-dumper/Dumper/DataDumperInterface.php new file mode 100644 index 0000000..df05b6a --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Dumper/DataDumperInterface.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Dumper; + +use Symfony\Component\VarDumper\Cloner\Data; + +/** + * DataDumperInterface for dumping Data objects. + * + * @author Nicolas Grekas + */ +interface DataDumperInterface +{ + /** + * @return string|null + */ + public function dump(Data $data); +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Dumper/HtmlDumper.php b/upLoadImage/vendor/symfony/var-dumper/Dumper/HtmlDumper.php new file mode 100644 index 0000000..f391e04 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Dumper/HtmlDumper.php @@ -0,0 +1,980 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Dumper; + +use Symfony\Component\VarDumper\Cloner\Cursor; +use Symfony\Component\VarDumper\Cloner\Data; + +/** + * HtmlDumper dumps variables as HTML. + * + * @author Nicolas Grekas + */ +class HtmlDumper extends CliDumper +{ + /** @var callable|resource|string|null */ + public static $defaultOutput = 'php://output'; + + protected static $themes = [ + 'dark' => [ + 'default' => 'background-color:#18171B; color:#FF8400; line-height:1.2em; font:12px Menlo, Monaco, Consolas, monospace; word-wrap: break-word; white-space: pre-wrap; position:relative; z-index:99999; word-break: break-all', + 'num' => 'font-weight:bold; color:#1299DA', + 'const' => 'font-weight:bold', + 'virtual' => 'font-style:italic', + 'str' => 'font-weight:bold; color:#56DB3A', + 'note' => 'color:#1299DA', + 'ref' => 'color:#A0A0A0', + 'public' => 'color:#FFFFFF', + 'protected' => 'color:#FFFFFF', + 'private' => 'color:#FFFFFF', + 'meta' => 'color:#B729D9', + 'key' => 'color:#56DB3A', + 'index' => 'color:#1299DA', + 'ellipsis' => 'color:#FF8400', + 'ns' => 'user-select:none;', + ], + 'light' => [ + 'default' => 'background:none; color:#CC7832; line-height:1.2em; font:12px Menlo, Monaco, Consolas, monospace; word-wrap: break-word; white-space: pre-wrap; position:relative; z-index:99999; word-break: break-all', + 'num' => 'font-weight:bold; color:#1299DA', + 'const' => 'font-weight:bold', + 'virtual' => 'font-style:italic', + 'str' => 'font-weight:bold; color:#629755;', + 'note' => 'color:#6897BB', + 'ref' => 'color:#6E6E6E', + 'public' => 'color:#262626', + 'protected' => 'color:#262626', + 'private' => 'color:#262626', + 'meta' => 'color:#B729D9', + 'key' => 'color:#789339', + 'index' => 'color:#1299DA', + 'ellipsis' => 'color:#CC7832', + 'ns' => 'user-select:none;', + ], + ]; + + protected ?string $dumpHeader = null; + protected string $dumpPrefix = '
    ';
    +    protected string $dumpSuffix = '
    '; + protected string $dumpId; + protected bool $colors = true; + protected $headerIsDumped = false; + protected int $lastDepth = -1; + + private array $displayOptions = [ + 'maxDepth' => 1, + 'maxStringLength' => 160, + 'fileLinkFormat' => null, + ]; + private array $extraDisplayOptions = []; + + public function __construct($output = null, ?string $charset = null, int $flags = 0) + { + AbstractDumper::__construct($output, $charset, $flags); + $this->dumpId = 'sf-dump-'.mt_rand(); + $this->displayOptions['fileLinkFormat'] = \ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'); + $this->styles = static::$themes['dark'] ?? self::$themes['dark']; + } + + public function setStyles(array $styles): void + { + $this->headerIsDumped = false; + $this->styles = $styles + $this->styles; + } + + public function setTheme(string $themeName): void + { + if (!isset(static::$themes[$themeName])) { + throw new \InvalidArgumentException(\sprintf('Theme "%s" does not exist in class "%s".', $themeName, static::class)); + } + + $this->setStyles(static::$themes[$themeName]); + } + + /** + * Configures display options. + * + * @param array $displayOptions A map of display options to customize the behavior + */ + public function setDisplayOptions(array $displayOptions): void + { + $this->headerIsDumped = false; + $this->displayOptions = $displayOptions + $this->displayOptions; + } + + /** + * Sets an HTML header that will be dumped once in the output stream. + */ + public function setDumpHeader(?string $header): void + { + $this->dumpHeader = $header; + } + + /** + * Sets an HTML prefix and suffix that will encapse every single dump. + */ + public function setDumpBoundaries(string $prefix, string $suffix): void + { + $this->dumpPrefix = $prefix; + $this->dumpSuffix = $suffix; + } + + public function dump(Data $data, $output = null, array $extraDisplayOptions = []): ?string + { + $this->extraDisplayOptions = $extraDisplayOptions; + $result = parent::dump($data, $output); + $this->dumpId = 'sf-dump-'.mt_rand(); + + return $result; + } + + /** + * Dumps the HTML header. + */ + protected function getDumpHeader(): string + { + $this->headerIsDumped = $this->outputStream ?? $this->lineDumper; + + if (null !== $this->dumpHeader) { + return $this->dumpHeader; + } + + $line = str_replace('{$options}', json_encode($this->displayOptions, \JSON_FORCE_OBJECT), <<<'EOHTML' + '.$this->dumpHeader; + } + + public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut): void + { + if ('' === $str && isset($cursor->attr['img-data'], $cursor->attr['content-type'])) { + $this->dumpKey($cursor); + $this->line .= $this->style('default', $cursor->attr['img-size'] ?? '', []); + $this->line .= $cursor->depth >= $this->displayOptions['maxDepth'] ? ' ' : ' '; + $this->endValue($cursor); + $this->line .= $this->indentPad; + $this->line .= \sprintf('', $cursor->attr['content-type'], base64_encode($cursor->attr['img-data'])); + $this->endValue($cursor); + } else { + parent::dumpString($cursor, $str, $bin, $cut); + } + } + + public function enterHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild): void + { + if (Cursor::HASH_OBJECT === $type) { + $cursor->attr['depth'] = $cursor->depth; + } + parent::enterHash($cursor, $type, $class, false); + + if ($cursor->skipChildren || $cursor->depth >= $this->displayOptions['maxDepth']) { + $cursor->skipChildren = false; + $eol = ' class=sf-dump-compact>'; + } else { + $this->expandNextHash = false; + $eol = ' class=sf-dump-expanded>'; + } + + if ($hasChild) { + $this->line .= 'dumpId, $r); + } + $this->line .= $eol; + $this->dumpLine($cursor->depth); + } + } + + public function leaveHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild, int $cut): void + { + $this->dumpEllipsis($cursor, $hasChild, $cut); + if ($hasChild) { + $this->line .= ''; + } + parent::leaveHash($cursor, $type, $class, $hasChild, 0); + } + + protected function style(string $style, string $value, array $attr = []): string + { + if ('' === $value && ('label' !== $style || !isset($attr['file']) && !isset($attr['href']))) { + return ''; + } + + $v = esc($value); + + if ('ref' === $style) { + if (empty($attr['count'])) { + return \sprintf('%s', $v); + } + $r = ('#' !== $v[0] ? 1 - ('@' !== $v[0]) : 2).substr($value, 1); + + return \sprintf('%s', $this->dumpId, $r, 1 + $attr['count'], $v); + } + + $dumpClasses = ['sf-dump-'.$style]; + $dumpTitle = ''; + + if ('const' === $style && isset($attr['value'])) { + $dumpTitle = esc(\is_scalar($attr['value']) ? $attr['value'] : json_encode($attr['value'])); + } elseif ('public' === $style) { + $dumpTitle = empty($attr['dynamic']) ? 'Public property' : 'Runtime added dynamic property'; + } elseif ('str' === $style && 1 < $attr['length']) { + $dumpTitle = \sprintf('%d%s characters', $attr['length'], $attr['binary'] ? ' binary or non-UTF-8' : ''); + } elseif ('note' === $style && 0 < ($attr['depth'] ?? 0) && false !== $c = strrpos($value, '\\')) { + $attr += [ + 'ellipsis' => \strlen($value) - $c, + 'ellipsis-type' => 'note', + 'ellipsis-tail' => 1, + ]; + } elseif ('protected' === $style) { + $dumpTitle = 'Protected property'; + } elseif ('meta' === $style && isset($attr['title'])) { + $dumpTitle = esc($this->utf8Encode($attr['title'])); + } elseif ('private' === $style) { + $dumpTitle = \sprintf('Private property defined in class: `%s`', esc($this->utf8Encode($attr['class']))); + } + + if (isset($attr['ellipsis'])) { + $dumpClasses[] = 'sf-dump-ellipsization'; + $ellipsisClass = 'sf-dump-ellipsis'; + if (isset($attr['ellipsis-type'])) { + $ellipsisClass .= ' sf-dump-ellipsis-'.$attr['ellipsis-type']; + } + $label = esc(substr($value, -$attr['ellipsis'])); + $dumpTitle = $v."\n".$dumpTitle; + $v = \sprintf('%s', $ellipsisClass, substr($v, 0, -\strlen($label))); + + if (!empty($attr['ellipsis-tail'])) { + $tail = \strlen(esc(substr($value, -$attr['ellipsis'], $attr['ellipsis-tail']))); + $v .= \sprintf('%s%s', $ellipsisClass, substr($label, 0, $tail), substr($label, $tail)); + } else { + $v .= \sprintf('%s', $label); + } + } + + $map = static::$controlCharsMap; + $v = \sprintf( + '%s', + 1 === \count($dumpClasses) ? '' : '"', + implode(' ', $dumpClasses), + $dumpTitle ? ' title="'.$dumpTitle.'"' : '', + preg_replace_callback(static::$controlCharsRx, function ($c) use ($map) { + $s = $b = ''; + }, $v) + ); + + if (!($attr['binary'] ?? false)) { + $v = preg_replace_callback(static::$unicodeCharsRx, function ($c) { + return '\u{'.strtoupper(dechex(mb_ord($c[0]))).'}'; + }, $v); + } + + if (isset($attr['file']) && $href = $this->getSourceLink($attr['file'], $attr['line'] ?? 0)) { + $attr['href'] = $href; + } + if (isset($attr['href'])) { + if ('label' === $style) { + $v .= '^'; + } + $target = isset($attr['file']) ? '' : ' target="_blank"'; + $v = \sprintf('%s', esc($this->utf8Encode($attr['href'])), $target, $v); + } + if (isset($attr['lang'])) { + $v = \sprintf('%s', esc($attr['lang']), $v); + } + if ('label' === $style) { + $v .= ' '; + } + if ($attr['virtual'] ?? false) { + $v = ''.$v.''; + } + + return $v; + } + + protected function dumpLine(int $depth, bool $endOfValue = false): void + { + if (-1 === $this->lastDepth) { + $this->line = \sprintf($this->dumpPrefix, $this->dumpId, $this->indentPad).$this->line; + } + if ($this->headerIsDumped !== ($this->outputStream ?? $this->lineDumper)) { + $this->line = $this->getDumpHeader().$this->line; + } + + if (-1 === $depth) { + $args = ['"'.$this->dumpId.'"']; + if ($this->extraDisplayOptions) { + $args[] = json_encode($this->extraDisplayOptions, \JSON_FORCE_OBJECT); + } + // Replace is for BC + $this->line .= \sprintf(str_replace('"%s"', '%s', $this->dumpSuffix), implode(', ', $args)); + } + $this->lastDepth = $depth; + + $this->line = mb_encode_numericentity($this->line, [0x80, 0x10FFFF, 0, 0x1FFFFF], 'UTF-8'); + + if (-1 === $depth) { + AbstractDumper::dumpLine(0); + } + AbstractDumper::dumpLine($depth); + } + + private function getSourceLink(string $file, int $line): string|false + { + $options = $this->extraDisplayOptions + $this->displayOptions; + + if ($fmt = $options['fileLinkFormat']) { + return \is_string($fmt) ? strtr($fmt, ['%f' => $file, '%l' => $line]) : $fmt->format($file, $line); + } + + return false; + } +} + +function esc(string $str): string +{ + return htmlspecialchars($str, \ENT_QUOTES, 'UTF-8'); +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Dumper/ServerDumper.php b/upLoadImage/vendor/symfony/var-dumper/Dumper/ServerDumper.php new file mode 100644 index 0000000..4602bcf --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Dumper/ServerDumper.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Dumper; + +use Symfony\Component\VarDumper\Cloner\Data; +use Symfony\Component\VarDumper\Dumper\ContextProvider\ContextProviderInterface; +use Symfony\Component\VarDumper\Server\Connection; + +/** + * ServerDumper forwards serialized Data clones to a server. + * + * @author Maxime Steinhausser + */ +class ServerDumper implements DataDumperInterface +{ + private Connection $connection; + + /** + * @param string $host The server host + * @param DataDumperInterface|null $wrappedDumper A wrapped instance used whenever we failed contacting the server + * @param ContextProviderInterface[] $contextProviders Context providers indexed by context name + */ + public function __construct( + string $host, + private ?DataDumperInterface $wrappedDumper = null, + array $contextProviders = [], + ) { + $this->connection = new Connection($host, $contextProviders); + } + + public function getContextProviders(): array + { + return $this->connection->getContextProviders(); + } + + public function dump(Data $data): ?string + { + if (!$this->connection->write($data) && $this->wrappedDumper) { + return $this->wrappedDumper->dump($data); + } + + return null; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Exception/ThrowingCasterException.php b/upLoadImage/vendor/symfony/var-dumper/Exception/ThrowingCasterException.php new file mode 100644 index 0000000..fd8eca9 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Exception/ThrowingCasterException.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Exception; + +/** + * @author Nicolas Grekas + */ +class ThrowingCasterException extends \Exception +{ + /** + * @param \Throwable $prev The exception thrown from the caster + */ + public function __construct(\Throwable $prev) + { + parent::__construct('Unexpected '.$prev::class.' thrown from a caster: '.$prev->getMessage(), 0, $prev); + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/LICENSE b/upLoadImage/vendor/symfony/var-dumper/LICENSE new file mode 100644 index 0000000..29f72d5 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014-present Fabien Potencier + +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. diff --git a/upLoadImage/vendor/symfony/var-dumper/README.md b/upLoadImage/vendor/symfony/var-dumper/README.md new file mode 100644 index 0000000..a0da8c9 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/README.md @@ -0,0 +1,15 @@ +VarDumper Component +=================== + +The VarDumper component provides mechanisms for walking through any arbitrary +PHP variable. It provides a better `dump()` function that you can use instead +of `var_dump()`. + +Resources +--------- + + * [Documentation](https://symfony.com/doc/current/components/var_dumper/introduction.html) + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/upLoadImage/vendor/symfony/var-dumper/Resources/bin/var-dump-server b/upLoadImage/vendor/symfony/var-dumper/Resources/bin/var-dump-server new file mode 100755 index 0000000..3e04aeb --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Resources/bin/var-dump-server @@ -0,0 +1,72 @@ +#!/usr/bin/env php + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +if ('cli' !== PHP_SAPI) { + throw new Exception('This script must be run from the command line.'); +} + +/** + * Starts a dump server to collect and output dumps on a single place with multiple formats support. + * + * @author Maxime Steinhausser + */ + +use Psr\Log\LoggerInterface; +use Symfony\Component\Console\Application; +use Symfony\Component\Console\Input\ArgvInput; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Logger\ConsoleLogger; +use Symfony\Component\Console\Output\ConsoleOutput; +use Symfony\Component\VarDumper\Command\ServerDumpCommand; +use Symfony\Component\VarDumper\Server\DumpServer; + +function includeIfExists(string $file): bool +{ + return file_exists($file) && include $file; +} + +if ( + !includeIfExists(__DIR__ . '/../../../../autoload.php') && + !includeIfExists(__DIR__ . '/../../vendor/autoload.php') && + !includeIfExists(__DIR__ . '/../../../../../../vendor/autoload.php') +) { + fwrite(STDERR, 'Install dependencies using Composer.'.PHP_EOL); + exit(1); +} + +if (!class_exists(Application::class)) { + fwrite(STDERR, 'You need the "symfony/console" component in order to run the VarDumper server.'.PHP_EOL); + exit(1); +} + +$input = new ArgvInput(); +$output = new ConsoleOutput(); +$defaultHost = '127.0.0.1:9912'; +$host = $input->getParameterOption(['--host'], $_SERVER['VAR_DUMPER_SERVER'] ?? $defaultHost, true); +$logger = interface_exists(LoggerInterface::class) ? new ConsoleLogger($output->getErrorOutput()) : null; + +$app = new Application(); + +$app->getDefinition()->addOption( + new InputOption('--host', null, InputOption::VALUE_REQUIRED, 'The address the server should listen to', $defaultHost) +); + +$command = new ServerDumpCommand(new DumpServer($host, $logger)); +if (method_exists($app, 'addCommand')) { + $app->addCommand($command); +} else { + $app->add($command); +} +$app + ->setDefaultCommand($command->getName(), true) + ->run($input, $output) +; diff --git a/upLoadImage/vendor/symfony/var-dumper/Resources/css/htmlDescriptor.css b/upLoadImage/vendor/symfony/var-dumper/Resources/css/htmlDescriptor.css new file mode 100644 index 0000000..8f706d6 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Resources/css/htmlDescriptor.css @@ -0,0 +1,130 @@ +body { + display: flex; + flex-direction: column-reverse; + justify-content: flex-end; + max-width: 1140px; + margin: auto; + padding: 15px; + word-wrap: break-word; + background-color: #F9F9F9; + color: #222; + font-family: Helvetica, Arial, sans-serif; + font-size: 14px; + line-height: 1.4; +} +p { + margin: 0; +} +a { + color: #218BC3; + text-decoration: none; +} +a:hover { + text-decoration: underline; +} +.text-small { + font-size: 12px !important; +} +article { + margin: 5px; + margin-bottom: 10px; +} +article > header > .row { + display: flex; + flex-direction: row; + align-items: baseline; + margin-bottom: 10px; +} +article > header > .row > .col { + flex: 1; + display: flex; + align-items: baseline; +} +article > header > .row > h2 { + font-size: 14px; + color: #222; + font-weight: normal; + font-family: "Lucida Console", monospace, sans-serif; + word-break: break-all; + margin: 20px 5px 0 0; + user-select: all; +} +article > header > .row > h2 > code { + white-space: nowrap; + user-select: none; + color: #cc2255; + background-color: #f7f7f9; + border: 1px solid #e1e1e8; + border-radius: 3px; + margin-right: 5px; + padding: 0 3px; +} +article > header > .row > time.col { + flex: 0; + text-align: right; + white-space: nowrap; + color: #999; + font-style: italic; +} +article > header ul.tags { + list-style: none; + padding: 0; + margin: 0; + font-size: 12px; +} +article > header ul.tags > li { + user-select: all; + margin-bottom: 2px; +} +article > header ul.tags > li > span.badge { + display: inline-block; + padding: .25em .4em; + margin-right: 5px; + border-radius: 4px; + background-color: #6c757d3b; + color: #524d4d; + font-size: 12px; + text-align: center; + font-weight: 700; + line-height: 1; + white-space: nowrap; + vertical-align: baseline; + user-select: none; +} +article > section.body { + border: 1px solid #d8d8d8; + background: #FFF; + padding: 10px; + border-radius: 3px; +} +pre.sf-dump { + border-radius: 3px; + margin-bottom: 0; +} +.hidden { + display: none !important; +} +.dumped-tag > .sf-dump { + display: inline-block; + margin: 0; + padding: 1px 5px; + line-height: 1.4; + vertical-align: top; + background-color: transparent; + user-select: auto; +} +.dumped-tag > pre.sf-dump, +.dumped-tag > .sf-dump-default { + color: #CC7832; + background: none; +} +.dumped-tag > .sf-dump .sf-dump-str { color: #629755; } +.dumped-tag > .sf-dump .sf-dump-private, +.dumped-tag > .sf-dump .sf-dump-protected, +.dumped-tag > .sf-dump .sf-dump-public { color: #262626; } +.dumped-tag > .sf-dump .sf-dump-note { color: #6897BB; } +.dumped-tag > .sf-dump .sf-dump-key { color: #789339; } +.dumped-tag > .sf-dump .sf-dump-ref { color: #6E6E6E; } +.dumped-tag > .sf-dump .sf-dump-ellipsis { color: #CC7832; max-width: 100em; } +.dumped-tag > .sf-dump .sf-dump-ellipsis-path { max-width: 5em; } +.dumped-tag > .sf-dump .sf-dump-ns { user-select: none; } diff --git a/upLoadImage/vendor/symfony/var-dumper/Resources/functions/dump.php b/upLoadImage/vendor/symfony/var-dumper/Resources/functions/dump.php new file mode 100644 index 0000000..c991551 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Resources/functions/dump.php @@ -0,0 +1,68 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Component\VarDumper\Caster\ScalarStub; +use Symfony\Component\VarDumper\VarDumper; + +if (!function_exists('dump')) { + /** + * @author Nicolas Grekas + * @author Alexandre Daubois + */ + function dump(mixed ...$vars): mixed + { + if (!$vars) { + VarDumper::dump(new ScalarStub('🐛')); + + return null; + } + + if (array_key_exists(0, $vars) && 1 === count($vars)) { + VarDumper::dump($vars[0]); + $k = 0; + } else { + foreach ($vars as $k => $v) { + VarDumper::dump($v, is_int($k) ? 1 + $k : $k); + } + } + + if (1 < count($vars)) { + return $vars; + } + + return $vars[$k]; + } +} + +if (!function_exists('dd')) { + function dd(mixed ...$vars): never + { + if (!in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) && !headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + + if (!$vars) { + VarDumper::dump(new ScalarStub('🐛')); + + exit(1); + } + + if (array_key_exists(0, $vars) && 1 === count($vars)) { + VarDumper::dump($vars[0]); + } else { + foreach ($vars as $k => $v) { + VarDumper::dump($v, is_int($k) ? 1 + $k : $k); + } + } + + exit(1); + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Resources/js/htmlDescriptor.js b/upLoadImage/vendor/symfony/var-dumper/Resources/js/htmlDescriptor.js new file mode 100644 index 0000000..63101e5 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Resources/js/htmlDescriptor.js @@ -0,0 +1,10 @@ +document.addEventListener('DOMContentLoaded', function() { + let prev = null; + Array.from(document.getElementsByTagName('article')).reverse().forEach(function (article) { + const dedupId = article.dataset.dedupId; + if (dedupId === prev) { + article.getElementsByTagName('header')[0].classList.add('hidden'); + } + prev = dedupId; + }); +}); diff --git a/upLoadImage/vendor/symfony/var-dumper/Server/Connection.php b/upLoadImage/vendor/symfony/var-dumper/Server/Connection.php new file mode 100644 index 0000000..2f1cc1b --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Server/Connection.php @@ -0,0 +1,97 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Server; + +use Symfony\Component\VarDumper\Cloner\Data; +use Symfony\Component\VarDumper\Dumper\ContextProvider\ContextProviderInterface; + +/** + * Forwards serialized Data clones to a server. + * + * @author Maxime Steinhausser + */ +class Connection +{ + private string $host; + + /** + * @var resource|null + */ + private $socket; + + /** + * @param string $host The server host + * @param ContextProviderInterface[] $contextProviders Context providers indexed by context name + */ + public function __construct( + string $host, + private array $contextProviders = [], + ) { + if (!str_contains($host, '://')) { + $host = 'tcp://'.$host; + } + + $this->host = $host; + } + + public function getContextProviders(): array + { + return $this->contextProviders; + } + + public function write(Data $data): bool + { + $socketIsFresh = !$this->socket; + if (!$this->socket = $this->socket ?: $this->createSocket()) { + return false; + } + + $context = ['timestamp' => microtime(true)]; + foreach ($this->contextProviders as $name => $provider) { + $context[$name] = $provider->getContext(); + } + $context = array_filter($context); + $encodedPayload = base64_encode(serialize([$data, $context]))."\n"; + + set_error_handler(static fn () => null); + try { + if (-1 !== stream_socket_sendto($this->socket, $encodedPayload)) { + return true; + } + if (!$socketIsFresh) { + stream_socket_shutdown($this->socket, \STREAM_SHUT_RDWR); + fclose($this->socket); + $this->socket = $this->createSocket(); + } + if (-1 !== stream_socket_sendto($this->socket, $encodedPayload)) { + return true; + } + } finally { + restore_error_handler(); + } + + return false; + } + + /** + * @return resource|null + */ + private function createSocket() + { + set_error_handler(static fn () => null); + try { + return stream_socket_client($this->host, $errno, $errstr, 3) ?: null; + } finally { + restore_error_handler(); + } + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Server/DumpServer.php b/upLoadImage/vendor/symfony/var-dumper/Server/DumpServer.php new file mode 100644 index 0000000..149c3c4 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Server/DumpServer.php @@ -0,0 +1,109 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Server; + +use Psr\Log\LoggerInterface; +use Symfony\Component\VarDumper\Cloner\Data; +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * A server collecting Data clones sent by a ServerDumper. + * + * @author Maxime Steinhausser + * + * @final + */ +class DumpServer +{ + private string $host; + + /** + * @var resource|null + */ + private $socket; + + public function __construct( + string $host, + private ?LoggerInterface $logger = null, + ) { + if (!str_contains($host, '://')) { + $host = 'tcp://'.$host; + } + + $this->host = $host; + } + + public function start(): void + { + if (!$this->socket = stream_socket_server($this->host, $errno, $errstr)) { + throw new \RuntimeException(\sprintf('Server start failed on "%s": ', $this->host).$errstr.' '.$errno); + } + } + + public function listen(callable $callback): void + { + if (null === $this->socket) { + $this->start(); + } + + foreach ($this->getMessages() as $clientId => $message) { + $this->logger?->info('Received a payload from client {clientId}', ['clientId' => $clientId]); + + $payload = @unserialize(base64_decode($message), ['allowed_classes' => [Data::class, Stub::class]]); + + // Impossible to decode the message, give up. + if (false === $payload) { + $this->logger?->warning('Unable to decode a message from {clientId} client.', ['clientId' => $clientId]); + + continue; + } + + if (!\is_array($payload) || \count($payload) < 2 || !$payload[0] instanceof Data || !\is_array($payload[1])) { + $this->logger?->warning('Invalid payload from {clientId} client. Expected an array of two elements (Data $data, array $context)', ['clientId' => $clientId]); + + continue; + } + + [$data, $context] = $payload; + + $callback($data, $context, $clientId); + } + } + + public function getHost(): string + { + return $this->host; + } + + private function getMessages(): iterable + { + $sockets = [(int) $this->socket => $this->socket]; + $write = []; + + while (true) { + $read = $sockets; + stream_select($read, $write, $write, null); + + foreach ($read as $stream) { + if ($this->socket === $stream) { + $stream = stream_socket_accept($this->socket); + $sockets[(int) $stream] = $stream; + } elseif (feof($stream)) { + unset($sockets[(int) $stream]); + fclose($stream); + } else { + yield (int) $stream => fgets($stream); + } + } + } + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/Test/VarDumperTestTrait.php b/upLoadImage/vendor/symfony/var-dumper/Test/VarDumperTestTrait.php new file mode 100644 index 0000000..dc675b2 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/Test/VarDumperTestTrait.php @@ -0,0 +1,95 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Test; + +use PHPUnit\Framework\Attributes\After; +use Symfony\Component\VarDumper\Cloner\VarCloner; +use Symfony\Component\VarDumper\Dumper\CliDumper; + +/** + * @author Nicolas Grekas + */ +trait VarDumperTestTrait +{ + /** + * @internal + */ + private array $varDumperConfig = [ + 'casters' => [], + 'flags' => null, + ]; + + /** + * @param array $casters + */ + protected function setUpVarDumper(array $casters, ?int $flags = null): void + { + $this->varDumperConfig['casters'] = $casters; + $this->varDumperConfig['flags'] = $flags; + } + + /** + * @after + */ + #[After] + protected function tearDownVarDumper(): void + { + $this->varDumperConfig['casters'] = []; + $this->varDumperConfig['flags'] = null; + } + + /** + * @return void + */ + public function assertDumpEquals(mixed $expected, mixed $data, int $filter = 0, string $message = '') + { + $this->assertSame($this->prepareExpectation($expected, $filter), $this->getDump($data, null, $filter), $message); + } + + /** + * @return void + */ + public function assertDumpMatchesFormat(mixed $expected, mixed $data, int $filter = 0, string $message = '') + { + $this->assertStringMatchesFormat($this->prepareExpectation($expected, $filter), $this->getDump($data, null, $filter), $message); + } + + protected function getDump(mixed $data, string|int|null $key = null, int $filter = 0): ?string + { + if (null === $flags = $this->varDumperConfig['flags']) { + $flags = getenv('DUMP_LIGHT_ARRAY') ? CliDumper::DUMP_LIGHT_ARRAY : 0; + $flags |= getenv('DUMP_STRING_LENGTH') ? CliDumper::DUMP_STRING_LENGTH : 0; + $flags |= getenv('DUMP_COMMA_SEPARATOR') ? CliDumper::DUMP_COMMA_SEPARATOR : 0; + } + + $cloner = new VarCloner(); + $cloner->addCasters($this->varDumperConfig['casters']); + $cloner->setMaxItems(-1); + $dumper = new CliDumper(null, null, $flags); + $dumper->setColors(false); + $data = $cloner->cloneVar($data, $filter)->withRefHandles(false); + if (null !== $key && null === $data = $data->seek($key)) { + return null; + } + + return rtrim($dumper->dump($data, true)); + } + + private function prepareExpectation(mixed $expected, int $filter): string + { + if (!\is_string($expected)) { + $expected = $this->getDump($expected, null, $filter); + } + + return rtrim($expected); + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/VarDumper.php b/upLoadImage/vendor/symfony/var-dumper/VarDumper.php new file mode 100644 index 0000000..0c3aca9 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/VarDumper.php @@ -0,0 +1,120 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper; + +use Symfony\Component\ErrorHandler\ErrorRenderer\FileLinkFormatter; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\VarDumper\Caster\ReflectionCaster; +use Symfony\Component\VarDumper\Cloner\VarCloner; +use Symfony\Component\VarDumper\Dumper\CliDumper; +use Symfony\Component\VarDumper\Dumper\ContextProvider\CliContextProvider; +use Symfony\Component\VarDumper\Dumper\ContextProvider\RequestContextProvider; +use Symfony\Component\VarDumper\Dumper\ContextProvider\SourceContextProvider; +use Symfony\Component\VarDumper\Dumper\ContextualizedDumper; +use Symfony\Component\VarDumper\Dumper\HtmlDumper; +use Symfony\Component\VarDumper\Dumper\ServerDumper; + +// Load the global dump() function +require_once __DIR__.'/Resources/functions/dump.php'; + +/** + * @author Nicolas Grekas + */ +class VarDumper +{ + /** + * @var callable|null + */ + private static $handler; + + public static function dump(mixed $var, ?string $label = null): mixed + { + if (null === self::$handler) { + self::register(); + } + + return (self::$handler)($var, $label); + } + + public static function setHandler(?callable $callable): ?callable + { + $prevHandler = self::$handler; + + // Prevent replacing the handler with expected format as soon as the env var was set: + if (isset($_SERVER['VAR_DUMPER_FORMAT'])) { + return $prevHandler; + } + + self::$handler = $callable; + + return $prevHandler; + } + + private static function register(): void + { + $cloner = new VarCloner(); + $cloner->addCasters(ReflectionCaster::UNSET_CLOSURE_FILE_INFO); + + $format = $_SERVER['VAR_DUMPER_FORMAT'] ?? null; + switch (true) { + case 'html' === $format: + $dumper = new HtmlDumper(); + break; + case 'cli' === $format: + $dumper = new CliDumper(); + break; + case 'server' === $format: + case $format && 'tcp' === parse_url($format, \PHP_URL_SCHEME): + $host = 'server' === $format ? $_SERVER['VAR_DUMPER_SERVER'] ?? '127.0.0.1:9912' : $format; + $accept = $_SERVER['HTTP_ACCEPT'] ?? (\in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) ? 'txt' : 'html'); + $dumper = str_contains($accept, 'html') || str_contains($accept, '*/*') ? new HtmlDumper() : new CliDumper(); + $dumper = new ServerDumper($host, $dumper, self::getDefaultContextProviders()); + break; + default: + $accept = $_SERVER['HTTP_ACCEPT'] ?? (\in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) ? 'txt' : 'html'); + $dumper = str_contains($accept, 'html') || str_contains($accept, '*/*') ? new HtmlDumper() : new CliDumper(); + } + + if (!$dumper instanceof ServerDumper) { + $dumper = new ContextualizedDumper($dumper, [new SourceContextProvider()]); + } + + self::$handler = function ($var, ?string $label = null) use ($cloner, $dumper) { + $var = $cloner->cloneVar($var); + + if (null !== $label) { + $var = $var->withContext(['label' => $label]); + } + + $dumper->dump($var); + }; + } + + private static function getDefaultContextProviders(): array + { + $contextProviders = []; + + if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) && class_exists(Request::class)) { + $requestStack = new RequestStack(); + $requestStack->push(Request::createFromGlobals()); + $contextProviders['request'] = new RequestContextProvider($requestStack); + } + + $fileLinkFormatter = class_exists(FileLinkFormatter::class) ? new FileLinkFormatter(null, $requestStack ?? null) : null; + + return $contextProviders + [ + 'cli' => new CliContextProvider(), + 'source' => new SourceContextProvider(null, null, $fileLinkFormatter), + ]; + } +} diff --git a/upLoadImage/vendor/symfony/var-dumper/composer.json b/upLoadImage/vendor/symfony/var-dumper/composer.json new file mode 100644 index 0000000..bffa992 --- /dev/null +++ b/upLoadImage/vendor/symfony/var-dumper/composer.json @@ -0,0 +1,44 @@ +{ + "name": "symfony/var-dumper", + "type": "library", + "description": "Provides mechanisms for walking through any arbitrary PHP variable", + "keywords": ["dump", "debug"], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=8.2", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-mbstring": "~1.0" + }, + "require-dev": { + "symfony/console": "^6.4|^7.0|^8.0", + "symfony/http-kernel": "^6.4|^7.0|^8.0", + "symfony/process": "^6.4|^7.0|^8.0", + "symfony/uid": "^6.4|^7.0|^8.0", + "twig/twig": "^3.12" + }, + "conflict": { + "symfony/console": "<6.4" + }, + "autoload": { + "files": [ "Resources/functions/dump.php" ], + "psr-4": { "Symfony\\Component\\VarDumper\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "bin": [ + "Resources/bin/var-dump-server" + ], + "minimum-stability": "dev" +}