/** Datei: library/vendor/composer/installed.php **/ array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'reference' => '22d9bde0e93598d7cdec0bd8f5188e7f26c5be2e', 'name' => '__root__', 'dev' => true, ), 'versions' => array( '__root__' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'reference' => '22d9bde0e93598d7cdec0bd8f5188e7f26c5be2e', 'dev_requirement' => false, ), 'hashids/hashids' => array( 'pretty_version' => '5.0.2', 'version' => '5.0.2.0', 'type' => 'library', 'install_path' => __DIR__ . '/../hashids/hashids', 'aliases' => array(), 'reference' => '197171016b77ddf14e259e186559152eb3f8cf33', 'dev_requirement' => false, ), ), ); /** Datei: library/vendor/composer/ClassLoader.php **/ * 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 ?string */ private $vendorDir; // PSR-4 /** * @var array[] * @psalm-var array> */ private $prefixLengthsPsr4 = array(); /** * @var array[] * @psalm-var array> */ private $prefixDirsPsr4 = array(); /** * @var array[] * @psalm-var array */ private $fallbackDirsPsr4 = array(); // PSR-0 /** * @var array[] * @psalm-var array> */ private $prefixesPsr0 = array(); /** * @var array[] * @psalm-var array */ private $fallbackDirsPsr0 = array(); /** @var bool */ private $useIncludePath = false; /** * @var string[] * @psalm-var array */ private $classMap = array(); /** @var bool */ private $classMapAuthoritative = false; /** * @var bool[] * @psalm-var array */ private $missingClasses = array(); /** @var ?string */ private $apcuPrefix; /** * @var self[] */ private static $registeredLoaders = array(); /** * @param ?string $vendorDir */ public function __construct($vendorDir = null) { $this->vendorDir = $vendorDir; } /** * @return string[] */ public function getPrefixes() { if (!empty($this->prefixesPsr0)) { return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); } return array(); } /** * @return array[] * @psalm-return array> */ public function getPrefixesPsr4() { return $this->prefixDirsPsr4; } /** * @return array[] * @psalm-return array */ public function getFallbackDirs() { return $this->fallbackDirsPsr0; } /** * @return array[] * @psalm-return array */ public function getFallbackDirsPsr4() { return $this->fallbackDirsPsr4; } /** * @return string[] Array of classname => path * @psalm-var array */ public function getClassMap() { return $this->classMap; } /** * @param string[] $classMap Class to filename map * @psalm-param array $classMap * * @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 string[]|string $paths The PSR-0 root directories * @param bool $prepend Whether to prepend the directories * * @return void */ public function add($prefix, $paths, $prepend = false) { if (!$prefix) { if ($prepend) { $this->fallbackDirsPsr0 = array_merge( (array) $paths, $this->fallbackDirsPsr0 ); } else { $this->fallbackDirsPsr0 = array_merge( $this->fallbackDirsPsr0, (array) $paths ); } return; } $first = $prefix[0]; if (!isset($this->prefixesPsr0[$first][$prefix])) { $this->prefixesPsr0[$first][$prefix] = (array) $paths; return; } if ($prepend) { $this->prefixesPsr0[$first][$prefix] = array_merge( (array) $paths, $this->prefixesPsr0[$first][$prefix] ); } else { $this->prefixesPsr0[$first][$prefix] = array_merge( $this->prefixesPsr0[$first][$prefix], (array) $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 string[]|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) { if (!$prefix) { // Register directories for the root namespace. if ($prepend) { $this->fallbackDirsPsr4 = array_merge( (array) $paths, $this->fallbackDirsPsr4 ); } else { $this->fallbackDirsPsr4 = array_merge( $this->fallbackDirsPsr4, (array) $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] = (array) $paths; } elseif ($prepend) { // Prepend directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( (array) $paths, $this->prefixDirsPsr4[$prefix] ); } else { // Append directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( $this->prefixDirsPsr4[$prefix], (array) $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 string[]|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 string[]|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($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 indexed by their corresponding vendor directories. * * @return self[] */ 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; } } /** * Scope isolated include. * * Prevents access to $this/self from included files. * * @param string $file * @return void * @private */ function includeFile($file) { include $file; } /** Datei: library/vendor/composer/autoload_real.php **/ = 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require __DIR__ . '/autoload_static.php'; call_user_func(\Composer\Autoload\ComposerStaticInitb7ad182a7d0eb255503e79bfdfb240f0::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { $loader->set($namespace, $path); } $map = require __DIR__ . '/autoload_psr4.php'; foreach ($map as $namespace => $path) { $loader->setPsr4($namespace, $path); } $classMap = require __DIR__ . '/autoload_classmap.php'; if ($classMap) { $loader->addClassMap($classMap); } } $loader->register(true); return $loader; } } /** Datei: library/vendor/composer/autoload_psr4.php **/ array($vendorDir . '/hashids/hashids/src'), ); /** Datei: library/vendor/composer/autoload_static.php **/ array ( 'Hashids\\' => 8, ), ); public static $prefixDirsPsr4 = array ( 'Hashids\\' => array ( 0 => __DIR__ . '/..' . '/hashids/hashids/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 = ComposerStaticInitb7ad182a7d0eb255503e79bfdfb240f0::$prefixLengthsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInitb7ad182a7d0eb255503e79bfdfb240f0::$prefixDirsPsr4; $loader->classMap = ComposerStaticInitb7ad182a7d0eb255503e79bfdfb240f0::$classMap; }, null, ClassLoader::class); } } /** Datei: library/vendor/composer/InstalledVersions.php **/ * 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` */ class InstalledVersions { /** * @var mixed[]|null * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array}|array{}|null */ private static $installed; /** * @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 || empty($installed['versions'][$packageName]['dev_requirement']); } } 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($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, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string} */ 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, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, 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, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array} $data */ public static function reload($data) { self::$installed = $data; self::$installedByVendor = array(); } /** * @return array[] * @psalm-return list}> */ private static function getInstalled() { if (null === self::$canGetVendors) { self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); } $installed = array(); if (self::$canGetVendors) { foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { if (isset(self::$installedByVendor[$vendorDir])) { $installed[] = self::$installedByVendor[$vendorDir]; } elseif (is_file($vendorDir.'/composer/installed.php')) { $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { self::$installed = $installed[count($installed) - 1]; } } } } 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 = require __DIR__ . '/installed.php'; } else { self::$installed = array(); } } $installed[] = self::$installed; return $installed; } } /** Datei: library/vendor/composer/autoload_namespaces.php **/ $vendorDir . '/composer/InstalledVersions.php', ); /** Datei: library/vendor/sqids/sqids/src/Math/MathInterface.php **/ 0; } public function intval($a) { return gmp_intval($a); } public function strval($a) { return gmp_strval($a); } public function get($a) { return gmp_init($a); } } /** Datei: library/vendor/sqids/sqids/src/Math/BCMath.php **/ 0; } public function intval($a) { return intval($a); } public function strval($a) { return $a; } public function get($a) { return $a; } } /** Datei: library/vendor/sqids/sqids/src/Sqids.php **/ '[i1]', 'o' => '[o0]', 'l' => '[l1]', ]; protected MathInterface $math; protected ?string $blocklistRegex; /** @throws InvalidArgumentException */ public function __construct( protected string $alphabet = self::DEFAULT_ALPHABET, protected int $minLength = self::DEFAULT_MIN_LENGTH, protected array $blocklist = self::DEFAULT_BLOCKLIST, ) { $this->math = $this->getMathExtension(); if ($alphabet == '') { $alphabet = self::DEFAULT_ALPHABET; } if (mb_strlen($alphabet) != strlen($alphabet)) { throw new InvalidArgumentException('Alphabet cannot contain multibyte characters'); } if (strlen($alphabet) < 3) { throw new InvalidArgumentException('Alphabet length must be at least 3'); } if (preg_match('/(.).*\1/', $alphabet)) { throw new InvalidArgumentException('Alphabet must contain unique characters'); } if ($minLength < 0 || $minLength > self::MIN_LENGTH_LIMIT) { throw new InvalidArgumentException('Minimum length has to be between 0 and ' . self::MIN_LENGTH_LIMIT); } $this->blocklistRegex = $this->buildBlocklistRegex(); $this->alphabet = $this->shuffle($alphabet); } /** * Encodes an array of unsigned integers into an ID * * These are the cases where encoding might fail: * - One of the numbers passed is smaller than 0 or greater than `maxValue()` * - An n-number of attempts has been made to re-generated the ID, where n is alphabet length + 1 * * @param array $numbers Non-negative integers to encode into an ID * @return string Generated ID */ public function encode(array $numbers): string { if (count($numbers) == 0) { return ''; } foreach ($numbers as $n) { if ($n < 0 || $n > self::maxValue()) { throw new InvalidArgumentException( 'Encoding supports numbers between 0 and ' . self::maxValue(), ); } } return $this->encodeNumbers($numbers); } /** * Internal function that encodes an array of unsigned integers into an ID * * @param array $numbers Non-negative integers to encode into an ID * @param int $increment An internal number used to modify the `offset` variable in order to re-generate the ID * @return string Generated ID */ protected function encodeNumbers(array $numbers, int $increment = 0): string { if ($increment > strlen($this->alphabet)) { throw new InvalidArgumentException('Reached max attempts to re-generate the ID'); } $offset = count($numbers); foreach ($numbers as $i => $v) { $offset += ord($this->alphabet[$v % strlen($this->alphabet)]) + $i; } $offset %= strlen($this->alphabet); $offset = ($offset + $increment) % strlen($this->alphabet); $alphabet = substr($this->alphabet, $offset) . substr($this->alphabet, 0, $offset); $prefix = $alphabet[0]; $alphabet = strrev($alphabet); $id = $prefix; for ($i = 0; $i != count($numbers); $i++) { $num = $numbers[$i]; $id .= $this->toId($num, substr($alphabet, 1)); if ($i < count($numbers) - 1) { $id .= $alphabet[0]; $alphabet = $this->shuffle($alphabet); } } if ($this->minLength > strlen($id)) { $id .= $alphabet[0]; while ($this->minLength - strlen($id) > 0) { $alphabet = $this->shuffle($alphabet); $id .= substr($alphabet, 0, min($this->minLength - strlen($id), strlen($this->alphabet))); } } if ($this->isBlockedId($id)) { $id = $this->encodeNumbers($numbers, $increment + 1); } return $id; } /** * Decodes an ID back into an array of unsigned integers * * These are the cases where the return value might be an empty array: * - Empty ID / empty string * - Non-alphabet character is found within the ID * * @param string $id Encoded ID * @return array Array of unsigned integers */ public function decode(string $id): array { $ret = []; if ($id == '') { return $ret; } if (!preg_match('/^[' . preg_quote($this->alphabet, '/') . ']+$/', $id)) { return $ret; } $prefix = $id[0]; $offset = strpos($this->alphabet, $prefix); $alphabet = substr($this->alphabet, $offset) . substr($this->alphabet, 0, $offset); $alphabet = strrev($alphabet); $id = substr($id, 1); while (strlen($id) > 0) { $separator = $alphabet[0]; $chunks = explode($separator, $id, 2); if (array_key_exists(0, $chunks)) { if ($chunks[0] == '') { return $ret; } $ret[] = $this->toNumber($chunks[0], substr($alphabet, 1)); if (array_key_exists(1, $chunks)) { $alphabet = $this->shuffle($alphabet); } } $id = $chunks[1] ?? ''; } return $ret; } protected function shuffle(string $alphabet): string { for ($i = 0, $j = strlen($alphabet) - 1; $j > 0; $i++, $j--) { $r = ($i * $j + ord($alphabet[$i]) + ord($alphabet[$j])) % strlen($alphabet); [$alphabet[$i], $alphabet[$r]] = [$alphabet[$r], $alphabet[$i]]; } return $alphabet; } protected function toId(int $num, string $alphabet): string { $id = ''; do { $id = $alphabet[$this->math->intval($this->math->mod($num, strlen($alphabet)))] . $id; $num = $this->math->divide($num, strlen($alphabet)); } while ($this->math->greaterThan($num, 0)); return $id; } protected function toNumber(string $id, string $alphabet): int { $number = 0; for ($i = 0; $i < strlen($id); $i++) { $number = $this->math->add( $this->math->multiply($number, strlen($alphabet)), strpos($alphabet, $id[$i]), ); } return $this->math->intval($number); } protected function isBlockedId(string $id): bool { return $this->blocklistRegex !== null && preg_match($this->blocklistRegex, $id); } protected static function maxValue(): int { return PHP_INT_MAX; } /** * Get BC Math or GMP extension. * @throws \RuntimeException */ protected function getMathExtension(): MathInterface { if (extension_loaded('gmp')) { return new Gmp(); } if (extension_loaded('bcmath')) { return new BCMath(); } throw new RuntimeException('Missing math extension for Sqids, install either bcmath or gmp.'); } protected function buildBlocklistRegex(): ?string { $wordsMatchingExactly = []; $wordsMatchingBeginningOrEnd = []; $wordMatchingAnywhere = []; foreach ($this->blocklist as $word) { $word = (string) $word; if (strlen($word) <= 3) { $wordsMatchingExactly[] = preg_quote($word, '/'); } else { $word = preg_quote($word, '/'); $leet = strtr($word, self::LEET); if (!preg_match('/\d/', $word)) { $wordMatchingAnywhere[] = $word; } elseif ($leet === $word) { $wordsMatchingBeginningOrEnd[] = $word; } if ($leet !== $word) { $wordsMatchingBeginningOrEnd[] = $leet; } } } $regexParts = []; if ($wordsMatchingExactly) { $regexParts[] = '^(' . implode('|', $wordsMatchingExactly) . ')$'; } if ($wordsMatchingBeginningOrEnd) { $regexParts[] = '^(' . implode('|', $wordsMatchingBeginningOrEnd) . ')'; $regexParts[] = '(' . implode('|', $wordsMatchingBeginningOrEnd) . ')$'; } if ($wordMatchingAnywhere) { $regexParts[] = '(' . implode('|', $wordMatchingAnywhere) . ')'; } if ($regexParts) { return '/(' . implode('|', $regexParts) . ')/i'; } return null; } } /** Datei: library/vendor/sqids/sqids/src/SqidsInterface.php **/ $numbers * @return string */ public function encode(array $numbers): string; /** * Decode an ID back to integers. * @param string $id * @return array */ public function decode(string $id): array; } /** Datei: library/vendor/hashids/hashids/src/Math/MathInterface.php **/ 0; } public function intval($a) { return gmp_intval($a); } public function strval($a) { return gmp_strval($a); } public function get($a) { return gmp_init($a); } } /** Datei: library/vendor/hashids/hashids/src/Math/BCMath.php **/ 0; } public function intval($a) { return intval($a); } public function strval($a) { return $a; } public function get($a) { return $a; } } /** Datei: library/vendor/hashids/hashids/src/Hashids.php **/ salt = mb_convert_encoding($salt, 'UTF-8', mb_detect_encoding($salt)); $this->minHashLength = $minHashLength; $alphabet = mb_convert_encoding($alphabet, 'UTF-8', mb_detect_encoding($alphabet)); $this->alphabet = implode('', array_unique($this->multiByteSplit($alphabet))); $this->math = $this->getMathExtension(); if (mb_strlen($this->alphabet) < 16) { throw new InvalidArgumentException('The Hashids alphabet must contain at least 16 unique characters.'); } if (false !== mb_strpos($this->alphabet, ' ')) { throw new InvalidArgumentException('The Hashids alphabet can\'t contain spaces.'); } $alphabetArray = $this->multiByteSplit($this->alphabet); $sepsArray = $this->multiByteSplit($this->seps); $this->seps = implode('', array_intersect($sepsArray, $alphabetArray)); $this->alphabet = implode('', array_diff($alphabetArray, $sepsArray)); $this->seps = $this->shuffle($this->seps, $this->salt); if (!$this->seps || (mb_strlen($this->alphabet) / mb_strlen($this->seps)) > self::SEP_DIV) { $sepsLength = (int) ceil(mb_strlen($this->alphabet) / self::SEP_DIV); if ($sepsLength > mb_strlen($this->seps)) { $diff = $sepsLength - mb_strlen($this->seps); $this->seps .= mb_substr($this->alphabet, 0, $diff); $this->alphabet = mb_substr($this->alphabet, $diff); } } $this->alphabet = $this->shuffle($this->alphabet, $this->salt); $guardCount = (int) ceil(mb_strlen($this->alphabet) / self::GUARD_DIV); if (mb_strlen($this->alphabet) < 3) { $this->guards = mb_substr($this->seps, 0, $guardCount); $this->seps = mb_substr($this->seps, $guardCount); } else { $this->guards = mb_substr($this->alphabet, 0, $guardCount); $this->alphabet = mb_substr($this->alphabet, $guardCount); } } public function encode(...$numbers): string { $ret = ''; if (1 === count($numbers) && is_array($numbers[0])) { $numbers = $numbers[0]; } if (!$numbers) { return $ret; } foreach ($numbers as $number) { $isNumber = ctype_digit((string) $number); if (!$isNumber) { return $ret; } } $alphabet = $this->alphabet; $numbersSize = count($numbers); $numbersHashInt = 0; foreach ($numbers as $i => $number) { $numbersHashInt += $this->math->intval($this->math->mod($number, $i + 100)); } $lottery = $ret = mb_substr($alphabet, $numbersHashInt % mb_strlen($alphabet), 1); foreach ($numbers as $i => $number) { $alphabet = $this->shuffle($alphabet, mb_substr($lottery . $this->salt . $alphabet, 0, mb_strlen($alphabet))); $ret .= $last = $this->hash($number, $alphabet); if ($i + 1 < $numbersSize) { $number %= (mb_ord($last, 'UTF-8') + $i); $sepsIndex = $this->math->intval($this->math->mod($number, mb_strlen($this->seps))); $ret .= mb_substr($this->seps, $sepsIndex, 1); } } if (mb_strlen($ret) < $this->minHashLength) { $guardIndex = ($numbersHashInt + mb_ord(mb_substr($ret, 0, 1), 'UTF-8')) % mb_strlen($this->guards); $guard = mb_substr($this->guards, $guardIndex, 1); $ret = $guard . $ret; if (mb_strlen($ret) < $this->minHashLength) { $guardIndex = ($numbersHashInt + mb_ord(mb_substr($ret, 2, 1), 'UTF-8')) % mb_strlen($this->guards); $guard = mb_substr($this->guards, $guardIndex, 1); $ret .= $guard; } } $halfLength = (int) (mb_strlen($alphabet) / 2); while (mb_strlen($ret) < $this->minHashLength) { $alphabet = $this->shuffle($alphabet, $alphabet); $ret = mb_substr($alphabet, $halfLength) . $ret . mb_substr($alphabet, 0, $halfLength); $excess = mb_strlen($ret) - $this->minHashLength; if ($excess > 0) { $ret = mb_substr($ret, (int) ($excess / 2), $this->minHashLength); } } return $ret; } public function decode(string $hash): array { $ret = []; if (!($hash = trim($hash))) { return $ret; } $alphabet = $this->alphabet; $hashBreakdown = str_replace($this->multiByteSplit($this->guards), ' ', $hash); $hashArray = explode(' ', $hashBreakdown); $i = 3 === count($hashArray) || 2 === count($hashArray) ? 1 : 0; $hashBreakdown = $hashArray[$i]; if ('' !== $hashBreakdown) { $lottery = mb_substr($hashBreakdown, 0, 1); $hashBreakdown = mb_substr($hashBreakdown, 1); $hashBreakdown = str_replace($this->multiByteSplit($this->seps), ' ', $hashBreakdown); $hashArray = explode(' ', $hashBreakdown); foreach ($hashArray as $subHash) { $alphabet = $this->shuffle($alphabet, mb_substr($lottery . $this->salt . $alphabet, 0, mb_strlen($alphabet))); $result = $this->unhash($subHash, $alphabet); if ($this->math->greaterThan($result, PHP_INT_MAX)) { $ret[] = $this->math->strval($result); } else { $ret[] = $this->math->intval($result); } } if ($this->encode($ret) !== $hash) { $ret = []; } } return $ret; } public function encodeHex(string $str): string { if (!ctype_xdigit($str)) { return ''; } $numbers = trim(chunk_split($str, 12, ' ')); $numbers = explode(' ', $numbers); foreach ($numbers as $i => $number) { $numbers[$i] = hexdec('1' . $number); } return $this->encode(...$numbers); } public function decodeHex(string $hash): string { $ret = ''; $numbers = $this->decode($hash); foreach ($numbers as $number) { $ret .= mb_substr(dechex($number), 1); } return $ret; } /** Shuffle alphabet by given salt. */ protected function shuffle(string $alphabet, string $salt): string { $key = $alphabet . ' ' . $salt; if (isset($this->shuffledAlphabets[$key])) { return $this->shuffledAlphabets[$key]; } $saltLength = mb_strlen($salt); $saltArray = $this->multiByteSplit($salt); if (!$saltLength) { return $alphabet; } $alphabetArray = $this->multiByteSplit($alphabet); for ($i = mb_strlen($alphabet) - 1, $v = 0, $p = 0; $i > 0; $i--, $v++) { $v %= $saltLength; $p += $int = mb_ord($saltArray[$v], 'UTF-8'); $j = ($int + $v + $p) % $i; $temp = $alphabetArray[$j]; $alphabetArray[$j] = $alphabetArray[$i]; $alphabetArray[$i] = $temp; } $alphabet = implode('', $alphabetArray); $this->shuffledAlphabets[$key] = $alphabet; return $alphabet; } /** Hash given input value. */ protected function hash(string $input, string $alphabet): string { $hash = ''; $alphabetLength = mb_strlen($alphabet); do { $hash = mb_substr($alphabet, $this->math->intval($this->math->mod($input, $alphabetLength)), 1) . $hash; $input = $this->math->divide($input, $alphabetLength); } while ($this->math->greaterThan($input, 0)); return $hash; } /** Unhash given input value. */ protected function unhash(string $input, string $alphabet): int|string { $number = 0; $inputLength = mb_strlen($input); if ($inputLength && $alphabet) { $alphabetLength = mb_strlen($alphabet); $inputChars = $this->multiByteSplit($input); foreach ($inputChars as $char) { $position = mb_strpos($alphabet, $char); $number = $this->math->multiply($number, $alphabetLength); $number = $this->math->add($number, $position); } } return $number; } /** * Get BC Math or GMP extension. * @throws \RuntimeException */ protected function getMathExtension(): MathInterface { if (extension_loaded('gmp')) { return new Gmp(); } if (extension_loaded('bcmath')) { return new BCMath(); } throw new RuntimeException('Missing math extension for Hashids, install either bcmath or gmp.'); } /** * Replace simple use of $this->multiByteSplit with multi byte string. * @return array */ protected function multiByteSplit(string $string): array { return preg_split('/(?!^)(?=.)/u', $string) ?: []; } } /** Datei: library/vendor/hashids/hashids/src/HashidsInterface.php **/ ...$numbers */ public function encode(...$numbers): string; /** * Decode a hash to the original parameter values. * @return array|array{} */ public function decode(string $hash): array; /** Encode hexadecimal values and generate a hash string. */ public function encodeHex(string $str): string; /** Decode a hexadecimal hash. */ public function decodeHex(string $hash): string; } /** Datei: library/vendor/autoload.php **/