diff --git a/bundled-libs/composer/ClassLoader.php b/bundled-libs/composer/ClassLoader.php index fce8549f..247294d6 100644 --- a/bundled-libs/composer/ClassLoader.php +++ b/bundled-libs/composer/ClassLoader.php @@ -37,11 +37,13 @@ namespace Composer\Autoload; * * @author Fabien Potencier * @author Jordi Boggiano - * @see http://www.php-fig.org/psr/psr-0/ - * @see http://www.php-fig.org/psr/psr-4/ + * @see https://www.php-fig.org/psr/psr-0/ + * @see https://www.php-fig.org/psr/psr-4/ */ class ClassLoader { + private $vendorDir; + // PSR-4 private $prefixLengthsPsr4 = array(); private $prefixDirsPsr4 = array(); @@ -57,10 +59,17 @@ class ClassLoader private $missingClasses = array(); private $apcuPrefix; + private static $registeredLoaders = array(); + + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + } + public function getPrefixes() { if (!empty($this->prefixesPsr0)) { - return call_user_func_array('array_merge', $this->prefixesPsr0); + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); } return array(); @@ -300,6 +309,17 @@ class ClassLoader 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; + } } /** @@ -308,6 +328,10 @@ class ClassLoader public function unregister() { spl_autoload_unregister(array($this, 'loadClass')); + + if (null !== $this->vendorDir) { + unset(self::$registeredLoaders[$this->vendorDir]); + } } /** @@ -367,6 +391,16 @@ class ClassLoader return $file; } + /** + * Returns the currently registered loaders indexed by their corresponding vendor directories. + * + * @return self[] + */ + public static function getRegisteredLoaders() + { + return self::$registeredLoaders; + } + private function findFileWithExtension($class, $ext) { // PSR-4 lookup diff --git a/bundled-libs/composer/InstalledVersions.php b/bundled-libs/composer/InstalledVersions.php new file mode 100644 index 00000000..f397cfcc --- /dev/null +++ b/bundled-libs/composer/InstalledVersions.php @@ -0,0 +1,367 @@ + + array ( + 'pretty_version' => 'dev-master', + 'version' => 'dev-master', + 'aliases' => + array ( + ), + 'reference' => '05f58f90d743fe9ade24f3fdfe9a934d0b87c6a1', + 'name' => '__root__', + ), + 'versions' => + array ( + '__root__' => + array ( + 'pretty_version' => 'dev-master', + 'version' => 'dev-master', + 'aliases' => + array ( + ), + 'reference' => '05f58f90d743fe9ade24f3fdfe9a934d0b87c6a1', + ), + 'katzgrau/klogger' => + array ( + 'pretty_version' => '1.0.0', + 'version' => '1.0.0.0', + 'aliases' => + array ( + ), + 'reference' => '46cdd92a9b4a8443120cc955bf831450cb274813', + ), + 'laminas/laminas-db' => + array ( + 'pretty_version' => '2.11.4', + 'version' => '2.11.4.0', + 'aliases' => + array ( + ), + 'reference' => '5b59413b8dd5d79e3fe58c2650c60b1730989f36', + ), + 'laminas/laminas-stdlib' => + array ( + 'pretty_version' => '3.2.1', + 'version' => '3.2.1.0', + 'aliases' => + array ( + ), + 'reference' => '2b18347625a2f06a1a485acfbc870f699dbe51c6', + ), + 'laminas/laminas-zendframework-bridge' => + array ( + 'pretty_version' => '1.1.1', + 'version' => '1.1.1.0', + 'aliases' => + array ( + ), + 'reference' => '6ede70583e101030bcace4dcddd648f760ddf642', + ), + 'psr/log' => + array ( + 'pretty_version' => '1.0.0', + 'version' => '1.0.0.0', + 'aliases' => + array ( + ), + 'reference' => 'fe0936ee26643249e916849d48e3a51d5f5e278b', + ), + 'psr/simple-cache' => + array ( + 'pretty_version' => '1.0.1', + 'version' => '1.0.1.0', + 'aliases' => + array ( + ), + 'reference' => '408d5eafb83c57f6365a3ca330ff23aa4a5fa39b', + ), + 'psr/simple-cache-implementation' => + array ( + 'provided' => + array ( + 0 => '1.0', + ), + ), + 'voku/simple-cache' => + array ( + 'pretty_version' => '4.0.5', + 'version' => '4.0.5.0', + 'aliases' => + array ( + ), + 'reference' => '416cf88902991f3bf6168b71c0683e6dabb3d5e1', + ), + 'zendframework/zend-db' => + array ( + 'replaced' => + array ( + 0 => '^2.11.0', + ), + ), + 'zendframework/zend-stdlib' => + array ( + 'replaced' => + array ( + 0 => '3.2.1', + ), + ), + ), +); +private static $canGetVendors; +private static $installedByVendor = array(); + + + + + + + +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))); +} + + + + + + + + + +public static function isInstalled($packageName) +{ +foreach (self::getInstalled() as $installed) { +if (isset($installed['versions'][$packageName])) { +return true; +} +} + +return false; +} + + + + + + + + + + + + + + +public static function satisfies(VersionParser $parser, $packageName, $constraint) +{ +$constraint = $parser->parseConstraints($constraint); +$provided = $parser->parseConstraints(self::getVersionRanges($packageName)); + +return $provided->matches($constraint); +} + + + + + + + + + + +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'); +} + + + + + +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'); +} + + + + + +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'); +} + + + + + +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'); +} + + + + + +public static function getRootPackage() +{ +$installed = self::getInstalled(); + +return $installed[0]['root']; +} + + + + + + + +public static function getRawData() +{ +return self::$installed; +} + + + + + + + + + + + + + + + + + + + +public static function reload($data) +{ +self::$installed = $data; +self::$installedByVendor = array(); +} + + + + +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'; +} +} +} + +$installed[] = self::$installed; + +return $installed; +} +} diff --git a/bundled-libs/composer/autoload_classmap.php b/bundled-libs/composer/autoload_classmap.php index cecd36ce..a05f9048 100644 --- a/bundled-libs/composer/autoload_classmap.php +++ b/bundled-libs/composer/autoload_classmap.php @@ -6,7 +6,263 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( + 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', 'Katzgrau\\KLogger\\Logger' => $vendorDir . '/katzgrau/klogger/src/Logger.php', + 'Laminas\\Db\\Adapter\\Adapter' => $vendorDir . '/laminas/laminas-db/src/Adapter/Adapter.php', + 'Laminas\\Db\\Adapter\\AdapterAbstractServiceFactory' => $vendorDir . '/laminas/laminas-db/src/Adapter/AdapterAbstractServiceFactory.php', + 'Laminas\\Db\\Adapter\\AdapterAwareInterface' => $vendorDir . '/laminas/laminas-db/src/Adapter/AdapterAwareInterface.php', + 'Laminas\\Db\\Adapter\\AdapterAwareTrait' => $vendorDir . '/laminas/laminas-db/src/Adapter/AdapterAwareTrait.php', + 'Laminas\\Db\\Adapter\\AdapterInterface' => $vendorDir . '/laminas/laminas-db/src/Adapter/AdapterInterface.php', + 'Laminas\\Db\\Adapter\\AdapterServiceFactory' => $vendorDir . '/laminas/laminas-db/src/Adapter/AdapterServiceFactory.php', + 'Laminas\\Db\\Adapter\\Driver\\AbstractConnection' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/AbstractConnection.php', + 'Laminas\\Db\\Adapter\\Driver\\ConnectionInterface' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/ConnectionInterface.php', + 'Laminas\\Db\\Adapter\\Driver\\DriverInterface' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/DriverInterface.php', + 'Laminas\\Db\\Adapter\\Driver\\Feature\\AbstractFeature' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Feature/AbstractFeature.php', + 'Laminas\\Db\\Adapter\\Driver\\Feature\\DriverFeatureInterface' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Feature/DriverFeatureInterface.php', + 'Laminas\\Db\\Adapter\\Driver\\IbmDb2\\Connection' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/IbmDb2/Connection.php', + 'Laminas\\Db\\Adapter\\Driver\\IbmDb2\\IbmDb2' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/IbmDb2/IbmDb2.php', + 'Laminas\\Db\\Adapter\\Driver\\IbmDb2\\Result' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/IbmDb2/Result.php', + 'Laminas\\Db\\Adapter\\Driver\\IbmDb2\\Statement' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/IbmDb2/Statement.php', + 'Laminas\\Db\\Adapter\\Driver\\Mysqli\\Connection' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Mysqli/Connection.php', + 'Laminas\\Db\\Adapter\\Driver\\Mysqli\\Mysqli' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Mysqli/Mysqli.php', + 'Laminas\\Db\\Adapter\\Driver\\Mysqli\\Result' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Mysqli/Result.php', + 'Laminas\\Db\\Adapter\\Driver\\Mysqli\\Statement' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Mysqli/Statement.php', + 'Laminas\\Db\\Adapter\\Driver\\Oci8\\Connection' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Oci8/Connection.php', + 'Laminas\\Db\\Adapter\\Driver\\Oci8\\Feature\\RowCounter' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Oci8/Feature/RowCounter.php', + 'Laminas\\Db\\Adapter\\Driver\\Oci8\\Oci8' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Oci8/Oci8.php', + 'Laminas\\Db\\Adapter\\Driver\\Oci8\\Result' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Oci8/Result.php', + 'Laminas\\Db\\Adapter\\Driver\\Oci8\\Statement' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Oci8/Statement.php', + 'Laminas\\Db\\Adapter\\Driver\\Pdo\\Connection' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Pdo/Connection.php', + 'Laminas\\Db\\Adapter\\Driver\\Pdo\\Feature\\OracleRowCounter' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Pdo/Feature/OracleRowCounter.php', + 'Laminas\\Db\\Adapter\\Driver\\Pdo\\Feature\\SqliteRowCounter' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Pdo/Feature/SqliteRowCounter.php', + 'Laminas\\Db\\Adapter\\Driver\\Pdo\\Pdo' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Pdo/Pdo.php', + 'Laminas\\Db\\Adapter\\Driver\\Pdo\\Result' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Pdo/Result.php', + 'Laminas\\Db\\Adapter\\Driver\\Pdo\\Statement' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Pdo/Statement.php', + 'Laminas\\Db\\Adapter\\Driver\\Pgsql\\Connection' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Pgsql/Connection.php', + 'Laminas\\Db\\Adapter\\Driver\\Pgsql\\Pgsql' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Pgsql/Pgsql.php', + 'Laminas\\Db\\Adapter\\Driver\\Pgsql\\Result' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Pgsql/Result.php', + 'Laminas\\Db\\Adapter\\Driver\\Pgsql\\Statement' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Pgsql/Statement.php', + 'Laminas\\Db\\Adapter\\Driver\\ResultInterface' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/ResultInterface.php', + 'Laminas\\Db\\Adapter\\Driver\\Sqlsrv\\Connection' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Sqlsrv/Connection.php', + 'Laminas\\Db\\Adapter\\Driver\\Sqlsrv\\Exception\\ErrorException' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Sqlsrv/Exception/ErrorException.php', + 'Laminas\\Db\\Adapter\\Driver\\Sqlsrv\\Exception\\ExceptionInterface' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Sqlsrv/Exception/ExceptionInterface.php', + 'Laminas\\Db\\Adapter\\Driver\\Sqlsrv\\Result' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Sqlsrv/Result.php', + 'Laminas\\Db\\Adapter\\Driver\\Sqlsrv\\Sqlsrv' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Sqlsrv/Sqlsrv.php', + 'Laminas\\Db\\Adapter\\Driver\\Sqlsrv\\Statement' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/Sqlsrv/Statement.php', + 'Laminas\\Db\\Adapter\\Driver\\StatementInterface' => $vendorDir . '/laminas/laminas-db/src/Adapter/Driver/StatementInterface.php', + 'Laminas\\Db\\Adapter\\Exception\\ErrorException' => $vendorDir . '/laminas/laminas-db/src/Adapter/Exception/ErrorException.php', + 'Laminas\\Db\\Adapter\\Exception\\ExceptionInterface' => $vendorDir . '/laminas/laminas-db/src/Adapter/Exception/ExceptionInterface.php', + 'Laminas\\Db\\Adapter\\Exception\\InvalidArgumentException' => $vendorDir . '/laminas/laminas-db/src/Adapter/Exception/InvalidArgumentException.php', + 'Laminas\\Db\\Adapter\\Exception\\InvalidConnectionParametersException' => $vendorDir . '/laminas/laminas-db/src/Adapter/Exception/InvalidConnectionParametersException.php', + 'Laminas\\Db\\Adapter\\Exception\\InvalidQueryException' => $vendorDir . '/laminas/laminas-db/src/Adapter/Exception/InvalidQueryException.php', + 'Laminas\\Db\\Adapter\\Exception\\RuntimeException' => $vendorDir . '/laminas/laminas-db/src/Adapter/Exception/RuntimeException.php', + 'Laminas\\Db\\Adapter\\Exception\\UnexpectedValueException' => $vendorDir . '/laminas/laminas-db/src/Adapter/Exception/UnexpectedValueException.php', + 'Laminas\\Db\\Adapter\\ParameterContainer' => $vendorDir . '/laminas/laminas-db/src/Adapter/ParameterContainer.php', + 'Laminas\\Db\\Adapter\\Platform\\AbstractPlatform' => $vendorDir . '/laminas/laminas-db/src/Adapter/Platform/AbstractPlatform.php', + 'Laminas\\Db\\Adapter\\Platform\\IbmDb2' => $vendorDir . '/laminas/laminas-db/src/Adapter/Platform/IbmDb2.php', + 'Laminas\\Db\\Adapter\\Platform\\Mysql' => $vendorDir . '/laminas/laminas-db/src/Adapter/Platform/Mysql.php', + 'Laminas\\Db\\Adapter\\Platform\\Oracle' => $vendorDir . '/laminas/laminas-db/src/Adapter/Platform/Oracle.php', + 'Laminas\\Db\\Adapter\\Platform\\PlatformInterface' => $vendorDir . '/laminas/laminas-db/src/Adapter/Platform/PlatformInterface.php', + 'Laminas\\Db\\Adapter\\Platform\\Postgresql' => $vendorDir . '/laminas/laminas-db/src/Adapter/Platform/Postgresql.php', + 'Laminas\\Db\\Adapter\\Platform\\Sql92' => $vendorDir . '/laminas/laminas-db/src/Adapter/Platform/Sql92.php', + 'Laminas\\Db\\Adapter\\Platform\\SqlServer' => $vendorDir . '/laminas/laminas-db/src/Adapter/Platform/SqlServer.php', + 'Laminas\\Db\\Adapter\\Platform\\Sqlite' => $vendorDir . '/laminas/laminas-db/src/Adapter/Platform/Sqlite.php', + 'Laminas\\Db\\Adapter\\Profiler\\Profiler' => $vendorDir . '/laminas/laminas-db/src/Adapter/Profiler/Profiler.php', + 'Laminas\\Db\\Adapter\\Profiler\\ProfilerAwareInterface' => $vendorDir . '/laminas/laminas-db/src/Adapter/Profiler/ProfilerAwareInterface.php', + 'Laminas\\Db\\Adapter\\Profiler\\ProfilerInterface' => $vendorDir . '/laminas/laminas-db/src/Adapter/Profiler/ProfilerInterface.php', + 'Laminas\\Db\\Adapter\\StatementContainer' => $vendorDir . '/laminas/laminas-db/src/Adapter/StatementContainer.php', + 'Laminas\\Db\\Adapter\\StatementContainerInterface' => $vendorDir . '/laminas/laminas-db/src/Adapter/StatementContainerInterface.php', + 'Laminas\\Db\\ConfigProvider' => $vendorDir . '/laminas/laminas-db/src/ConfigProvider.php', + 'Laminas\\Db\\Exception\\ErrorException' => $vendorDir . '/laminas/laminas-db/src/Exception/ErrorException.php', + 'Laminas\\Db\\Exception\\ExceptionInterface' => $vendorDir . '/laminas/laminas-db/src/Exception/ExceptionInterface.php', + 'Laminas\\Db\\Exception\\InvalidArgumentException' => $vendorDir . '/laminas/laminas-db/src/Exception/InvalidArgumentException.php', + 'Laminas\\Db\\Exception\\RuntimeException' => $vendorDir . '/laminas/laminas-db/src/Exception/RuntimeException.php', + 'Laminas\\Db\\Exception\\UnexpectedValueException' => $vendorDir . '/laminas/laminas-db/src/Exception/UnexpectedValueException.php', + 'Laminas\\Db\\Metadata\\Metadata' => $vendorDir . '/laminas/laminas-db/src/Metadata/Metadata.php', + 'Laminas\\Db\\Metadata\\MetadataInterface' => $vendorDir . '/laminas/laminas-db/src/Metadata/MetadataInterface.php', + 'Laminas\\Db\\Metadata\\Object\\AbstractTableObject' => $vendorDir . '/laminas/laminas-db/src/Metadata/Object/AbstractTableObject.php', + 'Laminas\\Db\\Metadata\\Object\\ColumnObject' => $vendorDir . '/laminas/laminas-db/src/Metadata/Object/ColumnObject.php', + 'Laminas\\Db\\Metadata\\Object\\ConstraintKeyObject' => $vendorDir . '/laminas/laminas-db/src/Metadata/Object/ConstraintKeyObject.php', + 'Laminas\\Db\\Metadata\\Object\\ConstraintObject' => $vendorDir . '/laminas/laminas-db/src/Metadata/Object/ConstraintObject.php', + 'Laminas\\Db\\Metadata\\Object\\TableObject' => $vendorDir . '/laminas/laminas-db/src/Metadata/Object/TableObject.php', + 'Laminas\\Db\\Metadata\\Object\\TriggerObject' => $vendorDir . '/laminas/laminas-db/src/Metadata/Object/TriggerObject.php', + 'Laminas\\Db\\Metadata\\Object\\ViewObject' => $vendorDir . '/laminas/laminas-db/src/Metadata/Object/ViewObject.php', + 'Laminas\\Db\\Metadata\\Source\\AbstractSource' => $vendorDir . '/laminas/laminas-db/src/Metadata/Source/AbstractSource.php', + 'Laminas\\Db\\Metadata\\Source\\Factory' => $vendorDir . '/laminas/laminas-db/src/Metadata/Source/Factory.php', + 'Laminas\\Db\\Metadata\\Source\\MysqlMetadata' => $vendorDir . '/laminas/laminas-db/src/Metadata/Source/MysqlMetadata.php', + 'Laminas\\Db\\Metadata\\Source\\OracleMetadata' => $vendorDir . '/laminas/laminas-db/src/Metadata/Source/OracleMetadata.php', + 'Laminas\\Db\\Metadata\\Source\\PostgresqlMetadata' => $vendorDir . '/laminas/laminas-db/src/Metadata/Source/PostgresqlMetadata.php', + 'Laminas\\Db\\Metadata\\Source\\SqlServerMetadata' => $vendorDir . '/laminas/laminas-db/src/Metadata/Source/SqlServerMetadata.php', + 'Laminas\\Db\\Metadata\\Source\\SqliteMetadata' => $vendorDir . '/laminas/laminas-db/src/Metadata/Source/SqliteMetadata.php', + 'Laminas\\Db\\Module' => $vendorDir . '/laminas/laminas-db/src/Module.php', + 'Laminas\\Db\\ResultSet\\AbstractResultSet' => $vendorDir . '/laminas/laminas-db/src/ResultSet/AbstractResultSet.php', + 'Laminas\\Db\\ResultSet\\Exception\\ExceptionInterface' => $vendorDir . '/laminas/laminas-db/src/ResultSet/Exception/ExceptionInterface.php', + 'Laminas\\Db\\ResultSet\\Exception\\InvalidArgumentException' => $vendorDir . '/laminas/laminas-db/src/ResultSet/Exception/InvalidArgumentException.php', + 'Laminas\\Db\\ResultSet\\Exception\\RuntimeException' => $vendorDir . '/laminas/laminas-db/src/ResultSet/Exception/RuntimeException.php', + 'Laminas\\Db\\ResultSet\\HydratingResultSet' => $vendorDir . '/laminas/laminas-db/src/ResultSet/HydratingResultSet.php', + 'Laminas\\Db\\ResultSet\\ResultSet' => $vendorDir . '/laminas/laminas-db/src/ResultSet/ResultSet.php', + 'Laminas\\Db\\ResultSet\\ResultSetInterface' => $vendorDir . '/laminas/laminas-db/src/ResultSet/ResultSetInterface.php', + 'Laminas\\Db\\RowGateway\\AbstractRowGateway' => $vendorDir . '/laminas/laminas-db/src/RowGateway/AbstractRowGateway.php', + 'Laminas\\Db\\RowGateway\\Exception\\ExceptionInterface' => $vendorDir . '/laminas/laminas-db/src/RowGateway/Exception/ExceptionInterface.php', + 'Laminas\\Db\\RowGateway\\Exception\\InvalidArgumentException' => $vendorDir . '/laminas/laminas-db/src/RowGateway/Exception/InvalidArgumentException.php', + 'Laminas\\Db\\RowGateway\\Exception\\RuntimeException' => $vendorDir . '/laminas/laminas-db/src/RowGateway/Exception/RuntimeException.php', + 'Laminas\\Db\\RowGateway\\Feature\\AbstractFeature' => $vendorDir . '/laminas/laminas-db/src/RowGateway/Feature/AbstractFeature.php', + 'Laminas\\Db\\RowGateway\\Feature\\FeatureSet' => $vendorDir . '/laminas/laminas-db/src/RowGateway/Feature/FeatureSet.php', + 'Laminas\\Db\\RowGateway\\RowGateway' => $vendorDir . '/laminas/laminas-db/src/RowGateway/RowGateway.php', + 'Laminas\\Db\\RowGateway\\RowGatewayInterface' => $vendorDir . '/laminas/laminas-db/src/RowGateway/RowGatewayInterface.php', + 'Laminas\\Db\\Sql\\AbstractExpression' => $vendorDir . '/laminas/laminas-db/src/Sql/AbstractExpression.php', + 'Laminas\\Db\\Sql\\AbstractPreparableSql' => $vendorDir . '/laminas/laminas-db/src/Sql/AbstractPreparableSql.php', + 'Laminas\\Db\\Sql\\AbstractSql' => $vendorDir . '/laminas/laminas-db/src/Sql/AbstractSql.php', + 'Laminas\\Db\\Sql\\Combine' => $vendorDir . '/laminas/laminas-db/src/Sql/Combine.php', + 'Laminas\\Db\\Sql\\Ddl\\AlterTable' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/AlterTable.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\AbstractLengthColumn' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Column/AbstractLengthColumn.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\AbstractPrecisionColumn' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Column/AbstractPrecisionColumn.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\AbstractTimestampColumn' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Column/AbstractTimestampColumn.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\BigInteger' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Column/BigInteger.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Binary' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Column/Binary.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Blob' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Column/Blob.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Boolean' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Column/Boolean.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Char' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Column/Char.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Column' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Column/Column.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\ColumnInterface' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Column/ColumnInterface.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Date' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Column/Date.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Datetime' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Column/Datetime.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Decimal' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Column/Decimal.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Float' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Column/Float.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Floating' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Column/Floating.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Integer' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Column/Integer.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Text' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Column/Text.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Time' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Column/Time.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Timestamp' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Column/Timestamp.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Varbinary' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Column/Varbinary.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Varchar' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Column/Varchar.php', + 'Laminas\\Db\\Sql\\Ddl\\Constraint\\AbstractConstraint' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Constraint/AbstractConstraint.php', + 'Laminas\\Db\\Sql\\Ddl\\Constraint\\Check' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Constraint/Check.php', + 'Laminas\\Db\\Sql\\Ddl\\Constraint\\ConstraintInterface' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Constraint/ConstraintInterface.php', + 'Laminas\\Db\\Sql\\Ddl\\Constraint\\ForeignKey' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Constraint/ForeignKey.php', + 'Laminas\\Db\\Sql\\Ddl\\Constraint\\PrimaryKey' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Constraint/PrimaryKey.php', + 'Laminas\\Db\\Sql\\Ddl\\Constraint\\UniqueKey' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Constraint/UniqueKey.php', + 'Laminas\\Db\\Sql\\Ddl\\CreateTable' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/CreateTable.php', + 'Laminas\\Db\\Sql\\Ddl\\DropTable' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/DropTable.php', + 'Laminas\\Db\\Sql\\Ddl\\Index\\AbstractIndex' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Index/AbstractIndex.php', + 'Laminas\\Db\\Sql\\Ddl\\Index\\Index' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/Index/Index.php', + 'Laminas\\Db\\Sql\\Ddl\\SqlInterface' => $vendorDir . '/laminas/laminas-db/src/Sql/Ddl/SqlInterface.php', + 'Laminas\\Db\\Sql\\Delete' => $vendorDir . '/laminas/laminas-db/src/Sql/Delete.php', + 'Laminas\\Db\\Sql\\Exception\\ExceptionInterface' => $vendorDir . '/laminas/laminas-db/src/Sql/Exception/ExceptionInterface.php', + 'Laminas\\Db\\Sql\\Exception\\InvalidArgumentException' => $vendorDir . '/laminas/laminas-db/src/Sql/Exception/InvalidArgumentException.php', + 'Laminas\\Db\\Sql\\Exception\\RuntimeException' => $vendorDir . '/laminas/laminas-db/src/Sql/Exception/RuntimeException.php', + 'Laminas\\Db\\Sql\\Expression' => $vendorDir . '/laminas/laminas-db/src/Sql/Expression.php', + 'Laminas\\Db\\Sql\\ExpressionInterface' => $vendorDir . '/laminas/laminas-db/src/Sql/ExpressionInterface.php', + 'Laminas\\Db\\Sql\\Having' => $vendorDir . '/laminas/laminas-db/src/Sql/Having.php', + 'Laminas\\Db\\Sql\\Insert' => $vendorDir . '/laminas/laminas-db/src/Sql/Insert.php', + 'Laminas\\Db\\Sql\\InsertIgnore' => $vendorDir . '/laminas/laminas-db/src/Sql/InsertIgnore.php', + 'Laminas\\Db\\Sql\\Join' => $vendorDir . '/laminas/laminas-db/src/Sql/Join.php', + 'Laminas\\Db\\Sql\\Literal' => $vendorDir . '/laminas/laminas-db/src/Sql/Literal.php', + 'Laminas\\Db\\Sql\\Platform\\AbstractPlatform' => $vendorDir . '/laminas/laminas-db/src/Sql/Platform/AbstractPlatform.php', + 'Laminas\\Db\\Sql\\Platform\\IbmDb2\\IbmDb2' => $vendorDir . '/laminas/laminas-db/src/Sql/Platform/IbmDb2/IbmDb2.php', + 'Laminas\\Db\\Sql\\Platform\\IbmDb2\\SelectDecorator' => $vendorDir . '/laminas/laminas-db/src/Sql/Platform/IbmDb2/SelectDecorator.php', + 'Laminas\\Db\\Sql\\Platform\\Mysql\\Ddl\\AlterTableDecorator' => $vendorDir . '/laminas/laminas-db/src/Sql/Platform/Mysql/Ddl/AlterTableDecorator.php', + 'Laminas\\Db\\Sql\\Platform\\Mysql\\Ddl\\CreateTableDecorator' => $vendorDir . '/laminas/laminas-db/src/Sql/Platform/Mysql/Ddl/CreateTableDecorator.php', + 'Laminas\\Db\\Sql\\Platform\\Mysql\\Mysql' => $vendorDir . '/laminas/laminas-db/src/Sql/Platform/Mysql/Mysql.php', + 'Laminas\\Db\\Sql\\Platform\\Mysql\\SelectDecorator' => $vendorDir . '/laminas/laminas-db/src/Sql/Platform/Mysql/SelectDecorator.php', + 'Laminas\\Db\\Sql\\Platform\\Oracle\\Oracle' => $vendorDir . '/laminas/laminas-db/src/Sql/Platform/Oracle/Oracle.php', + 'Laminas\\Db\\Sql\\Platform\\Oracle\\SelectDecorator' => $vendorDir . '/laminas/laminas-db/src/Sql/Platform/Oracle/SelectDecorator.php', + 'Laminas\\Db\\Sql\\Platform\\Platform' => $vendorDir . '/laminas/laminas-db/src/Sql/Platform/Platform.php', + 'Laminas\\Db\\Sql\\Platform\\PlatformDecoratorInterface' => $vendorDir . '/laminas/laminas-db/src/Sql/Platform/PlatformDecoratorInterface.php', + 'Laminas\\Db\\Sql\\Platform\\SqlServer\\Ddl\\CreateTableDecorator' => $vendorDir . '/laminas/laminas-db/src/Sql/Platform/SqlServer/Ddl/CreateTableDecorator.php', + 'Laminas\\Db\\Sql\\Platform\\SqlServer\\SelectDecorator' => $vendorDir . '/laminas/laminas-db/src/Sql/Platform/SqlServer/SelectDecorator.php', + 'Laminas\\Db\\Sql\\Platform\\SqlServer\\SqlServer' => $vendorDir . '/laminas/laminas-db/src/Sql/Platform/SqlServer/SqlServer.php', + 'Laminas\\Db\\Sql\\Platform\\Sqlite\\SelectDecorator' => $vendorDir . '/laminas/laminas-db/src/Sql/Platform/Sqlite/SelectDecorator.php', + 'Laminas\\Db\\Sql\\Platform\\Sqlite\\Sqlite' => $vendorDir . '/laminas/laminas-db/src/Sql/Platform/Sqlite/Sqlite.php', + 'Laminas\\Db\\Sql\\Predicate\\Between' => $vendorDir . '/laminas/laminas-db/src/Sql/Predicate/Between.php', + 'Laminas\\Db\\Sql\\Predicate\\Expression' => $vendorDir . '/laminas/laminas-db/src/Sql/Predicate/Expression.php', + 'Laminas\\Db\\Sql\\Predicate\\In' => $vendorDir . '/laminas/laminas-db/src/Sql/Predicate/In.php', + 'Laminas\\Db\\Sql\\Predicate\\IsNotNull' => $vendorDir . '/laminas/laminas-db/src/Sql/Predicate/IsNotNull.php', + 'Laminas\\Db\\Sql\\Predicate\\IsNull' => $vendorDir . '/laminas/laminas-db/src/Sql/Predicate/IsNull.php', + 'Laminas\\Db\\Sql\\Predicate\\Like' => $vendorDir . '/laminas/laminas-db/src/Sql/Predicate/Like.php', + 'Laminas\\Db\\Sql\\Predicate\\Literal' => $vendorDir . '/laminas/laminas-db/src/Sql/Predicate/Literal.php', + 'Laminas\\Db\\Sql\\Predicate\\NotBetween' => $vendorDir . '/laminas/laminas-db/src/Sql/Predicate/NotBetween.php', + 'Laminas\\Db\\Sql\\Predicate\\NotIn' => $vendorDir . '/laminas/laminas-db/src/Sql/Predicate/NotIn.php', + 'Laminas\\Db\\Sql\\Predicate\\NotLike' => $vendorDir . '/laminas/laminas-db/src/Sql/Predicate/NotLike.php', + 'Laminas\\Db\\Sql\\Predicate\\Operator' => $vendorDir . '/laminas/laminas-db/src/Sql/Predicate/Operator.php', + 'Laminas\\Db\\Sql\\Predicate\\Predicate' => $vendorDir . '/laminas/laminas-db/src/Sql/Predicate/Predicate.php', + 'Laminas\\Db\\Sql\\Predicate\\PredicateInterface' => $vendorDir . '/laminas/laminas-db/src/Sql/Predicate/PredicateInterface.php', + 'Laminas\\Db\\Sql\\Predicate\\PredicateSet' => $vendorDir . '/laminas/laminas-db/src/Sql/Predicate/PredicateSet.php', + 'Laminas\\Db\\Sql\\PreparableSqlInterface' => $vendorDir . '/laminas/laminas-db/src/Sql/PreparableSqlInterface.php', + 'Laminas\\Db\\Sql\\Select' => $vendorDir . '/laminas/laminas-db/src/Sql/Select.php', + 'Laminas\\Db\\Sql\\Sql' => $vendorDir . '/laminas/laminas-db/src/Sql/Sql.php', + 'Laminas\\Db\\Sql\\SqlInterface' => $vendorDir . '/laminas/laminas-db/src/Sql/SqlInterface.php', + 'Laminas\\Db\\Sql\\TableIdentifier' => $vendorDir . '/laminas/laminas-db/src/Sql/TableIdentifier.php', + 'Laminas\\Db\\Sql\\Update' => $vendorDir . '/laminas/laminas-db/src/Sql/Update.php', + 'Laminas\\Db\\Sql\\Where' => $vendorDir . '/laminas/laminas-db/src/Sql/Where.php', + 'Laminas\\Db\\TableGateway\\AbstractTableGateway' => $vendorDir . '/laminas/laminas-db/src/TableGateway/AbstractTableGateway.php', + 'Laminas\\Db\\TableGateway\\Exception\\ExceptionInterface' => $vendorDir . '/laminas/laminas-db/src/TableGateway/Exception/ExceptionInterface.php', + 'Laminas\\Db\\TableGateway\\Exception\\InvalidArgumentException' => $vendorDir . '/laminas/laminas-db/src/TableGateway/Exception/InvalidArgumentException.php', + 'Laminas\\Db\\TableGateway\\Exception\\RuntimeException' => $vendorDir . '/laminas/laminas-db/src/TableGateway/Exception/RuntimeException.php', + 'Laminas\\Db\\TableGateway\\Feature\\AbstractFeature' => $vendorDir . '/laminas/laminas-db/src/TableGateway/Feature/AbstractFeature.php', + 'Laminas\\Db\\TableGateway\\Feature\\EventFeature' => $vendorDir . '/laminas/laminas-db/src/TableGateway/Feature/EventFeature.php', + 'Laminas\\Db\\TableGateway\\Feature\\EventFeatureEventsInterface' => $vendorDir . '/laminas/laminas-db/src/TableGateway/Feature/EventFeatureEventsInterface.php', + 'Laminas\\Db\\TableGateway\\Feature\\EventFeature\\TableGatewayEvent' => $vendorDir . '/laminas/laminas-db/src/TableGateway/Feature/EventFeature/TableGatewayEvent.php', + 'Laminas\\Db\\TableGateway\\Feature\\FeatureSet' => $vendorDir . '/laminas/laminas-db/src/TableGateway/Feature/FeatureSet.php', + 'Laminas\\Db\\TableGateway\\Feature\\GlobalAdapterFeature' => $vendorDir . '/laminas/laminas-db/src/TableGateway/Feature/GlobalAdapterFeature.php', + 'Laminas\\Db\\TableGateway\\Feature\\MasterSlaveFeature' => $vendorDir . '/laminas/laminas-db/src/TableGateway/Feature/MasterSlaveFeature.php', + 'Laminas\\Db\\TableGateway\\Feature\\MetadataFeature' => $vendorDir . '/laminas/laminas-db/src/TableGateway/Feature/MetadataFeature.php', + 'Laminas\\Db\\TableGateway\\Feature\\RowGatewayFeature' => $vendorDir . '/laminas/laminas-db/src/TableGateway/Feature/RowGatewayFeature.php', + 'Laminas\\Db\\TableGateway\\Feature\\SequenceFeature' => $vendorDir . '/laminas/laminas-db/src/TableGateway/Feature/SequenceFeature.php', + 'Laminas\\Db\\TableGateway\\TableGateway' => $vendorDir . '/laminas/laminas-db/src/TableGateway/TableGateway.php', + 'Laminas\\Db\\TableGateway\\TableGatewayInterface' => $vendorDir . '/laminas/laminas-db/src/TableGateway/TableGatewayInterface.php', + 'Laminas\\Stdlib\\AbstractOptions' => $vendorDir . '/laminas/laminas-stdlib/src/AbstractOptions.php', + 'Laminas\\Stdlib\\ArrayObject' => $vendorDir . '/laminas/laminas-stdlib/src/ArrayObject.php', + 'Laminas\\Stdlib\\ArraySerializableInterface' => $vendorDir . '/laminas/laminas-stdlib/src/ArraySerializableInterface.php', + 'Laminas\\Stdlib\\ArrayStack' => $vendorDir . '/laminas/laminas-stdlib/src/ArrayStack.php', + 'Laminas\\Stdlib\\ArrayUtils' => $vendorDir . '/laminas/laminas-stdlib/src/ArrayUtils.php', + 'Laminas\\Stdlib\\ArrayUtils\\MergeRemoveKey' => $vendorDir . '/laminas/laminas-stdlib/src/ArrayUtils/MergeRemoveKey.php', + 'Laminas\\Stdlib\\ArrayUtils\\MergeReplaceKey' => $vendorDir . '/laminas/laminas-stdlib/src/ArrayUtils/MergeReplaceKey.php', + 'Laminas\\Stdlib\\ArrayUtils\\MergeReplaceKeyInterface' => $vendorDir . '/laminas/laminas-stdlib/src/ArrayUtils/MergeReplaceKeyInterface.php', + 'Laminas\\Stdlib\\ConsoleHelper' => $vendorDir . '/laminas/laminas-stdlib/src/ConsoleHelper.php', + 'Laminas\\Stdlib\\DispatchableInterface' => $vendorDir . '/laminas/laminas-stdlib/src/DispatchableInterface.php', + 'Laminas\\Stdlib\\ErrorHandler' => $vendorDir . '/laminas/laminas-stdlib/src/ErrorHandler.php', + 'Laminas\\Stdlib\\Exception\\BadMethodCallException' => $vendorDir . '/laminas/laminas-stdlib/src/Exception/BadMethodCallException.php', + 'Laminas\\Stdlib\\Exception\\DomainException' => $vendorDir . '/laminas/laminas-stdlib/src/Exception/DomainException.php', + 'Laminas\\Stdlib\\Exception\\ExceptionInterface' => $vendorDir . '/laminas/laminas-stdlib/src/Exception/ExceptionInterface.php', + 'Laminas\\Stdlib\\Exception\\ExtensionNotLoadedException' => $vendorDir . '/laminas/laminas-stdlib/src/Exception/ExtensionNotLoadedException.php', + 'Laminas\\Stdlib\\Exception\\InvalidArgumentException' => $vendorDir . '/laminas/laminas-stdlib/src/Exception/InvalidArgumentException.php', + 'Laminas\\Stdlib\\Exception\\LogicException' => $vendorDir . '/laminas/laminas-stdlib/src/Exception/LogicException.php', + 'Laminas\\Stdlib\\Exception\\RuntimeException' => $vendorDir . '/laminas/laminas-stdlib/src/Exception/RuntimeException.php', + 'Laminas\\Stdlib\\FastPriorityQueue' => $vendorDir . '/laminas/laminas-stdlib/src/FastPriorityQueue.php', + 'Laminas\\Stdlib\\Glob' => $vendorDir . '/laminas/laminas-stdlib/src/Glob.php', + 'Laminas\\Stdlib\\Guard\\AllGuardsTrait' => $vendorDir . '/laminas/laminas-stdlib/src/Guard/AllGuardsTrait.php', + 'Laminas\\Stdlib\\Guard\\ArrayOrTraversableGuardTrait' => $vendorDir . '/laminas/laminas-stdlib/src/Guard/ArrayOrTraversableGuardTrait.php', + 'Laminas\\Stdlib\\Guard\\EmptyGuardTrait' => $vendorDir . '/laminas/laminas-stdlib/src/Guard/EmptyGuardTrait.php', + 'Laminas\\Stdlib\\Guard\\NullGuardTrait' => $vendorDir . '/laminas/laminas-stdlib/src/Guard/NullGuardTrait.php', + 'Laminas\\Stdlib\\InitializableInterface' => $vendorDir . '/laminas/laminas-stdlib/src/InitializableInterface.php', + 'Laminas\\Stdlib\\JsonSerializable' => $vendorDir . '/laminas/laminas-stdlib/src/JsonSerializable.php', + 'Laminas\\Stdlib\\Message' => $vendorDir . '/laminas/laminas-stdlib/src/Message.php', + 'Laminas\\Stdlib\\MessageInterface' => $vendorDir . '/laminas/laminas-stdlib/src/MessageInterface.php', + 'Laminas\\Stdlib\\ParameterObjectInterface' => $vendorDir . '/laminas/laminas-stdlib/src/ParameterObjectInterface.php', + 'Laminas\\Stdlib\\Parameters' => $vendorDir . '/laminas/laminas-stdlib/src/Parameters.php', + 'Laminas\\Stdlib\\ParametersInterface' => $vendorDir . '/laminas/laminas-stdlib/src/ParametersInterface.php', + 'Laminas\\Stdlib\\PriorityList' => $vendorDir . '/laminas/laminas-stdlib/src/PriorityList.php', + 'Laminas\\Stdlib\\PriorityQueue' => $vendorDir . '/laminas/laminas-stdlib/src/PriorityQueue.php', + 'Laminas\\Stdlib\\Request' => $vendorDir . '/laminas/laminas-stdlib/src/Request.php', + 'Laminas\\Stdlib\\RequestInterface' => $vendorDir . '/laminas/laminas-stdlib/src/RequestInterface.php', + 'Laminas\\Stdlib\\Response' => $vendorDir . '/laminas/laminas-stdlib/src/Response.php', + 'Laminas\\Stdlib\\ResponseInterface' => $vendorDir . '/laminas/laminas-stdlib/src/ResponseInterface.php', + 'Laminas\\Stdlib\\SplPriorityQueue' => $vendorDir . '/laminas/laminas-stdlib/src/SplPriorityQueue.php', + 'Laminas\\Stdlib\\SplQueue' => $vendorDir . '/laminas/laminas-stdlib/src/SplQueue.php', + 'Laminas\\Stdlib\\SplStack' => $vendorDir . '/laminas/laminas-stdlib/src/SplStack.php', + 'Laminas\\Stdlib\\StringUtils' => $vendorDir . '/laminas/laminas-stdlib/src/StringUtils.php', + 'Laminas\\Stdlib\\StringWrapper\\AbstractStringWrapper' => $vendorDir . '/laminas/laminas-stdlib/src/StringWrapper/AbstractStringWrapper.php', + 'Laminas\\Stdlib\\StringWrapper\\Iconv' => $vendorDir . '/laminas/laminas-stdlib/src/StringWrapper/Iconv.php', + 'Laminas\\Stdlib\\StringWrapper\\Intl' => $vendorDir . '/laminas/laminas-stdlib/src/StringWrapper/Intl.php', + 'Laminas\\Stdlib\\StringWrapper\\MbString' => $vendorDir . '/laminas/laminas-stdlib/src/StringWrapper/MbString.php', + 'Laminas\\Stdlib\\StringWrapper\\Native' => $vendorDir . '/laminas/laminas-stdlib/src/StringWrapper/Native.php', + 'Laminas\\Stdlib\\StringWrapper\\StringWrapperInterface' => $vendorDir . '/laminas/laminas-stdlib/src/StringWrapper/StringWrapperInterface.php', + 'Laminas\\ZendFrameworkBridge\\Autoloader' => $vendorDir . '/laminas/laminas-zendframework-bridge/src/Autoloader.php', + 'Laminas\\ZendFrameworkBridge\\ConfigPostProcessor' => $vendorDir . '/laminas/laminas-zendframework-bridge/src/ConfigPostProcessor.php', + 'Laminas\\ZendFrameworkBridge\\Module' => $vendorDir . '/laminas/laminas-zendframework-bridge/src/Module.php', + 'Laminas\\ZendFrameworkBridge\\Replacements' => $vendorDir . '/laminas/laminas-zendframework-bridge/src/Replacements.php', + 'Laminas\\ZendFrameworkBridge\\RewriteRules' => $vendorDir . '/laminas/laminas-zendframework-bridge/src/RewriteRules.php', 'Psr\\Log\\AbstractLogger' => $vendorDir . '/psr/log/Psr/Log/AbstractLogger.php', 'Psr\\Log\\InvalidArgumentException' => $vendorDir . '/psr/log/Psr/Log/InvalidArgumentException.php', 'Psr\\Log\\LogLevel' => $vendorDir . '/psr/log/Psr/Log/LogLevel.php', @@ -15,260 +271,10 @@ return array( 'Psr\\Log\\LoggerInterface' => $vendorDir . '/psr/log/Psr/Log/LoggerInterface.php', 'Psr\\Log\\LoggerTrait' => $vendorDir . '/psr/log/Psr/Log/LoggerTrait.php', 'Psr\\Log\\NullLogger' => $vendorDir . '/psr/log/Psr/Log/NullLogger.php', - 'Psr\\Log\\Test\\DummyTest' => $vendorDir . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php', 'Psr\\Log\\Test\\LoggerInterfaceTest' => $vendorDir . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php', 'Psr\\SimpleCache\\CacheException' => $vendorDir . '/psr/simple-cache/src/CacheException.php', 'Psr\\SimpleCache\\CacheInterface' => $vendorDir . '/psr/simple-cache/src/CacheInterface.php', 'Psr\\SimpleCache\\InvalidArgumentException' => $vendorDir . '/psr/simple-cache/src/InvalidArgumentException.php', - 'Zend\\Db\\Adapter\\Adapter' => $vendorDir . '/zendframework/zend-db/src/Adapter/Adapter.php', - 'Zend\\Db\\Adapter\\AdapterAbstractServiceFactory' => $vendorDir . '/zendframework/zend-db/src/Adapter/AdapterAbstractServiceFactory.php', - 'Zend\\Db\\Adapter\\AdapterAwareInterface' => $vendorDir . '/zendframework/zend-db/src/Adapter/AdapterAwareInterface.php', - 'Zend\\Db\\Adapter\\AdapterAwareTrait' => $vendorDir . '/zendframework/zend-db/src/Adapter/AdapterAwareTrait.php', - 'Zend\\Db\\Adapter\\AdapterInterface' => $vendorDir . '/zendframework/zend-db/src/Adapter/AdapterInterface.php', - 'Zend\\Db\\Adapter\\AdapterServiceFactory' => $vendorDir . '/zendframework/zend-db/src/Adapter/AdapterServiceFactory.php', - 'Zend\\Db\\Adapter\\Driver\\AbstractConnection' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/AbstractConnection.php', - 'Zend\\Db\\Adapter\\Driver\\ConnectionInterface' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/ConnectionInterface.php', - 'Zend\\Db\\Adapter\\Driver\\DriverInterface' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/DriverInterface.php', - 'Zend\\Db\\Adapter\\Driver\\Feature\\AbstractFeature' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Feature/AbstractFeature.php', - 'Zend\\Db\\Adapter\\Driver\\Feature\\DriverFeatureInterface' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Feature/DriverFeatureInterface.php', - 'Zend\\Db\\Adapter\\Driver\\IbmDb2\\Connection' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/IbmDb2/Connection.php', - 'Zend\\Db\\Adapter\\Driver\\IbmDb2\\IbmDb2' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/IbmDb2/IbmDb2.php', - 'Zend\\Db\\Adapter\\Driver\\IbmDb2\\Result' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/IbmDb2/Result.php', - 'Zend\\Db\\Adapter\\Driver\\IbmDb2\\Statement' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/IbmDb2/Statement.php', - 'Zend\\Db\\Adapter\\Driver\\Mysqli\\Connection' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Mysqli/Connection.php', - 'Zend\\Db\\Adapter\\Driver\\Mysqli\\Mysqli' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Mysqli/Mysqli.php', - 'Zend\\Db\\Adapter\\Driver\\Mysqli\\Result' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Mysqli/Result.php', - 'Zend\\Db\\Adapter\\Driver\\Mysqli\\Statement' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Mysqli/Statement.php', - 'Zend\\Db\\Adapter\\Driver\\Oci8\\Connection' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Oci8/Connection.php', - 'Zend\\Db\\Adapter\\Driver\\Oci8\\Feature\\RowCounter' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Oci8/Feature/RowCounter.php', - 'Zend\\Db\\Adapter\\Driver\\Oci8\\Oci8' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Oci8/Oci8.php', - 'Zend\\Db\\Adapter\\Driver\\Oci8\\Result' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Oci8/Result.php', - 'Zend\\Db\\Adapter\\Driver\\Oci8\\Statement' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Oci8/Statement.php', - 'Zend\\Db\\Adapter\\Driver\\Pdo\\Connection' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Pdo/Connection.php', - 'Zend\\Db\\Adapter\\Driver\\Pdo\\Feature\\OracleRowCounter' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Pdo/Feature/OracleRowCounter.php', - 'Zend\\Db\\Adapter\\Driver\\Pdo\\Feature\\SqliteRowCounter' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Pdo/Feature/SqliteRowCounter.php', - 'Zend\\Db\\Adapter\\Driver\\Pdo\\Pdo' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Pdo/Pdo.php', - 'Zend\\Db\\Adapter\\Driver\\Pdo\\Result' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Pdo/Result.php', - 'Zend\\Db\\Adapter\\Driver\\Pdo\\Statement' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Pdo/Statement.php', - 'Zend\\Db\\Adapter\\Driver\\Pgsql\\Connection' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Pgsql/Connection.php', - 'Zend\\Db\\Adapter\\Driver\\Pgsql\\Pgsql' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Pgsql/Pgsql.php', - 'Zend\\Db\\Adapter\\Driver\\Pgsql\\Result' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Pgsql/Result.php', - 'Zend\\Db\\Adapter\\Driver\\Pgsql\\Statement' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Pgsql/Statement.php', - 'Zend\\Db\\Adapter\\Driver\\ResultInterface' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/ResultInterface.php', - 'Zend\\Db\\Adapter\\Driver\\Sqlsrv\\Connection' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Connection.php', - 'Zend\\Db\\Adapter\\Driver\\Sqlsrv\\Exception\\ErrorException' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Exception/ErrorException.php', - 'Zend\\Db\\Adapter\\Driver\\Sqlsrv\\Exception\\ExceptionInterface' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Exception/ExceptionInterface.php', - 'Zend\\Db\\Adapter\\Driver\\Sqlsrv\\Result' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Result.php', - 'Zend\\Db\\Adapter\\Driver\\Sqlsrv\\Sqlsrv' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Sqlsrv.php', - 'Zend\\Db\\Adapter\\Driver\\Sqlsrv\\Statement' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Statement.php', - 'Zend\\Db\\Adapter\\Driver\\StatementInterface' => $vendorDir . '/zendframework/zend-db/src/Adapter/Driver/StatementInterface.php', - 'Zend\\Db\\Adapter\\Exception\\ErrorException' => $vendorDir . '/zendframework/zend-db/src/Adapter/Exception/ErrorException.php', - 'Zend\\Db\\Adapter\\Exception\\ExceptionInterface' => $vendorDir . '/zendframework/zend-db/src/Adapter/Exception/ExceptionInterface.php', - 'Zend\\Db\\Adapter\\Exception\\InvalidArgumentException' => $vendorDir . '/zendframework/zend-db/src/Adapter/Exception/InvalidArgumentException.php', - 'Zend\\Db\\Adapter\\Exception\\InvalidConnectionParametersException' => $vendorDir . '/zendframework/zend-db/src/Adapter/Exception/InvalidConnectionParametersException.php', - 'Zend\\Db\\Adapter\\Exception\\InvalidQueryException' => $vendorDir . '/zendframework/zend-db/src/Adapter/Exception/InvalidQueryException.php', - 'Zend\\Db\\Adapter\\Exception\\RuntimeException' => $vendorDir . '/zendframework/zend-db/src/Adapter/Exception/RuntimeException.php', - 'Zend\\Db\\Adapter\\Exception\\UnexpectedValueException' => $vendorDir . '/zendframework/zend-db/src/Adapter/Exception/UnexpectedValueException.php', - 'Zend\\Db\\Adapter\\ParameterContainer' => $vendorDir . '/zendframework/zend-db/src/Adapter/ParameterContainer.php', - 'Zend\\Db\\Adapter\\Platform\\AbstractPlatform' => $vendorDir . '/zendframework/zend-db/src/Adapter/Platform/AbstractPlatform.php', - 'Zend\\Db\\Adapter\\Platform\\IbmDb2' => $vendorDir . '/zendframework/zend-db/src/Adapter/Platform/IbmDb2.php', - 'Zend\\Db\\Adapter\\Platform\\Mysql' => $vendorDir . '/zendframework/zend-db/src/Adapter/Platform/Mysql.php', - 'Zend\\Db\\Adapter\\Platform\\Oracle' => $vendorDir . '/zendframework/zend-db/src/Adapter/Platform/Oracle.php', - 'Zend\\Db\\Adapter\\Platform\\PlatformInterface' => $vendorDir . '/zendframework/zend-db/src/Adapter/Platform/PlatformInterface.php', - 'Zend\\Db\\Adapter\\Platform\\Postgresql' => $vendorDir . '/zendframework/zend-db/src/Adapter/Platform/Postgresql.php', - 'Zend\\Db\\Adapter\\Platform\\Sql92' => $vendorDir . '/zendframework/zend-db/src/Adapter/Platform/Sql92.php', - 'Zend\\Db\\Adapter\\Platform\\SqlServer' => $vendorDir . '/zendframework/zend-db/src/Adapter/Platform/SqlServer.php', - 'Zend\\Db\\Adapter\\Platform\\Sqlite' => $vendorDir . '/zendframework/zend-db/src/Adapter/Platform/Sqlite.php', - 'Zend\\Db\\Adapter\\Profiler\\Profiler' => $vendorDir . '/zendframework/zend-db/src/Adapter/Profiler/Profiler.php', - 'Zend\\Db\\Adapter\\Profiler\\ProfilerAwareInterface' => $vendorDir . '/zendframework/zend-db/src/Adapter/Profiler/ProfilerAwareInterface.php', - 'Zend\\Db\\Adapter\\Profiler\\ProfilerInterface' => $vendorDir . '/zendframework/zend-db/src/Adapter/Profiler/ProfilerInterface.php', - 'Zend\\Db\\Adapter\\StatementContainer' => $vendorDir . '/zendframework/zend-db/src/Adapter/StatementContainer.php', - 'Zend\\Db\\Adapter\\StatementContainerInterface' => $vendorDir . '/zendframework/zend-db/src/Adapter/StatementContainerInterface.php', - 'Zend\\Db\\ConfigProvider' => $vendorDir . '/zendframework/zend-db/src/ConfigProvider.php', - 'Zend\\Db\\Exception\\ErrorException' => $vendorDir . '/zendframework/zend-db/src/Exception/ErrorException.php', - 'Zend\\Db\\Exception\\ExceptionInterface' => $vendorDir . '/zendframework/zend-db/src/Exception/ExceptionInterface.php', - 'Zend\\Db\\Exception\\InvalidArgumentException' => $vendorDir . '/zendframework/zend-db/src/Exception/InvalidArgumentException.php', - 'Zend\\Db\\Exception\\RuntimeException' => $vendorDir . '/zendframework/zend-db/src/Exception/RuntimeException.php', - 'Zend\\Db\\Exception\\UnexpectedValueException' => $vendorDir . '/zendframework/zend-db/src/Exception/UnexpectedValueException.php', - 'Zend\\Db\\Metadata\\Metadata' => $vendorDir . '/zendframework/zend-db/src/Metadata/Metadata.php', - 'Zend\\Db\\Metadata\\MetadataInterface' => $vendorDir . '/zendframework/zend-db/src/Metadata/MetadataInterface.php', - 'Zend\\Db\\Metadata\\Object\\AbstractTableObject' => $vendorDir . '/zendframework/zend-db/src/Metadata/Object/AbstractTableObject.php', - 'Zend\\Db\\Metadata\\Object\\ColumnObject' => $vendorDir . '/zendframework/zend-db/src/Metadata/Object/ColumnObject.php', - 'Zend\\Db\\Metadata\\Object\\ConstraintKeyObject' => $vendorDir . '/zendframework/zend-db/src/Metadata/Object/ConstraintKeyObject.php', - 'Zend\\Db\\Metadata\\Object\\ConstraintObject' => $vendorDir . '/zendframework/zend-db/src/Metadata/Object/ConstraintObject.php', - 'Zend\\Db\\Metadata\\Object\\TableObject' => $vendorDir . '/zendframework/zend-db/src/Metadata/Object/TableObject.php', - 'Zend\\Db\\Metadata\\Object\\TriggerObject' => $vendorDir . '/zendframework/zend-db/src/Metadata/Object/TriggerObject.php', - 'Zend\\Db\\Metadata\\Object\\ViewObject' => $vendorDir . '/zendframework/zend-db/src/Metadata/Object/ViewObject.php', - 'Zend\\Db\\Metadata\\Source\\AbstractSource' => $vendorDir . '/zendframework/zend-db/src/Metadata/Source/AbstractSource.php', - 'Zend\\Db\\Metadata\\Source\\Factory' => $vendorDir . '/zendframework/zend-db/src/Metadata/Source/Factory.php', - 'Zend\\Db\\Metadata\\Source\\MysqlMetadata' => $vendorDir . '/zendframework/zend-db/src/Metadata/Source/MysqlMetadata.php', - 'Zend\\Db\\Metadata\\Source\\OracleMetadata' => $vendorDir . '/zendframework/zend-db/src/Metadata/Source/OracleMetadata.php', - 'Zend\\Db\\Metadata\\Source\\PostgresqlMetadata' => $vendorDir . '/zendframework/zend-db/src/Metadata/Source/PostgresqlMetadata.php', - 'Zend\\Db\\Metadata\\Source\\SqlServerMetadata' => $vendorDir . '/zendframework/zend-db/src/Metadata/Source/SqlServerMetadata.php', - 'Zend\\Db\\Metadata\\Source\\SqliteMetadata' => $vendorDir . '/zendframework/zend-db/src/Metadata/Source/SqliteMetadata.php', - 'Zend\\Db\\Module' => $vendorDir . '/zendframework/zend-db/src/Module.php', - 'Zend\\Db\\ResultSet\\AbstractResultSet' => $vendorDir . '/zendframework/zend-db/src/ResultSet/AbstractResultSet.php', - 'Zend\\Db\\ResultSet\\Exception\\ExceptionInterface' => $vendorDir . '/zendframework/zend-db/src/ResultSet/Exception/ExceptionInterface.php', - 'Zend\\Db\\ResultSet\\Exception\\InvalidArgumentException' => $vendorDir . '/zendframework/zend-db/src/ResultSet/Exception/InvalidArgumentException.php', - 'Zend\\Db\\ResultSet\\Exception\\RuntimeException' => $vendorDir . '/zendframework/zend-db/src/ResultSet/Exception/RuntimeException.php', - 'Zend\\Db\\ResultSet\\HydratingResultSet' => $vendorDir . '/zendframework/zend-db/src/ResultSet/HydratingResultSet.php', - 'Zend\\Db\\ResultSet\\ResultSet' => $vendorDir . '/zendframework/zend-db/src/ResultSet/ResultSet.php', - 'Zend\\Db\\ResultSet\\ResultSetInterface' => $vendorDir . '/zendframework/zend-db/src/ResultSet/ResultSetInterface.php', - 'Zend\\Db\\RowGateway\\AbstractRowGateway' => $vendorDir . '/zendframework/zend-db/src/RowGateway/AbstractRowGateway.php', - 'Zend\\Db\\RowGateway\\Exception\\ExceptionInterface' => $vendorDir . '/zendframework/zend-db/src/RowGateway/Exception/ExceptionInterface.php', - 'Zend\\Db\\RowGateway\\Exception\\InvalidArgumentException' => $vendorDir . '/zendframework/zend-db/src/RowGateway/Exception/InvalidArgumentException.php', - 'Zend\\Db\\RowGateway\\Exception\\RuntimeException' => $vendorDir . '/zendframework/zend-db/src/RowGateway/Exception/RuntimeException.php', - 'Zend\\Db\\RowGateway\\Feature\\AbstractFeature' => $vendorDir . '/zendframework/zend-db/src/RowGateway/Feature/AbstractFeature.php', - 'Zend\\Db\\RowGateway\\Feature\\FeatureSet' => $vendorDir . '/zendframework/zend-db/src/RowGateway/Feature/FeatureSet.php', - 'Zend\\Db\\RowGateway\\RowGateway' => $vendorDir . '/zendframework/zend-db/src/RowGateway/RowGateway.php', - 'Zend\\Db\\RowGateway\\RowGatewayInterface' => $vendorDir . '/zendframework/zend-db/src/RowGateway/RowGatewayInterface.php', - 'Zend\\Db\\Sql\\AbstractExpression' => $vendorDir . '/zendframework/zend-db/src/Sql/AbstractExpression.php', - 'Zend\\Db\\Sql\\AbstractPreparableSql' => $vendorDir . '/zendframework/zend-db/src/Sql/AbstractPreparableSql.php', - 'Zend\\Db\\Sql\\AbstractSql' => $vendorDir . '/zendframework/zend-db/src/Sql/AbstractSql.php', - 'Zend\\Db\\Sql\\Combine' => $vendorDir . '/zendframework/zend-db/src/Sql/Combine.php', - 'Zend\\Db\\Sql\\Ddl\\AlterTable' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/AlterTable.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\AbstractLengthColumn' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/AbstractLengthColumn.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\AbstractPrecisionColumn' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/AbstractPrecisionColumn.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\AbstractTimestampColumn' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/AbstractTimestampColumn.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\BigInteger' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/BigInteger.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Binary' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Binary.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Blob' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Blob.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Boolean' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Boolean.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Char' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Char.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Column' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Column.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\ColumnInterface' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/ColumnInterface.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Date' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Date.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Datetime' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Datetime.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Decimal' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Decimal.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Float' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Float.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Floating' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Floating.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Integer' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Integer.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Text' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Text.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Time' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Time.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Timestamp' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Timestamp.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Varbinary' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Varbinary.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Varchar' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Column/Varchar.php', - 'Zend\\Db\\Sql\\Ddl\\Constraint\\AbstractConstraint' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Constraint/AbstractConstraint.php', - 'Zend\\Db\\Sql\\Ddl\\Constraint\\Check' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Constraint/Check.php', - 'Zend\\Db\\Sql\\Ddl\\Constraint\\ConstraintInterface' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Constraint/ConstraintInterface.php', - 'Zend\\Db\\Sql\\Ddl\\Constraint\\ForeignKey' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Constraint/ForeignKey.php', - 'Zend\\Db\\Sql\\Ddl\\Constraint\\PrimaryKey' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Constraint/PrimaryKey.php', - 'Zend\\Db\\Sql\\Ddl\\Constraint\\UniqueKey' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Constraint/UniqueKey.php', - 'Zend\\Db\\Sql\\Ddl\\CreateTable' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/CreateTable.php', - 'Zend\\Db\\Sql\\Ddl\\DropTable' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/DropTable.php', - 'Zend\\Db\\Sql\\Ddl\\Index\\AbstractIndex' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Index/AbstractIndex.php', - 'Zend\\Db\\Sql\\Ddl\\Index\\Index' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/Index/Index.php', - 'Zend\\Db\\Sql\\Ddl\\SqlInterface' => $vendorDir . '/zendframework/zend-db/src/Sql/Ddl/SqlInterface.php', - 'Zend\\Db\\Sql\\Delete' => $vendorDir . '/zendframework/zend-db/src/Sql/Delete.php', - 'Zend\\Db\\Sql\\Exception\\ExceptionInterface' => $vendorDir . '/zendframework/zend-db/src/Sql/Exception/ExceptionInterface.php', - 'Zend\\Db\\Sql\\Exception\\InvalidArgumentException' => $vendorDir . '/zendframework/zend-db/src/Sql/Exception/InvalidArgumentException.php', - 'Zend\\Db\\Sql\\Exception\\RuntimeException' => $vendorDir . '/zendframework/zend-db/src/Sql/Exception/RuntimeException.php', - 'Zend\\Db\\Sql\\Expression' => $vendorDir . '/zendframework/zend-db/src/Sql/Expression.php', - 'Zend\\Db\\Sql\\ExpressionInterface' => $vendorDir . '/zendframework/zend-db/src/Sql/ExpressionInterface.php', - 'Zend\\Db\\Sql\\Having' => $vendorDir . '/zendframework/zend-db/src/Sql/Having.php', - 'Zend\\Db\\Sql\\Insert' => $vendorDir . '/zendframework/zend-db/src/Sql/Insert.php', - 'Zend\\Db\\Sql\\Join' => $vendorDir . '/zendframework/zend-db/src/Sql/Join.php', - 'Zend\\Db\\Sql\\Literal' => $vendorDir . '/zendframework/zend-db/src/Sql/Literal.php', - 'Zend\\Db\\Sql\\Platform\\AbstractPlatform' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/AbstractPlatform.php', - 'Zend\\Db\\Sql\\Platform\\IbmDb2\\IbmDb2' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/IbmDb2/IbmDb2.php', - 'Zend\\Db\\Sql\\Platform\\IbmDb2\\SelectDecorator' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/IbmDb2/SelectDecorator.php', - 'Zend\\Db\\Sql\\Platform\\Mysql\\Ddl\\AlterTableDecorator' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/Mysql/Ddl/AlterTableDecorator.php', - 'Zend\\Db\\Sql\\Platform\\Mysql\\Ddl\\CreateTableDecorator' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/Mysql/Ddl/CreateTableDecorator.php', - 'Zend\\Db\\Sql\\Platform\\Mysql\\Mysql' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/Mysql/Mysql.php', - 'Zend\\Db\\Sql\\Platform\\Mysql\\SelectDecorator' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/Mysql/SelectDecorator.php', - 'Zend\\Db\\Sql\\Platform\\Oracle\\Oracle' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/Oracle/Oracle.php', - 'Zend\\Db\\Sql\\Platform\\Oracle\\SelectDecorator' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/Oracle/SelectDecorator.php', - 'Zend\\Db\\Sql\\Platform\\Platform' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/Platform.php', - 'Zend\\Db\\Sql\\Platform\\PlatformDecoratorInterface' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/PlatformDecoratorInterface.php', - 'Zend\\Db\\Sql\\Platform\\SqlServer\\Ddl\\CreateTableDecorator' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/SqlServer/Ddl/CreateTableDecorator.php', - 'Zend\\Db\\Sql\\Platform\\SqlServer\\SelectDecorator' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/SqlServer/SelectDecorator.php', - 'Zend\\Db\\Sql\\Platform\\SqlServer\\SqlServer' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/SqlServer/SqlServer.php', - 'Zend\\Db\\Sql\\Platform\\Sqlite\\SelectDecorator' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/Sqlite/SelectDecorator.php', - 'Zend\\Db\\Sql\\Platform\\Sqlite\\Sqlite' => $vendorDir . '/zendframework/zend-db/src/Sql/Platform/Sqlite/Sqlite.php', - 'Zend\\Db\\Sql\\Predicate\\Between' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/Between.php', - 'Zend\\Db\\Sql\\Predicate\\Expression' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/Expression.php', - 'Zend\\Db\\Sql\\Predicate\\In' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/In.php', - 'Zend\\Db\\Sql\\Predicate\\IsNotNull' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/IsNotNull.php', - 'Zend\\Db\\Sql\\Predicate\\IsNull' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/IsNull.php', - 'Zend\\Db\\Sql\\Predicate\\Like' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/Like.php', - 'Zend\\Db\\Sql\\Predicate\\Literal' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/Literal.php', - 'Zend\\Db\\Sql\\Predicate\\NotBetween' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/NotBetween.php', - 'Zend\\Db\\Sql\\Predicate\\NotIn' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/NotIn.php', - 'Zend\\Db\\Sql\\Predicate\\NotLike' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/NotLike.php', - 'Zend\\Db\\Sql\\Predicate\\Operator' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/Operator.php', - 'Zend\\Db\\Sql\\Predicate\\Predicate' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/Predicate.php', - 'Zend\\Db\\Sql\\Predicate\\PredicateInterface' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/PredicateInterface.php', - 'Zend\\Db\\Sql\\Predicate\\PredicateSet' => $vendorDir . '/zendframework/zend-db/src/Sql/Predicate/PredicateSet.php', - 'Zend\\Db\\Sql\\PreparableSqlInterface' => $vendorDir . '/zendframework/zend-db/src/Sql/PreparableSqlInterface.php', - 'Zend\\Db\\Sql\\Select' => $vendorDir . '/zendframework/zend-db/src/Sql/Select.php', - 'Zend\\Db\\Sql\\Sql' => $vendorDir . '/zendframework/zend-db/src/Sql/Sql.php', - 'Zend\\Db\\Sql\\SqlInterface' => $vendorDir . '/zendframework/zend-db/src/Sql/SqlInterface.php', - 'Zend\\Db\\Sql\\TableIdentifier' => $vendorDir . '/zendframework/zend-db/src/Sql/TableIdentifier.php', - 'Zend\\Db\\Sql\\Update' => $vendorDir . '/zendframework/zend-db/src/Sql/Update.php', - 'Zend\\Db\\Sql\\Where' => $vendorDir . '/zendframework/zend-db/src/Sql/Where.php', - 'Zend\\Db\\TableGateway\\AbstractTableGateway' => $vendorDir . '/zendframework/zend-db/src/TableGateway/AbstractTableGateway.php', - 'Zend\\Db\\TableGateway\\Exception\\ExceptionInterface' => $vendorDir . '/zendframework/zend-db/src/TableGateway/Exception/ExceptionInterface.php', - 'Zend\\Db\\TableGateway\\Exception\\InvalidArgumentException' => $vendorDir . '/zendframework/zend-db/src/TableGateway/Exception/InvalidArgumentException.php', - 'Zend\\Db\\TableGateway\\Exception\\RuntimeException' => $vendorDir . '/zendframework/zend-db/src/TableGateway/Exception/RuntimeException.php', - 'Zend\\Db\\TableGateway\\Feature\\AbstractFeature' => $vendorDir . '/zendframework/zend-db/src/TableGateway/Feature/AbstractFeature.php', - 'Zend\\Db\\TableGateway\\Feature\\EventFeature' => $vendorDir . '/zendframework/zend-db/src/TableGateway/Feature/EventFeature.php', - 'Zend\\Db\\TableGateway\\Feature\\EventFeatureEventsInterface' => $vendorDir . '/zendframework/zend-db/src/TableGateway/Feature/EventFeatureEventsInterface.php', - 'Zend\\Db\\TableGateway\\Feature\\EventFeature\\TableGatewayEvent' => $vendorDir . '/zendframework/zend-db/src/TableGateway/Feature/EventFeature/TableGatewayEvent.php', - 'Zend\\Db\\TableGateway\\Feature\\FeatureSet' => $vendorDir . '/zendframework/zend-db/src/TableGateway/Feature/FeatureSet.php', - 'Zend\\Db\\TableGateway\\Feature\\GlobalAdapterFeature' => $vendorDir . '/zendframework/zend-db/src/TableGateway/Feature/GlobalAdapterFeature.php', - 'Zend\\Db\\TableGateway\\Feature\\MasterSlaveFeature' => $vendorDir . '/zendframework/zend-db/src/TableGateway/Feature/MasterSlaveFeature.php', - 'Zend\\Db\\TableGateway\\Feature\\MetadataFeature' => $vendorDir . '/zendframework/zend-db/src/TableGateway/Feature/MetadataFeature.php', - 'Zend\\Db\\TableGateway\\Feature\\RowGatewayFeature' => $vendorDir . '/zendframework/zend-db/src/TableGateway/Feature/RowGatewayFeature.php', - 'Zend\\Db\\TableGateway\\Feature\\SequenceFeature' => $vendorDir . '/zendframework/zend-db/src/TableGateway/Feature/SequenceFeature.php', - 'Zend\\Db\\TableGateway\\TableGateway' => $vendorDir . '/zendframework/zend-db/src/TableGateway/TableGateway.php', - 'Zend\\Db\\TableGateway\\TableGatewayInterface' => $vendorDir . '/zendframework/zend-db/src/TableGateway/TableGatewayInterface.php', - 'Zend\\Stdlib\\AbstractOptions' => $vendorDir . '/zendframework/zend-stdlib/src/AbstractOptions.php', - 'Zend\\Stdlib\\ArrayObject' => $vendorDir . '/zendframework/zend-stdlib/src/ArrayObject.php', - 'Zend\\Stdlib\\ArraySerializableInterface' => $vendorDir . '/zendframework/zend-stdlib/src/ArraySerializableInterface.php', - 'Zend\\Stdlib\\ArrayStack' => $vendorDir . '/zendframework/zend-stdlib/src/ArrayStack.php', - 'Zend\\Stdlib\\ArrayUtils' => $vendorDir . '/zendframework/zend-stdlib/src/ArrayUtils.php', - 'Zend\\Stdlib\\ArrayUtils\\MergeRemoveKey' => $vendorDir . '/zendframework/zend-stdlib/src/ArrayUtils/MergeRemoveKey.php', - 'Zend\\Stdlib\\ArrayUtils\\MergeReplaceKey' => $vendorDir . '/zendframework/zend-stdlib/src/ArrayUtils/MergeReplaceKey.php', - 'Zend\\Stdlib\\ArrayUtils\\MergeReplaceKeyInterface' => $vendorDir . '/zendframework/zend-stdlib/src/ArrayUtils/MergeReplaceKeyInterface.php', - 'Zend\\Stdlib\\ConsoleHelper' => $vendorDir . '/zendframework/zend-stdlib/src/ConsoleHelper.php', - 'Zend\\Stdlib\\DispatchableInterface' => $vendorDir . '/zendframework/zend-stdlib/src/DispatchableInterface.php', - 'Zend\\Stdlib\\ErrorHandler' => $vendorDir . '/zendframework/zend-stdlib/src/ErrorHandler.php', - 'Zend\\Stdlib\\Exception\\BadMethodCallException' => $vendorDir . '/zendframework/zend-stdlib/src/Exception/BadMethodCallException.php', - 'Zend\\Stdlib\\Exception\\DomainException' => $vendorDir . '/zendframework/zend-stdlib/src/Exception/DomainException.php', - 'Zend\\Stdlib\\Exception\\ExceptionInterface' => $vendorDir . '/zendframework/zend-stdlib/src/Exception/ExceptionInterface.php', - 'Zend\\Stdlib\\Exception\\ExtensionNotLoadedException' => $vendorDir . '/zendframework/zend-stdlib/src/Exception/ExtensionNotLoadedException.php', - 'Zend\\Stdlib\\Exception\\InvalidArgumentException' => $vendorDir . '/zendframework/zend-stdlib/src/Exception/InvalidArgumentException.php', - 'Zend\\Stdlib\\Exception\\LogicException' => $vendorDir . '/zendframework/zend-stdlib/src/Exception/LogicException.php', - 'Zend\\Stdlib\\Exception\\RuntimeException' => $vendorDir . '/zendframework/zend-stdlib/src/Exception/RuntimeException.php', - 'Zend\\Stdlib\\FastPriorityQueue' => $vendorDir . '/zendframework/zend-stdlib/src/FastPriorityQueue.php', - 'Zend\\Stdlib\\Glob' => $vendorDir . '/zendframework/zend-stdlib/src/Glob.php', - 'Zend\\Stdlib\\Guard\\AllGuardsTrait' => $vendorDir . '/zendframework/zend-stdlib/src/Guard/AllGuardsTrait.php', - 'Zend\\Stdlib\\Guard\\ArrayOrTraversableGuardTrait' => $vendorDir . '/zendframework/zend-stdlib/src/Guard/ArrayOrTraversableGuardTrait.php', - 'Zend\\Stdlib\\Guard\\EmptyGuardTrait' => $vendorDir . '/zendframework/zend-stdlib/src/Guard/EmptyGuardTrait.php', - 'Zend\\Stdlib\\Guard\\NullGuardTrait' => $vendorDir . '/zendframework/zend-stdlib/src/Guard/NullGuardTrait.php', - 'Zend\\Stdlib\\InitializableInterface' => $vendorDir . '/zendframework/zend-stdlib/src/InitializableInterface.php', - 'Zend\\Stdlib\\JsonSerializable' => $vendorDir . '/zendframework/zend-stdlib/src/JsonSerializable.php', - 'Zend\\Stdlib\\Message' => $vendorDir . '/zendframework/zend-stdlib/src/Message.php', - 'Zend\\Stdlib\\MessageInterface' => $vendorDir . '/zendframework/zend-stdlib/src/MessageInterface.php', - 'Zend\\Stdlib\\ParameterObjectInterface' => $vendorDir . '/zendframework/zend-stdlib/src/ParameterObjectInterface.php', - 'Zend\\Stdlib\\Parameters' => $vendorDir . '/zendframework/zend-stdlib/src/Parameters.php', - 'Zend\\Stdlib\\ParametersInterface' => $vendorDir . '/zendframework/zend-stdlib/src/ParametersInterface.php', - 'Zend\\Stdlib\\PriorityList' => $vendorDir . '/zendframework/zend-stdlib/src/PriorityList.php', - 'Zend\\Stdlib\\PriorityQueue' => $vendorDir . '/zendframework/zend-stdlib/src/PriorityQueue.php', - 'Zend\\Stdlib\\Request' => $vendorDir . '/zendframework/zend-stdlib/src/Request.php', - 'Zend\\Stdlib\\RequestInterface' => $vendorDir . '/zendframework/zend-stdlib/src/RequestInterface.php', - 'Zend\\Stdlib\\Response' => $vendorDir . '/zendframework/zend-stdlib/src/Response.php', - 'Zend\\Stdlib\\ResponseInterface' => $vendorDir . '/zendframework/zend-stdlib/src/ResponseInterface.php', - 'Zend\\Stdlib\\SplPriorityQueue' => $vendorDir . '/zendframework/zend-stdlib/src/SplPriorityQueue.php', - 'Zend\\Stdlib\\SplQueue' => $vendorDir . '/zendframework/zend-stdlib/src/SplQueue.php', - 'Zend\\Stdlib\\SplStack' => $vendorDir . '/zendframework/zend-stdlib/src/SplStack.php', - 'Zend\\Stdlib\\StringUtils' => $vendorDir . '/zendframework/zend-stdlib/src/StringUtils.php', - 'Zend\\Stdlib\\StringWrapper\\AbstractStringWrapper' => $vendorDir . '/zendframework/zend-stdlib/src/StringWrapper/AbstractStringWrapper.php', - 'Zend\\Stdlib\\StringWrapper\\Iconv' => $vendorDir . '/zendframework/zend-stdlib/src/StringWrapper/Iconv.php', - 'Zend\\Stdlib\\StringWrapper\\Intl' => $vendorDir . '/zendframework/zend-stdlib/src/StringWrapper/Intl.php', - 'Zend\\Stdlib\\StringWrapper\\MbString' => $vendorDir . '/zendframework/zend-stdlib/src/StringWrapper/MbString.php', - 'Zend\\Stdlib\\StringWrapper\\Native' => $vendorDir . '/zendframework/zend-stdlib/src/StringWrapper/Native.php', - 'Zend\\Stdlib\\StringWrapper\\StringWrapperInterface' => $vendorDir . '/zendframework/zend-stdlib/src/StringWrapper/StringWrapperInterface.php', 'voku\\cache\\AdapterApc' => $vendorDir . '/voku/simple-cache/src/voku/cache/AdapterApc.php', 'voku\\cache\\AdapterApcu' => $vendorDir . '/voku/simple-cache/src/voku/cache/AdapterApcu.php', 'voku\\cache\\AdapterArray' => $vendorDir . '/voku/simple-cache/src/voku/cache/AdapterArray.php', @@ -284,9 +290,15 @@ return array( 'voku\\cache\\CacheAdapterAutoManager' => $vendorDir . '/voku/simple-cache/src/voku/cache/CacheAdapterAutoManager.php', 'voku\\cache\\CacheChain' => $vendorDir . '/voku/simple-cache/src/voku/cache/CacheChain.php', 'voku\\cache\\CachePsr16' => $vendorDir . '/voku/simple-cache/src/voku/cache/CachePsr16.php', + 'voku\\cache\\Exception\\ChmodException' => $vendorDir . '/voku/simple-cache/src/voku/cache/Exception/ChmodException.php', + 'voku\\cache\\Exception\\FileErrorExceptionInterface' => $vendorDir . '/voku/simple-cache/src/voku/cache/Exception/FileErrorExceptionInterface.php', 'voku\\cache\\Exception\\InvalidArgumentException' => $vendorDir . '/voku/simple-cache/src/voku/cache/Exception/InvalidArgumentException.php', + 'voku\\cache\\Exception\\RenameException' => $vendorDir . '/voku/simple-cache/src/voku/cache/Exception/RenameException.php', + 'voku\\cache\\Exception\\RuntimeException' => $vendorDir . '/voku/simple-cache/src/voku/cache/Exception/RuntimeException.php', + 'voku\\cache\\Exception\\WriteContentException' => $vendorDir . '/voku/simple-cache/src/voku/cache/Exception/WriteContentException.php', 'voku\\cache\\SerializerDefault' => $vendorDir . '/voku/simple-cache/src/voku/cache/SerializerDefault.php', 'voku\\cache\\SerializerIgbinary' => $vendorDir . '/voku/simple-cache/src/voku/cache/SerializerIgbinary.php', + 'voku\\cache\\SerializerMsgpack' => $vendorDir . '/voku/simple-cache/src/voku/cache/SerializerMsgpack.php', 'voku\\cache\\SerializerNo' => $vendorDir . '/voku/simple-cache/src/voku/cache/SerializerNo.php', 'voku\\cache\\iAdapter' => $vendorDir . '/voku/simple-cache/src/voku/cache/iAdapter.php', 'voku\\cache\\iCache' => $vendorDir . '/voku/simple-cache/src/voku/cache/iCache.php', diff --git a/bundled-libs/composer/autoload_files.php b/bundled-libs/composer/autoload_files.php new file mode 100644 index 00000000..77e767db --- /dev/null +++ b/bundled-libs/composer/autoload_files.php @@ -0,0 +1,10 @@ + $vendorDir . '/laminas/laminas-zendframework-bridge/src/autoload.php', +); diff --git a/bundled-libs/composer/autoload_psr4.php b/bundled-libs/composer/autoload_psr4.php index 8615aada..888bf777 100644 --- a/bundled-libs/composer/autoload_psr4.php +++ b/bundled-libs/composer/autoload_psr4.php @@ -7,8 +7,9 @@ $baseDir = dirname($vendorDir); return array( 'voku\\cache\\' => array($vendorDir . '/voku/simple-cache/src/voku/cache'), - 'Zend\\Stdlib\\' => array($vendorDir . '/zendframework/zend-stdlib/src'), - 'Zend\\Db\\' => array($vendorDir . '/zendframework/zend-db/src'), 'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'), + 'Laminas\\ZendFrameworkBridge\\' => array($vendorDir . '/laminas/laminas-zendframework-bridge/src'), + 'Laminas\\Stdlib\\' => array($vendorDir . '/laminas/laminas-stdlib/src'), + 'Laminas\\Db\\' => array($vendorDir . '/laminas/laminas-db/src'), 'Katzgrau\\KLogger\\' => array($vendorDir . '/katzgrau/klogger/src'), ); diff --git a/bundled-libs/composer/autoload_real.php b/bundled-libs/composer/autoload_real.php index 907af5b1..bd25128b 100644 --- a/bundled-libs/composer/autoload_real.php +++ b/bundled-libs/composer/autoload_real.php @@ -13,19 +13,24 @@ class ComposerAutoloaderInitcbda25b16bb8365467298ce193f0f30c } } + /** + * @return \Composer\Autoload\ClassLoader + */ public static function getLoader() { if (null !== self::$loader) { return self::$loader; } + require __DIR__ . '/platform_check.php'; + spl_autoload_register(array('ComposerAutoloaderInitcbda25b16bb8365467298ce193f0f30c', 'loadClassLoader'), true, true); - self::$loader = $loader = new \Composer\Autoload\ClassLoader(); + self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); spl_autoload_unregister(array('ComposerAutoloaderInitcbda25b16bb8365467298ce193f0f30c', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { - require_once __DIR__ . '/autoload_static.php'; + require __DIR__ . '/autoload_static.php'; call_user_func(\Composer\Autoload\ComposerStaticInitcbda25b16bb8365467298ce193f0f30c::getInitializer($loader)); } else { @@ -45,9 +50,27 @@ class ComposerAutoloaderInitcbda25b16bb8365467298ce193f0f30c } } - $loader->setApcuPrefix('WIBdJgt9/OFG9RxODXgrL'); + $loader->setApcuPrefix('3FCa+2qDld553P2McvH+w'); $loader->register(true); + if ($useStaticLoader) { + $includeFiles = Composer\Autoload\ComposerStaticInitcbda25b16bb8365467298ce193f0f30c::$files; + } else { + $includeFiles = require __DIR__ . '/autoload_files.php'; + } + foreach ($includeFiles as $fileIdentifier => $file) { + composerRequirecbda25b16bb8365467298ce193f0f30c($fileIdentifier, $file); + } + return $loader; } } + +function composerRequirecbda25b16bb8365467298ce193f0f30c($fileIdentifier, $file) +{ + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { + require $file; + + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; + } +} diff --git a/bundled-libs/composer/autoload_static.php b/bundled-libs/composer/autoload_static.php index 6bd004ad..9b106970 100644 --- a/bundled-libs/composer/autoload_static.php +++ b/bundled-libs/composer/autoload_static.php @@ -6,20 +6,25 @@ namespace Composer\Autoload; class ComposerStaticInitcbda25b16bb8365467298ce193f0f30c { + public static $files = array ( + '7e9bd612cc444b3eed788ebbe46263a0' => __DIR__ . '/..' . '/laminas/laminas-zendframework-bridge/src/autoload.php', + ); + public static $prefixLengthsPsr4 = array ( 'v' => array ( 'voku\\cache\\' => 11, ), - 'Z' => - array ( - 'Zend\\Stdlib\\' => 12, - 'Zend\\Db\\' => 8, - ), 'P' => array ( 'Psr\\SimpleCache\\' => 16, ), + 'L' => + array ( + 'Laminas\\ZendFrameworkBridge\\' => 28, + 'Laminas\\Stdlib\\' => 15, + 'Laminas\\Db\\' => 11, + ), 'K' => array ( 'Katzgrau\\KLogger\\' => 17, @@ -31,18 +36,22 @@ class ComposerStaticInitcbda25b16bb8365467298ce193f0f30c array ( 0 => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache', ), - 'Zend\\Stdlib\\' => - array ( - 0 => __DIR__ . '/..' . '/zendframework/zend-stdlib/src', - ), - 'Zend\\Db\\' => - array ( - 0 => __DIR__ . '/..' . '/zendframework/zend-db/src', - ), 'Psr\\SimpleCache\\' => array ( 0 => __DIR__ . '/..' . '/psr/simple-cache/src', ), + 'Laminas\\ZendFrameworkBridge\\' => + array ( + 0 => __DIR__ . '/..' . '/laminas/laminas-zendframework-bridge/src', + ), + 'Laminas\\Stdlib\\' => + array ( + 0 => __DIR__ . '/..' . '/laminas/laminas-stdlib/src', + ), + 'Laminas\\Db\\' => + array ( + 0 => __DIR__ . '/..' . '/laminas/laminas-db/src', + ), 'Katzgrau\\KLogger\\' => array ( 0 => __DIR__ . '/..' . '/katzgrau/klogger/src', @@ -60,7 +69,263 @@ class ComposerStaticInitcbda25b16bb8365467298ce193f0f30c ); public static $classMap = array ( + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', 'Katzgrau\\KLogger\\Logger' => __DIR__ . '/..' . '/katzgrau/klogger/src/Logger.php', + 'Laminas\\Db\\Adapter\\Adapter' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Adapter.php', + 'Laminas\\Db\\Adapter\\AdapterAbstractServiceFactory' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/AdapterAbstractServiceFactory.php', + 'Laminas\\Db\\Adapter\\AdapterAwareInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/AdapterAwareInterface.php', + 'Laminas\\Db\\Adapter\\AdapterAwareTrait' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/AdapterAwareTrait.php', + 'Laminas\\Db\\Adapter\\AdapterInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/AdapterInterface.php', + 'Laminas\\Db\\Adapter\\AdapterServiceFactory' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/AdapterServiceFactory.php', + 'Laminas\\Db\\Adapter\\Driver\\AbstractConnection' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/AbstractConnection.php', + 'Laminas\\Db\\Adapter\\Driver\\ConnectionInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/ConnectionInterface.php', + 'Laminas\\Db\\Adapter\\Driver\\DriverInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/DriverInterface.php', + 'Laminas\\Db\\Adapter\\Driver\\Feature\\AbstractFeature' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Feature/AbstractFeature.php', + 'Laminas\\Db\\Adapter\\Driver\\Feature\\DriverFeatureInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Feature/DriverFeatureInterface.php', + 'Laminas\\Db\\Adapter\\Driver\\IbmDb2\\Connection' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/IbmDb2/Connection.php', + 'Laminas\\Db\\Adapter\\Driver\\IbmDb2\\IbmDb2' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/IbmDb2/IbmDb2.php', + 'Laminas\\Db\\Adapter\\Driver\\IbmDb2\\Result' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/IbmDb2/Result.php', + 'Laminas\\Db\\Adapter\\Driver\\IbmDb2\\Statement' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/IbmDb2/Statement.php', + 'Laminas\\Db\\Adapter\\Driver\\Mysqli\\Connection' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Mysqli/Connection.php', + 'Laminas\\Db\\Adapter\\Driver\\Mysqli\\Mysqli' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Mysqli/Mysqli.php', + 'Laminas\\Db\\Adapter\\Driver\\Mysqli\\Result' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Mysqli/Result.php', + 'Laminas\\Db\\Adapter\\Driver\\Mysqli\\Statement' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Mysqli/Statement.php', + 'Laminas\\Db\\Adapter\\Driver\\Oci8\\Connection' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Oci8/Connection.php', + 'Laminas\\Db\\Adapter\\Driver\\Oci8\\Feature\\RowCounter' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Oci8/Feature/RowCounter.php', + 'Laminas\\Db\\Adapter\\Driver\\Oci8\\Oci8' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Oci8/Oci8.php', + 'Laminas\\Db\\Adapter\\Driver\\Oci8\\Result' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Oci8/Result.php', + 'Laminas\\Db\\Adapter\\Driver\\Oci8\\Statement' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Oci8/Statement.php', + 'Laminas\\Db\\Adapter\\Driver\\Pdo\\Connection' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Pdo/Connection.php', + 'Laminas\\Db\\Adapter\\Driver\\Pdo\\Feature\\OracleRowCounter' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Pdo/Feature/OracleRowCounter.php', + 'Laminas\\Db\\Adapter\\Driver\\Pdo\\Feature\\SqliteRowCounter' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Pdo/Feature/SqliteRowCounter.php', + 'Laminas\\Db\\Adapter\\Driver\\Pdo\\Pdo' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Pdo/Pdo.php', + 'Laminas\\Db\\Adapter\\Driver\\Pdo\\Result' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Pdo/Result.php', + 'Laminas\\Db\\Adapter\\Driver\\Pdo\\Statement' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Pdo/Statement.php', + 'Laminas\\Db\\Adapter\\Driver\\Pgsql\\Connection' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Pgsql/Connection.php', + 'Laminas\\Db\\Adapter\\Driver\\Pgsql\\Pgsql' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Pgsql/Pgsql.php', + 'Laminas\\Db\\Adapter\\Driver\\Pgsql\\Result' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Pgsql/Result.php', + 'Laminas\\Db\\Adapter\\Driver\\Pgsql\\Statement' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Pgsql/Statement.php', + 'Laminas\\Db\\Adapter\\Driver\\ResultInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/ResultInterface.php', + 'Laminas\\Db\\Adapter\\Driver\\Sqlsrv\\Connection' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Sqlsrv/Connection.php', + 'Laminas\\Db\\Adapter\\Driver\\Sqlsrv\\Exception\\ErrorException' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Sqlsrv/Exception/ErrorException.php', + 'Laminas\\Db\\Adapter\\Driver\\Sqlsrv\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Sqlsrv/Exception/ExceptionInterface.php', + 'Laminas\\Db\\Adapter\\Driver\\Sqlsrv\\Result' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Sqlsrv/Result.php', + 'Laminas\\Db\\Adapter\\Driver\\Sqlsrv\\Sqlsrv' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Sqlsrv/Sqlsrv.php', + 'Laminas\\Db\\Adapter\\Driver\\Sqlsrv\\Statement' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/Sqlsrv/Statement.php', + 'Laminas\\Db\\Adapter\\Driver\\StatementInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Driver/StatementInterface.php', + 'Laminas\\Db\\Adapter\\Exception\\ErrorException' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Exception/ErrorException.php', + 'Laminas\\Db\\Adapter\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Exception/ExceptionInterface.php', + 'Laminas\\Db\\Adapter\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Exception/InvalidArgumentException.php', + 'Laminas\\Db\\Adapter\\Exception\\InvalidConnectionParametersException' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Exception/InvalidConnectionParametersException.php', + 'Laminas\\Db\\Adapter\\Exception\\InvalidQueryException' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Exception/InvalidQueryException.php', + 'Laminas\\Db\\Adapter\\Exception\\RuntimeException' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Exception/RuntimeException.php', + 'Laminas\\Db\\Adapter\\Exception\\UnexpectedValueException' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Exception/UnexpectedValueException.php', + 'Laminas\\Db\\Adapter\\ParameterContainer' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/ParameterContainer.php', + 'Laminas\\Db\\Adapter\\Platform\\AbstractPlatform' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Platform/AbstractPlatform.php', + 'Laminas\\Db\\Adapter\\Platform\\IbmDb2' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Platform/IbmDb2.php', + 'Laminas\\Db\\Adapter\\Platform\\Mysql' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Platform/Mysql.php', + 'Laminas\\Db\\Adapter\\Platform\\Oracle' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Platform/Oracle.php', + 'Laminas\\Db\\Adapter\\Platform\\PlatformInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Platform/PlatformInterface.php', + 'Laminas\\Db\\Adapter\\Platform\\Postgresql' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Platform/Postgresql.php', + 'Laminas\\Db\\Adapter\\Platform\\Sql92' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Platform/Sql92.php', + 'Laminas\\Db\\Adapter\\Platform\\SqlServer' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Platform/SqlServer.php', + 'Laminas\\Db\\Adapter\\Platform\\Sqlite' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Platform/Sqlite.php', + 'Laminas\\Db\\Adapter\\Profiler\\Profiler' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Profiler/Profiler.php', + 'Laminas\\Db\\Adapter\\Profiler\\ProfilerAwareInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Profiler/ProfilerAwareInterface.php', + 'Laminas\\Db\\Adapter\\Profiler\\ProfilerInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/Profiler/ProfilerInterface.php', + 'Laminas\\Db\\Adapter\\StatementContainer' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/StatementContainer.php', + 'Laminas\\Db\\Adapter\\StatementContainerInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/Adapter/StatementContainerInterface.php', + 'Laminas\\Db\\ConfigProvider' => __DIR__ . '/..' . '/laminas/laminas-db/src/ConfigProvider.php', + 'Laminas\\Db\\Exception\\ErrorException' => __DIR__ . '/..' . '/laminas/laminas-db/src/Exception/ErrorException.php', + 'Laminas\\Db\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/Exception/ExceptionInterface.php', + 'Laminas\\Db\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/laminas/laminas-db/src/Exception/InvalidArgumentException.php', + 'Laminas\\Db\\Exception\\RuntimeException' => __DIR__ . '/..' . '/laminas/laminas-db/src/Exception/RuntimeException.php', + 'Laminas\\Db\\Exception\\UnexpectedValueException' => __DIR__ . '/..' . '/laminas/laminas-db/src/Exception/UnexpectedValueException.php', + 'Laminas\\Db\\Metadata\\Metadata' => __DIR__ . '/..' . '/laminas/laminas-db/src/Metadata/Metadata.php', + 'Laminas\\Db\\Metadata\\MetadataInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/Metadata/MetadataInterface.php', + 'Laminas\\Db\\Metadata\\Object\\AbstractTableObject' => __DIR__ . '/..' . '/laminas/laminas-db/src/Metadata/Object/AbstractTableObject.php', + 'Laminas\\Db\\Metadata\\Object\\ColumnObject' => __DIR__ . '/..' . '/laminas/laminas-db/src/Metadata/Object/ColumnObject.php', + 'Laminas\\Db\\Metadata\\Object\\ConstraintKeyObject' => __DIR__ . '/..' . '/laminas/laminas-db/src/Metadata/Object/ConstraintKeyObject.php', + 'Laminas\\Db\\Metadata\\Object\\ConstraintObject' => __DIR__ . '/..' . '/laminas/laminas-db/src/Metadata/Object/ConstraintObject.php', + 'Laminas\\Db\\Metadata\\Object\\TableObject' => __DIR__ . '/..' . '/laminas/laminas-db/src/Metadata/Object/TableObject.php', + 'Laminas\\Db\\Metadata\\Object\\TriggerObject' => __DIR__ . '/..' . '/laminas/laminas-db/src/Metadata/Object/TriggerObject.php', + 'Laminas\\Db\\Metadata\\Object\\ViewObject' => __DIR__ . '/..' . '/laminas/laminas-db/src/Metadata/Object/ViewObject.php', + 'Laminas\\Db\\Metadata\\Source\\AbstractSource' => __DIR__ . '/..' . '/laminas/laminas-db/src/Metadata/Source/AbstractSource.php', + 'Laminas\\Db\\Metadata\\Source\\Factory' => __DIR__ . '/..' . '/laminas/laminas-db/src/Metadata/Source/Factory.php', + 'Laminas\\Db\\Metadata\\Source\\MysqlMetadata' => __DIR__ . '/..' . '/laminas/laminas-db/src/Metadata/Source/MysqlMetadata.php', + 'Laminas\\Db\\Metadata\\Source\\OracleMetadata' => __DIR__ . '/..' . '/laminas/laminas-db/src/Metadata/Source/OracleMetadata.php', + 'Laminas\\Db\\Metadata\\Source\\PostgresqlMetadata' => __DIR__ . '/..' . '/laminas/laminas-db/src/Metadata/Source/PostgresqlMetadata.php', + 'Laminas\\Db\\Metadata\\Source\\SqlServerMetadata' => __DIR__ . '/..' . '/laminas/laminas-db/src/Metadata/Source/SqlServerMetadata.php', + 'Laminas\\Db\\Metadata\\Source\\SqliteMetadata' => __DIR__ . '/..' . '/laminas/laminas-db/src/Metadata/Source/SqliteMetadata.php', + 'Laminas\\Db\\Module' => __DIR__ . '/..' . '/laminas/laminas-db/src/Module.php', + 'Laminas\\Db\\ResultSet\\AbstractResultSet' => __DIR__ . '/..' . '/laminas/laminas-db/src/ResultSet/AbstractResultSet.php', + 'Laminas\\Db\\ResultSet\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/ResultSet/Exception/ExceptionInterface.php', + 'Laminas\\Db\\ResultSet\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/laminas/laminas-db/src/ResultSet/Exception/InvalidArgumentException.php', + 'Laminas\\Db\\ResultSet\\Exception\\RuntimeException' => __DIR__ . '/..' . '/laminas/laminas-db/src/ResultSet/Exception/RuntimeException.php', + 'Laminas\\Db\\ResultSet\\HydratingResultSet' => __DIR__ . '/..' . '/laminas/laminas-db/src/ResultSet/HydratingResultSet.php', + 'Laminas\\Db\\ResultSet\\ResultSet' => __DIR__ . '/..' . '/laminas/laminas-db/src/ResultSet/ResultSet.php', + 'Laminas\\Db\\ResultSet\\ResultSetInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/ResultSet/ResultSetInterface.php', + 'Laminas\\Db\\RowGateway\\AbstractRowGateway' => __DIR__ . '/..' . '/laminas/laminas-db/src/RowGateway/AbstractRowGateway.php', + 'Laminas\\Db\\RowGateway\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/RowGateway/Exception/ExceptionInterface.php', + 'Laminas\\Db\\RowGateway\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/laminas/laminas-db/src/RowGateway/Exception/InvalidArgumentException.php', + 'Laminas\\Db\\RowGateway\\Exception\\RuntimeException' => __DIR__ . '/..' . '/laminas/laminas-db/src/RowGateway/Exception/RuntimeException.php', + 'Laminas\\Db\\RowGateway\\Feature\\AbstractFeature' => __DIR__ . '/..' . '/laminas/laminas-db/src/RowGateway/Feature/AbstractFeature.php', + 'Laminas\\Db\\RowGateway\\Feature\\FeatureSet' => __DIR__ . '/..' . '/laminas/laminas-db/src/RowGateway/Feature/FeatureSet.php', + 'Laminas\\Db\\RowGateway\\RowGateway' => __DIR__ . '/..' . '/laminas/laminas-db/src/RowGateway/RowGateway.php', + 'Laminas\\Db\\RowGateway\\RowGatewayInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/RowGateway/RowGatewayInterface.php', + 'Laminas\\Db\\Sql\\AbstractExpression' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/AbstractExpression.php', + 'Laminas\\Db\\Sql\\AbstractPreparableSql' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/AbstractPreparableSql.php', + 'Laminas\\Db\\Sql\\AbstractSql' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/AbstractSql.php', + 'Laminas\\Db\\Sql\\Combine' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Combine.php', + 'Laminas\\Db\\Sql\\Ddl\\AlterTable' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/AlterTable.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\AbstractLengthColumn' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Column/AbstractLengthColumn.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\AbstractPrecisionColumn' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Column/AbstractPrecisionColumn.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\AbstractTimestampColumn' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Column/AbstractTimestampColumn.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\BigInteger' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Column/BigInteger.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Binary' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Column/Binary.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Blob' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Column/Blob.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Boolean' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Column/Boolean.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Char' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Column/Char.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Column' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Column/Column.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\ColumnInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Column/ColumnInterface.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Date' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Column/Date.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Datetime' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Column/Datetime.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Decimal' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Column/Decimal.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Float' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Column/Float.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Floating' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Column/Floating.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Integer' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Column/Integer.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Text' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Column/Text.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Time' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Column/Time.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Timestamp' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Column/Timestamp.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Varbinary' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Column/Varbinary.php', + 'Laminas\\Db\\Sql\\Ddl\\Column\\Varchar' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Column/Varchar.php', + 'Laminas\\Db\\Sql\\Ddl\\Constraint\\AbstractConstraint' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Constraint/AbstractConstraint.php', + 'Laminas\\Db\\Sql\\Ddl\\Constraint\\Check' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Constraint/Check.php', + 'Laminas\\Db\\Sql\\Ddl\\Constraint\\ConstraintInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Constraint/ConstraintInterface.php', + 'Laminas\\Db\\Sql\\Ddl\\Constraint\\ForeignKey' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Constraint/ForeignKey.php', + 'Laminas\\Db\\Sql\\Ddl\\Constraint\\PrimaryKey' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Constraint/PrimaryKey.php', + 'Laminas\\Db\\Sql\\Ddl\\Constraint\\UniqueKey' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Constraint/UniqueKey.php', + 'Laminas\\Db\\Sql\\Ddl\\CreateTable' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/CreateTable.php', + 'Laminas\\Db\\Sql\\Ddl\\DropTable' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/DropTable.php', + 'Laminas\\Db\\Sql\\Ddl\\Index\\AbstractIndex' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Index/AbstractIndex.php', + 'Laminas\\Db\\Sql\\Ddl\\Index\\Index' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/Index/Index.php', + 'Laminas\\Db\\Sql\\Ddl\\SqlInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Ddl/SqlInterface.php', + 'Laminas\\Db\\Sql\\Delete' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Delete.php', + 'Laminas\\Db\\Sql\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Exception/ExceptionInterface.php', + 'Laminas\\Db\\Sql\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Exception/InvalidArgumentException.php', + 'Laminas\\Db\\Sql\\Exception\\RuntimeException' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Exception/RuntimeException.php', + 'Laminas\\Db\\Sql\\Expression' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Expression.php', + 'Laminas\\Db\\Sql\\ExpressionInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/ExpressionInterface.php', + 'Laminas\\Db\\Sql\\Having' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Having.php', + 'Laminas\\Db\\Sql\\Insert' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Insert.php', + 'Laminas\\Db\\Sql\\InsertIgnore' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/InsertIgnore.php', + 'Laminas\\Db\\Sql\\Join' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Join.php', + 'Laminas\\Db\\Sql\\Literal' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Literal.php', + 'Laminas\\Db\\Sql\\Platform\\AbstractPlatform' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Platform/AbstractPlatform.php', + 'Laminas\\Db\\Sql\\Platform\\IbmDb2\\IbmDb2' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Platform/IbmDb2/IbmDb2.php', + 'Laminas\\Db\\Sql\\Platform\\IbmDb2\\SelectDecorator' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Platform/IbmDb2/SelectDecorator.php', + 'Laminas\\Db\\Sql\\Platform\\Mysql\\Ddl\\AlterTableDecorator' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Platform/Mysql/Ddl/AlterTableDecorator.php', + 'Laminas\\Db\\Sql\\Platform\\Mysql\\Ddl\\CreateTableDecorator' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Platform/Mysql/Ddl/CreateTableDecorator.php', + 'Laminas\\Db\\Sql\\Platform\\Mysql\\Mysql' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Platform/Mysql/Mysql.php', + 'Laminas\\Db\\Sql\\Platform\\Mysql\\SelectDecorator' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Platform/Mysql/SelectDecorator.php', + 'Laminas\\Db\\Sql\\Platform\\Oracle\\Oracle' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Platform/Oracle/Oracle.php', + 'Laminas\\Db\\Sql\\Platform\\Oracle\\SelectDecorator' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Platform/Oracle/SelectDecorator.php', + 'Laminas\\Db\\Sql\\Platform\\Platform' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Platform/Platform.php', + 'Laminas\\Db\\Sql\\Platform\\PlatformDecoratorInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Platform/PlatformDecoratorInterface.php', + 'Laminas\\Db\\Sql\\Platform\\SqlServer\\Ddl\\CreateTableDecorator' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Platform/SqlServer/Ddl/CreateTableDecorator.php', + 'Laminas\\Db\\Sql\\Platform\\SqlServer\\SelectDecorator' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Platform/SqlServer/SelectDecorator.php', + 'Laminas\\Db\\Sql\\Platform\\SqlServer\\SqlServer' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Platform/SqlServer/SqlServer.php', + 'Laminas\\Db\\Sql\\Platform\\Sqlite\\SelectDecorator' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Platform/Sqlite/SelectDecorator.php', + 'Laminas\\Db\\Sql\\Platform\\Sqlite\\Sqlite' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Platform/Sqlite/Sqlite.php', + 'Laminas\\Db\\Sql\\Predicate\\Between' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Predicate/Between.php', + 'Laminas\\Db\\Sql\\Predicate\\Expression' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Predicate/Expression.php', + 'Laminas\\Db\\Sql\\Predicate\\In' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Predicate/In.php', + 'Laminas\\Db\\Sql\\Predicate\\IsNotNull' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Predicate/IsNotNull.php', + 'Laminas\\Db\\Sql\\Predicate\\IsNull' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Predicate/IsNull.php', + 'Laminas\\Db\\Sql\\Predicate\\Like' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Predicate/Like.php', + 'Laminas\\Db\\Sql\\Predicate\\Literal' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Predicate/Literal.php', + 'Laminas\\Db\\Sql\\Predicate\\NotBetween' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Predicate/NotBetween.php', + 'Laminas\\Db\\Sql\\Predicate\\NotIn' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Predicate/NotIn.php', + 'Laminas\\Db\\Sql\\Predicate\\NotLike' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Predicate/NotLike.php', + 'Laminas\\Db\\Sql\\Predicate\\Operator' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Predicate/Operator.php', + 'Laminas\\Db\\Sql\\Predicate\\Predicate' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Predicate/Predicate.php', + 'Laminas\\Db\\Sql\\Predicate\\PredicateInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Predicate/PredicateInterface.php', + 'Laminas\\Db\\Sql\\Predicate\\PredicateSet' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Predicate/PredicateSet.php', + 'Laminas\\Db\\Sql\\PreparableSqlInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/PreparableSqlInterface.php', + 'Laminas\\Db\\Sql\\Select' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Select.php', + 'Laminas\\Db\\Sql\\Sql' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Sql.php', + 'Laminas\\Db\\Sql\\SqlInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/SqlInterface.php', + 'Laminas\\Db\\Sql\\TableIdentifier' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/TableIdentifier.php', + 'Laminas\\Db\\Sql\\Update' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Update.php', + 'Laminas\\Db\\Sql\\Where' => __DIR__ . '/..' . '/laminas/laminas-db/src/Sql/Where.php', + 'Laminas\\Db\\TableGateway\\AbstractTableGateway' => __DIR__ . '/..' . '/laminas/laminas-db/src/TableGateway/AbstractTableGateway.php', + 'Laminas\\Db\\TableGateway\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/TableGateway/Exception/ExceptionInterface.php', + 'Laminas\\Db\\TableGateway\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/laminas/laminas-db/src/TableGateway/Exception/InvalidArgumentException.php', + 'Laminas\\Db\\TableGateway\\Exception\\RuntimeException' => __DIR__ . '/..' . '/laminas/laminas-db/src/TableGateway/Exception/RuntimeException.php', + 'Laminas\\Db\\TableGateway\\Feature\\AbstractFeature' => __DIR__ . '/..' . '/laminas/laminas-db/src/TableGateway/Feature/AbstractFeature.php', + 'Laminas\\Db\\TableGateway\\Feature\\EventFeature' => __DIR__ . '/..' . '/laminas/laminas-db/src/TableGateway/Feature/EventFeature.php', + 'Laminas\\Db\\TableGateway\\Feature\\EventFeatureEventsInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/TableGateway/Feature/EventFeatureEventsInterface.php', + 'Laminas\\Db\\TableGateway\\Feature\\EventFeature\\TableGatewayEvent' => __DIR__ . '/..' . '/laminas/laminas-db/src/TableGateway/Feature/EventFeature/TableGatewayEvent.php', + 'Laminas\\Db\\TableGateway\\Feature\\FeatureSet' => __DIR__ . '/..' . '/laminas/laminas-db/src/TableGateway/Feature/FeatureSet.php', + 'Laminas\\Db\\TableGateway\\Feature\\GlobalAdapterFeature' => __DIR__ . '/..' . '/laminas/laminas-db/src/TableGateway/Feature/GlobalAdapterFeature.php', + 'Laminas\\Db\\TableGateway\\Feature\\MasterSlaveFeature' => __DIR__ . '/..' . '/laminas/laminas-db/src/TableGateway/Feature/MasterSlaveFeature.php', + 'Laminas\\Db\\TableGateway\\Feature\\MetadataFeature' => __DIR__ . '/..' . '/laminas/laminas-db/src/TableGateway/Feature/MetadataFeature.php', + 'Laminas\\Db\\TableGateway\\Feature\\RowGatewayFeature' => __DIR__ . '/..' . '/laminas/laminas-db/src/TableGateway/Feature/RowGatewayFeature.php', + 'Laminas\\Db\\TableGateway\\Feature\\SequenceFeature' => __DIR__ . '/..' . '/laminas/laminas-db/src/TableGateway/Feature/SequenceFeature.php', + 'Laminas\\Db\\TableGateway\\TableGateway' => __DIR__ . '/..' . '/laminas/laminas-db/src/TableGateway/TableGateway.php', + 'Laminas\\Db\\TableGateway\\TableGatewayInterface' => __DIR__ . '/..' . '/laminas/laminas-db/src/TableGateway/TableGatewayInterface.php', + 'Laminas\\Stdlib\\AbstractOptions' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/AbstractOptions.php', + 'Laminas\\Stdlib\\ArrayObject' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/ArrayObject.php', + 'Laminas\\Stdlib\\ArraySerializableInterface' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/ArraySerializableInterface.php', + 'Laminas\\Stdlib\\ArrayStack' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/ArrayStack.php', + 'Laminas\\Stdlib\\ArrayUtils' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/ArrayUtils.php', + 'Laminas\\Stdlib\\ArrayUtils\\MergeRemoveKey' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/ArrayUtils/MergeRemoveKey.php', + 'Laminas\\Stdlib\\ArrayUtils\\MergeReplaceKey' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/ArrayUtils/MergeReplaceKey.php', + 'Laminas\\Stdlib\\ArrayUtils\\MergeReplaceKeyInterface' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/ArrayUtils/MergeReplaceKeyInterface.php', + 'Laminas\\Stdlib\\ConsoleHelper' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/ConsoleHelper.php', + 'Laminas\\Stdlib\\DispatchableInterface' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/DispatchableInterface.php', + 'Laminas\\Stdlib\\ErrorHandler' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/ErrorHandler.php', + 'Laminas\\Stdlib\\Exception\\BadMethodCallException' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/Exception/BadMethodCallException.php', + 'Laminas\\Stdlib\\Exception\\DomainException' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/Exception/DomainException.php', + 'Laminas\\Stdlib\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/Exception/ExceptionInterface.php', + 'Laminas\\Stdlib\\Exception\\ExtensionNotLoadedException' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/Exception/ExtensionNotLoadedException.php', + 'Laminas\\Stdlib\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/Exception/InvalidArgumentException.php', + 'Laminas\\Stdlib\\Exception\\LogicException' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/Exception/LogicException.php', + 'Laminas\\Stdlib\\Exception\\RuntimeException' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/Exception/RuntimeException.php', + 'Laminas\\Stdlib\\FastPriorityQueue' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/FastPriorityQueue.php', + 'Laminas\\Stdlib\\Glob' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/Glob.php', + 'Laminas\\Stdlib\\Guard\\AllGuardsTrait' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/Guard/AllGuardsTrait.php', + 'Laminas\\Stdlib\\Guard\\ArrayOrTraversableGuardTrait' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/Guard/ArrayOrTraversableGuardTrait.php', + 'Laminas\\Stdlib\\Guard\\EmptyGuardTrait' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/Guard/EmptyGuardTrait.php', + 'Laminas\\Stdlib\\Guard\\NullGuardTrait' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/Guard/NullGuardTrait.php', + 'Laminas\\Stdlib\\InitializableInterface' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/InitializableInterface.php', + 'Laminas\\Stdlib\\JsonSerializable' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/JsonSerializable.php', + 'Laminas\\Stdlib\\Message' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/Message.php', + 'Laminas\\Stdlib\\MessageInterface' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/MessageInterface.php', + 'Laminas\\Stdlib\\ParameterObjectInterface' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/ParameterObjectInterface.php', + 'Laminas\\Stdlib\\Parameters' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/Parameters.php', + 'Laminas\\Stdlib\\ParametersInterface' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/ParametersInterface.php', + 'Laminas\\Stdlib\\PriorityList' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/PriorityList.php', + 'Laminas\\Stdlib\\PriorityQueue' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/PriorityQueue.php', + 'Laminas\\Stdlib\\Request' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/Request.php', + 'Laminas\\Stdlib\\RequestInterface' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/RequestInterface.php', + 'Laminas\\Stdlib\\Response' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/Response.php', + 'Laminas\\Stdlib\\ResponseInterface' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/ResponseInterface.php', + 'Laminas\\Stdlib\\SplPriorityQueue' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/SplPriorityQueue.php', + 'Laminas\\Stdlib\\SplQueue' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/SplQueue.php', + 'Laminas\\Stdlib\\SplStack' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/SplStack.php', + 'Laminas\\Stdlib\\StringUtils' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/StringUtils.php', + 'Laminas\\Stdlib\\StringWrapper\\AbstractStringWrapper' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/StringWrapper/AbstractStringWrapper.php', + 'Laminas\\Stdlib\\StringWrapper\\Iconv' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/StringWrapper/Iconv.php', + 'Laminas\\Stdlib\\StringWrapper\\Intl' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/StringWrapper/Intl.php', + 'Laminas\\Stdlib\\StringWrapper\\MbString' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/StringWrapper/MbString.php', + 'Laminas\\Stdlib\\StringWrapper\\Native' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/StringWrapper/Native.php', + 'Laminas\\Stdlib\\StringWrapper\\StringWrapperInterface' => __DIR__ . '/..' . '/laminas/laminas-stdlib/src/StringWrapper/StringWrapperInterface.php', + 'Laminas\\ZendFrameworkBridge\\Autoloader' => __DIR__ . '/..' . '/laminas/laminas-zendframework-bridge/src/Autoloader.php', + 'Laminas\\ZendFrameworkBridge\\ConfigPostProcessor' => __DIR__ . '/..' . '/laminas/laminas-zendframework-bridge/src/ConfigPostProcessor.php', + 'Laminas\\ZendFrameworkBridge\\Module' => __DIR__ . '/..' . '/laminas/laminas-zendframework-bridge/src/Module.php', + 'Laminas\\ZendFrameworkBridge\\Replacements' => __DIR__ . '/..' . '/laminas/laminas-zendframework-bridge/src/Replacements.php', + 'Laminas\\ZendFrameworkBridge\\RewriteRules' => __DIR__ . '/..' . '/laminas/laminas-zendframework-bridge/src/RewriteRules.php', 'Psr\\Log\\AbstractLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/AbstractLogger.php', 'Psr\\Log\\InvalidArgumentException' => __DIR__ . '/..' . '/psr/log/Psr/Log/InvalidArgumentException.php', 'Psr\\Log\\LogLevel' => __DIR__ . '/..' . '/psr/log/Psr/Log/LogLevel.php', @@ -69,260 +334,10 @@ class ComposerStaticInitcbda25b16bb8365467298ce193f0f30c 'Psr\\Log\\LoggerInterface' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerInterface.php', 'Psr\\Log\\LoggerTrait' => __DIR__ . '/..' . '/psr/log/Psr/Log/LoggerTrait.php', 'Psr\\Log\\NullLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/NullLogger.php', - 'Psr\\Log\\Test\\DummyTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php', 'Psr\\Log\\Test\\LoggerInterfaceTest' => __DIR__ . '/..' . '/psr/log/Psr/Log/Test/LoggerInterfaceTest.php', 'Psr\\SimpleCache\\CacheException' => __DIR__ . '/..' . '/psr/simple-cache/src/CacheException.php', 'Psr\\SimpleCache\\CacheInterface' => __DIR__ . '/..' . '/psr/simple-cache/src/CacheInterface.php', 'Psr\\SimpleCache\\InvalidArgumentException' => __DIR__ . '/..' . '/psr/simple-cache/src/InvalidArgumentException.php', - 'Zend\\Db\\Adapter\\Adapter' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Adapter.php', - 'Zend\\Db\\Adapter\\AdapterAbstractServiceFactory' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/AdapterAbstractServiceFactory.php', - 'Zend\\Db\\Adapter\\AdapterAwareInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/AdapterAwareInterface.php', - 'Zend\\Db\\Adapter\\AdapterAwareTrait' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/AdapterAwareTrait.php', - 'Zend\\Db\\Adapter\\AdapterInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/AdapterInterface.php', - 'Zend\\Db\\Adapter\\AdapterServiceFactory' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/AdapterServiceFactory.php', - 'Zend\\Db\\Adapter\\Driver\\AbstractConnection' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/AbstractConnection.php', - 'Zend\\Db\\Adapter\\Driver\\ConnectionInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/ConnectionInterface.php', - 'Zend\\Db\\Adapter\\Driver\\DriverInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/DriverInterface.php', - 'Zend\\Db\\Adapter\\Driver\\Feature\\AbstractFeature' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Feature/AbstractFeature.php', - 'Zend\\Db\\Adapter\\Driver\\Feature\\DriverFeatureInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Feature/DriverFeatureInterface.php', - 'Zend\\Db\\Adapter\\Driver\\IbmDb2\\Connection' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/IbmDb2/Connection.php', - 'Zend\\Db\\Adapter\\Driver\\IbmDb2\\IbmDb2' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/IbmDb2/IbmDb2.php', - 'Zend\\Db\\Adapter\\Driver\\IbmDb2\\Result' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/IbmDb2/Result.php', - 'Zend\\Db\\Adapter\\Driver\\IbmDb2\\Statement' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/IbmDb2/Statement.php', - 'Zend\\Db\\Adapter\\Driver\\Mysqli\\Connection' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Mysqli/Connection.php', - 'Zend\\Db\\Adapter\\Driver\\Mysqli\\Mysqli' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Mysqli/Mysqli.php', - 'Zend\\Db\\Adapter\\Driver\\Mysqli\\Result' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Mysqli/Result.php', - 'Zend\\Db\\Adapter\\Driver\\Mysqli\\Statement' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Mysqli/Statement.php', - 'Zend\\Db\\Adapter\\Driver\\Oci8\\Connection' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Oci8/Connection.php', - 'Zend\\Db\\Adapter\\Driver\\Oci8\\Feature\\RowCounter' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Oci8/Feature/RowCounter.php', - 'Zend\\Db\\Adapter\\Driver\\Oci8\\Oci8' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Oci8/Oci8.php', - 'Zend\\Db\\Adapter\\Driver\\Oci8\\Result' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Oci8/Result.php', - 'Zend\\Db\\Adapter\\Driver\\Oci8\\Statement' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Oci8/Statement.php', - 'Zend\\Db\\Adapter\\Driver\\Pdo\\Connection' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Pdo/Connection.php', - 'Zend\\Db\\Adapter\\Driver\\Pdo\\Feature\\OracleRowCounter' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Pdo/Feature/OracleRowCounter.php', - 'Zend\\Db\\Adapter\\Driver\\Pdo\\Feature\\SqliteRowCounter' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Pdo/Feature/SqliteRowCounter.php', - 'Zend\\Db\\Adapter\\Driver\\Pdo\\Pdo' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Pdo/Pdo.php', - 'Zend\\Db\\Adapter\\Driver\\Pdo\\Result' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Pdo/Result.php', - 'Zend\\Db\\Adapter\\Driver\\Pdo\\Statement' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Pdo/Statement.php', - 'Zend\\Db\\Adapter\\Driver\\Pgsql\\Connection' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Pgsql/Connection.php', - 'Zend\\Db\\Adapter\\Driver\\Pgsql\\Pgsql' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Pgsql/Pgsql.php', - 'Zend\\Db\\Adapter\\Driver\\Pgsql\\Result' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Pgsql/Result.php', - 'Zend\\Db\\Adapter\\Driver\\Pgsql\\Statement' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Pgsql/Statement.php', - 'Zend\\Db\\Adapter\\Driver\\ResultInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/ResultInterface.php', - 'Zend\\Db\\Adapter\\Driver\\Sqlsrv\\Connection' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Connection.php', - 'Zend\\Db\\Adapter\\Driver\\Sqlsrv\\Exception\\ErrorException' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Exception/ErrorException.php', - 'Zend\\Db\\Adapter\\Driver\\Sqlsrv\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Exception/ExceptionInterface.php', - 'Zend\\Db\\Adapter\\Driver\\Sqlsrv\\Result' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Result.php', - 'Zend\\Db\\Adapter\\Driver\\Sqlsrv\\Sqlsrv' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Sqlsrv.php', - 'Zend\\Db\\Adapter\\Driver\\Sqlsrv\\Statement' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/Sqlsrv/Statement.php', - 'Zend\\Db\\Adapter\\Driver\\StatementInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Driver/StatementInterface.php', - 'Zend\\Db\\Adapter\\Exception\\ErrorException' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Exception/ErrorException.php', - 'Zend\\Db\\Adapter\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Exception/ExceptionInterface.php', - 'Zend\\Db\\Adapter\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Exception/InvalidArgumentException.php', - 'Zend\\Db\\Adapter\\Exception\\InvalidConnectionParametersException' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Exception/InvalidConnectionParametersException.php', - 'Zend\\Db\\Adapter\\Exception\\InvalidQueryException' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Exception/InvalidQueryException.php', - 'Zend\\Db\\Adapter\\Exception\\RuntimeException' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Exception/RuntimeException.php', - 'Zend\\Db\\Adapter\\Exception\\UnexpectedValueException' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Exception/UnexpectedValueException.php', - 'Zend\\Db\\Adapter\\ParameterContainer' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/ParameterContainer.php', - 'Zend\\Db\\Adapter\\Platform\\AbstractPlatform' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Platform/AbstractPlatform.php', - 'Zend\\Db\\Adapter\\Platform\\IbmDb2' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Platform/IbmDb2.php', - 'Zend\\Db\\Adapter\\Platform\\Mysql' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Platform/Mysql.php', - 'Zend\\Db\\Adapter\\Platform\\Oracle' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Platform/Oracle.php', - 'Zend\\Db\\Adapter\\Platform\\PlatformInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Platform/PlatformInterface.php', - 'Zend\\Db\\Adapter\\Platform\\Postgresql' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Platform/Postgresql.php', - 'Zend\\Db\\Adapter\\Platform\\Sql92' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Platform/Sql92.php', - 'Zend\\Db\\Adapter\\Platform\\SqlServer' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Platform/SqlServer.php', - 'Zend\\Db\\Adapter\\Platform\\Sqlite' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Platform/Sqlite.php', - 'Zend\\Db\\Adapter\\Profiler\\Profiler' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Profiler/Profiler.php', - 'Zend\\Db\\Adapter\\Profiler\\ProfilerAwareInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Profiler/ProfilerAwareInterface.php', - 'Zend\\Db\\Adapter\\Profiler\\ProfilerInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/Profiler/ProfilerInterface.php', - 'Zend\\Db\\Adapter\\StatementContainer' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/StatementContainer.php', - 'Zend\\Db\\Adapter\\StatementContainerInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Adapter/StatementContainerInterface.php', - 'Zend\\Db\\ConfigProvider' => __DIR__ . '/..' . '/zendframework/zend-db/src/ConfigProvider.php', - 'Zend\\Db\\Exception\\ErrorException' => __DIR__ . '/..' . '/zendframework/zend-db/src/Exception/ErrorException.php', - 'Zend\\Db\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Exception/ExceptionInterface.php', - 'Zend\\Db\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/zendframework/zend-db/src/Exception/InvalidArgumentException.php', - 'Zend\\Db\\Exception\\RuntimeException' => __DIR__ . '/..' . '/zendframework/zend-db/src/Exception/RuntimeException.php', - 'Zend\\Db\\Exception\\UnexpectedValueException' => __DIR__ . '/..' . '/zendframework/zend-db/src/Exception/UnexpectedValueException.php', - 'Zend\\Db\\Metadata\\Metadata' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Metadata.php', - 'Zend\\Db\\Metadata\\MetadataInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/MetadataInterface.php', - 'Zend\\Db\\Metadata\\Object\\AbstractTableObject' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Object/AbstractTableObject.php', - 'Zend\\Db\\Metadata\\Object\\ColumnObject' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Object/ColumnObject.php', - 'Zend\\Db\\Metadata\\Object\\ConstraintKeyObject' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Object/ConstraintKeyObject.php', - 'Zend\\Db\\Metadata\\Object\\ConstraintObject' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Object/ConstraintObject.php', - 'Zend\\Db\\Metadata\\Object\\TableObject' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Object/TableObject.php', - 'Zend\\Db\\Metadata\\Object\\TriggerObject' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Object/TriggerObject.php', - 'Zend\\Db\\Metadata\\Object\\ViewObject' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Object/ViewObject.php', - 'Zend\\Db\\Metadata\\Source\\AbstractSource' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Source/AbstractSource.php', - 'Zend\\Db\\Metadata\\Source\\Factory' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Source/Factory.php', - 'Zend\\Db\\Metadata\\Source\\MysqlMetadata' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Source/MysqlMetadata.php', - 'Zend\\Db\\Metadata\\Source\\OracleMetadata' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Source/OracleMetadata.php', - 'Zend\\Db\\Metadata\\Source\\PostgresqlMetadata' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Source/PostgresqlMetadata.php', - 'Zend\\Db\\Metadata\\Source\\SqlServerMetadata' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Source/SqlServerMetadata.php', - 'Zend\\Db\\Metadata\\Source\\SqliteMetadata' => __DIR__ . '/..' . '/zendframework/zend-db/src/Metadata/Source/SqliteMetadata.php', - 'Zend\\Db\\Module' => __DIR__ . '/..' . '/zendframework/zend-db/src/Module.php', - 'Zend\\Db\\ResultSet\\AbstractResultSet' => __DIR__ . '/..' . '/zendframework/zend-db/src/ResultSet/AbstractResultSet.php', - 'Zend\\Db\\ResultSet\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/ResultSet/Exception/ExceptionInterface.php', - 'Zend\\Db\\ResultSet\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/zendframework/zend-db/src/ResultSet/Exception/InvalidArgumentException.php', - 'Zend\\Db\\ResultSet\\Exception\\RuntimeException' => __DIR__ . '/..' . '/zendframework/zend-db/src/ResultSet/Exception/RuntimeException.php', - 'Zend\\Db\\ResultSet\\HydratingResultSet' => __DIR__ . '/..' . '/zendframework/zend-db/src/ResultSet/HydratingResultSet.php', - 'Zend\\Db\\ResultSet\\ResultSet' => __DIR__ . '/..' . '/zendframework/zend-db/src/ResultSet/ResultSet.php', - 'Zend\\Db\\ResultSet\\ResultSetInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/ResultSet/ResultSetInterface.php', - 'Zend\\Db\\RowGateway\\AbstractRowGateway' => __DIR__ . '/..' . '/zendframework/zend-db/src/RowGateway/AbstractRowGateway.php', - 'Zend\\Db\\RowGateway\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/RowGateway/Exception/ExceptionInterface.php', - 'Zend\\Db\\RowGateway\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/zendframework/zend-db/src/RowGateway/Exception/InvalidArgumentException.php', - 'Zend\\Db\\RowGateway\\Exception\\RuntimeException' => __DIR__ . '/..' . '/zendframework/zend-db/src/RowGateway/Exception/RuntimeException.php', - 'Zend\\Db\\RowGateway\\Feature\\AbstractFeature' => __DIR__ . '/..' . '/zendframework/zend-db/src/RowGateway/Feature/AbstractFeature.php', - 'Zend\\Db\\RowGateway\\Feature\\FeatureSet' => __DIR__ . '/..' . '/zendframework/zend-db/src/RowGateway/Feature/FeatureSet.php', - 'Zend\\Db\\RowGateway\\RowGateway' => __DIR__ . '/..' . '/zendframework/zend-db/src/RowGateway/RowGateway.php', - 'Zend\\Db\\RowGateway\\RowGatewayInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/RowGateway/RowGatewayInterface.php', - 'Zend\\Db\\Sql\\AbstractExpression' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/AbstractExpression.php', - 'Zend\\Db\\Sql\\AbstractPreparableSql' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/AbstractPreparableSql.php', - 'Zend\\Db\\Sql\\AbstractSql' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/AbstractSql.php', - 'Zend\\Db\\Sql\\Combine' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Combine.php', - 'Zend\\Db\\Sql\\Ddl\\AlterTable' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/AlterTable.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\AbstractLengthColumn' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/AbstractLengthColumn.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\AbstractPrecisionColumn' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/AbstractPrecisionColumn.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\AbstractTimestampColumn' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/AbstractTimestampColumn.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\BigInteger' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/BigInteger.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Binary' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Binary.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Blob' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Blob.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Boolean' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Boolean.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Char' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Char.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Column' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Column.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\ColumnInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/ColumnInterface.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Date' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Date.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Datetime' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Datetime.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Decimal' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Decimal.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Float' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Float.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Floating' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Floating.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Integer' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Integer.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Text' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Text.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Time' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Time.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Timestamp' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Timestamp.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Varbinary' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Varbinary.php', - 'Zend\\Db\\Sql\\Ddl\\Column\\Varchar' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Column/Varchar.php', - 'Zend\\Db\\Sql\\Ddl\\Constraint\\AbstractConstraint' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Constraint/AbstractConstraint.php', - 'Zend\\Db\\Sql\\Ddl\\Constraint\\Check' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Constraint/Check.php', - 'Zend\\Db\\Sql\\Ddl\\Constraint\\ConstraintInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Constraint/ConstraintInterface.php', - 'Zend\\Db\\Sql\\Ddl\\Constraint\\ForeignKey' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Constraint/ForeignKey.php', - 'Zend\\Db\\Sql\\Ddl\\Constraint\\PrimaryKey' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Constraint/PrimaryKey.php', - 'Zend\\Db\\Sql\\Ddl\\Constraint\\UniqueKey' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Constraint/UniqueKey.php', - 'Zend\\Db\\Sql\\Ddl\\CreateTable' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/CreateTable.php', - 'Zend\\Db\\Sql\\Ddl\\DropTable' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/DropTable.php', - 'Zend\\Db\\Sql\\Ddl\\Index\\AbstractIndex' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Index/AbstractIndex.php', - 'Zend\\Db\\Sql\\Ddl\\Index\\Index' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/Index/Index.php', - 'Zend\\Db\\Sql\\Ddl\\SqlInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Ddl/SqlInterface.php', - 'Zend\\Db\\Sql\\Delete' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Delete.php', - 'Zend\\Db\\Sql\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Exception/ExceptionInterface.php', - 'Zend\\Db\\Sql\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Exception/InvalidArgumentException.php', - 'Zend\\Db\\Sql\\Exception\\RuntimeException' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Exception/RuntimeException.php', - 'Zend\\Db\\Sql\\Expression' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Expression.php', - 'Zend\\Db\\Sql\\ExpressionInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/ExpressionInterface.php', - 'Zend\\Db\\Sql\\Having' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Having.php', - 'Zend\\Db\\Sql\\Insert' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Insert.php', - 'Zend\\Db\\Sql\\Join' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Join.php', - 'Zend\\Db\\Sql\\Literal' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Literal.php', - 'Zend\\Db\\Sql\\Platform\\AbstractPlatform' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/AbstractPlatform.php', - 'Zend\\Db\\Sql\\Platform\\IbmDb2\\IbmDb2' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/IbmDb2/IbmDb2.php', - 'Zend\\Db\\Sql\\Platform\\IbmDb2\\SelectDecorator' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/IbmDb2/SelectDecorator.php', - 'Zend\\Db\\Sql\\Platform\\Mysql\\Ddl\\AlterTableDecorator' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/Mysql/Ddl/AlterTableDecorator.php', - 'Zend\\Db\\Sql\\Platform\\Mysql\\Ddl\\CreateTableDecorator' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/Mysql/Ddl/CreateTableDecorator.php', - 'Zend\\Db\\Sql\\Platform\\Mysql\\Mysql' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/Mysql/Mysql.php', - 'Zend\\Db\\Sql\\Platform\\Mysql\\SelectDecorator' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/Mysql/SelectDecorator.php', - 'Zend\\Db\\Sql\\Platform\\Oracle\\Oracle' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/Oracle/Oracle.php', - 'Zend\\Db\\Sql\\Platform\\Oracle\\SelectDecorator' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/Oracle/SelectDecorator.php', - 'Zend\\Db\\Sql\\Platform\\Platform' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/Platform.php', - 'Zend\\Db\\Sql\\Platform\\PlatformDecoratorInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/PlatformDecoratorInterface.php', - 'Zend\\Db\\Sql\\Platform\\SqlServer\\Ddl\\CreateTableDecorator' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/SqlServer/Ddl/CreateTableDecorator.php', - 'Zend\\Db\\Sql\\Platform\\SqlServer\\SelectDecorator' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/SqlServer/SelectDecorator.php', - 'Zend\\Db\\Sql\\Platform\\SqlServer\\SqlServer' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/SqlServer/SqlServer.php', - 'Zend\\Db\\Sql\\Platform\\Sqlite\\SelectDecorator' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/Sqlite/SelectDecorator.php', - 'Zend\\Db\\Sql\\Platform\\Sqlite\\Sqlite' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Platform/Sqlite/Sqlite.php', - 'Zend\\Db\\Sql\\Predicate\\Between' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/Between.php', - 'Zend\\Db\\Sql\\Predicate\\Expression' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/Expression.php', - 'Zend\\Db\\Sql\\Predicate\\In' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/In.php', - 'Zend\\Db\\Sql\\Predicate\\IsNotNull' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/IsNotNull.php', - 'Zend\\Db\\Sql\\Predicate\\IsNull' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/IsNull.php', - 'Zend\\Db\\Sql\\Predicate\\Like' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/Like.php', - 'Zend\\Db\\Sql\\Predicate\\Literal' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/Literal.php', - 'Zend\\Db\\Sql\\Predicate\\NotBetween' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/NotBetween.php', - 'Zend\\Db\\Sql\\Predicate\\NotIn' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/NotIn.php', - 'Zend\\Db\\Sql\\Predicate\\NotLike' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/NotLike.php', - 'Zend\\Db\\Sql\\Predicate\\Operator' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/Operator.php', - 'Zend\\Db\\Sql\\Predicate\\Predicate' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/Predicate.php', - 'Zend\\Db\\Sql\\Predicate\\PredicateInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/PredicateInterface.php', - 'Zend\\Db\\Sql\\Predicate\\PredicateSet' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Predicate/PredicateSet.php', - 'Zend\\Db\\Sql\\PreparableSqlInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/PreparableSqlInterface.php', - 'Zend\\Db\\Sql\\Select' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Select.php', - 'Zend\\Db\\Sql\\Sql' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Sql.php', - 'Zend\\Db\\Sql\\SqlInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/SqlInterface.php', - 'Zend\\Db\\Sql\\TableIdentifier' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/TableIdentifier.php', - 'Zend\\Db\\Sql\\Update' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Update.php', - 'Zend\\Db\\Sql\\Where' => __DIR__ . '/..' . '/zendframework/zend-db/src/Sql/Where.php', - 'Zend\\Db\\TableGateway\\AbstractTableGateway' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/AbstractTableGateway.php', - 'Zend\\Db\\TableGateway\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/Exception/ExceptionInterface.php', - 'Zend\\Db\\TableGateway\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/Exception/InvalidArgumentException.php', - 'Zend\\Db\\TableGateway\\Exception\\RuntimeException' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/Exception/RuntimeException.php', - 'Zend\\Db\\TableGateway\\Feature\\AbstractFeature' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/Feature/AbstractFeature.php', - 'Zend\\Db\\TableGateway\\Feature\\EventFeature' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/Feature/EventFeature.php', - 'Zend\\Db\\TableGateway\\Feature\\EventFeatureEventsInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/Feature/EventFeatureEventsInterface.php', - 'Zend\\Db\\TableGateway\\Feature\\EventFeature\\TableGatewayEvent' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/Feature/EventFeature/TableGatewayEvent.php', - 'Zend\\Db\\TableGateway\\Feature\\FeatureSet' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/Feature/FeatureSet.php', - 'Zend\\Db\\TableGateway\\Feature\\GlobalAdapterFeature' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/Feature/GlobalAdapterFeature.php', - 'Zend\\Db\\TableGateway\\Feature\\MasterSlaveFeature' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/Feature/MasterSlaveFeature.php', - 'Zend\\Db\\TableGateway\\Feature\\MetadataFeature' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/Feature/MetadataFeature.php', - 'Zend\\Db\\TableGateway\\Feature\\RowGatewayFeature' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/Feature/RowGatewayFeature.php', - 'Zend\\Db\\TableGateway\\Feature\\SequenceFeature' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/Feature/SequenceFeature.php', - 'Zend\\Db\\TableGateway\\TableGateway' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/TableGateway.php', - 'Zend\\Db\\TableGateway\\TableGatewayInterface' => __DIR__ . '/..' . '/zendframework/zend-db/src/TableGateway/TableGatewayInterface.php', - 'Zend\\Stdlib\\AbstractOptions' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/AbstractOptions.php', - 'Zend\\Stdlib\\ArrayObject' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ArrayObject.php', - 'Zend\\Stdlib\\ArraySerializableInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ArraySerializableInterface.php', - 'Zend\\Stdlib\\ArrayStack' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ArrayStack.php', - 'Zend\\Stdlib\\ArrayUtils' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ArrayUtils.php', - 'Zend\\Stdlib\\ArrayUtils\\MergeRemoveKey' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ArrayUtils/MergeRemoveKey.php', - 'Zend\\Stdlib\\ArrayUtils\\MergeReplaceKey' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ArrayUtils/MergeReplaceKey.php', - 'Zend\\Stdlib\\ArrayUtils\\MergeReplaceKeyInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ArrayUtils/MergeReplaceKeyInterface.php', - 'Zend\\Stdlib\\ConsoleHelper' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ConsoleHelper.php', - 'Zend\\Stdlib\\DispatchableInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/DispatchableInterface.php', - 'Zend\\Stdlib\\ErrorHandler' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ErrorHandler.php', - 'Zend\\Stdlib\\Exception\\BadMethodCallException' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Exception/BadMethodCallException.php', - 'Zend\\Stdlib\\Exception\\DomainException' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Exception/DomainException.php', - 'Zend\\Stdlib\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Exception/ExceptionInterface.php', - 'Zend\\Stdlib\\Exception\\ExtensionNotLoadedException' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Exception/ExtensionNotLoadedException.php', - 'Zend\\Stdlib\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Exception/InvalidArgumentException.php', - 'Zend\\Stdlib\\Exception\\LogicException' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Exception/LogicException.php', - 'Zend\\Stdlib\\Exception\\RuntimeException' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Exception/RuntimeException.php', - 'Zend\\Stdlib\\FastPriorityQueue' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/FastPriorityQueue.php', - 'Zend\\Stdlib\\Glob' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Glob.php', - 'Zend\\Stdlib\\Guard\\AllGuardsTrait' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Guard/AllGuardsTrait.php', - 'Zend\\Stdlib\\Guard\\ArrayOrTraversableGuardTrait' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Guard/ArrayOrTraversableGuardTrait.php', - 'Zend\\Stdlib\\Guard\\EmptyGuardTrait' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Guard/EmptyGuardTrait.php', - 'Zend\\Stdlib\\Guard\\NullGuardTrait' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Guard/NullGuardTrait.php', - 'Zend\\Stdlib\\InitializableInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/InitializableInterface.php', - 'Zend\\Stdlib\\JsonSerializable' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/JsonSerializable.php', - 'Zend\\Stdlib\\Message' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Message.php', - 'Zend\\Stdlib\\MessageInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/MessageInterface.php', - 'Zend\\Stdlib\\ParameterObjectInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ParameterObjectInterface.php', - 'Zend\\Stdlib\\Parameters' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Parameters.php', - 'Zend\\Stdlib\\ParametersInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ParametersInterface.php', - 'Zend\\Stdlib\\PriorityList' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/PriorityList.php', - 'Zend\\Stdlib\\PriorityQueue' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/PriorityQueue.php', - 'Zend\\Stdlib\\Request' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Request.php', - 'Zend\\Stdlib\\RequestInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/RequestInterface.php', - 'Zend\\Stdlib\\Response' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Response.php', - 'Zend\\Stdlib\\ResponseInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ResponseInterface.php', - 'Zend\\Stdlib\\SplPriorityQueue' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/SplPriorityQueue.php', - 'Zend\\Stdlib\\SplQueue' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/SplQueue.php', - 'Zend\\Stdlib\\SplStack' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/SplStack.php', - 'Zend\\Stdlib\\StringUtils' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/StringUtils.php', - 'Zend\\Stdlib\\StringWrapper\\AbstractStringWrapper' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/StringWrapper/AbstractStringWrapper.php', - 'Zend\\Stdlib\\StringWrapper\\Iconv' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/StringWrapper/Iconv.php', - 'Zend\\Stdlib\\StringWrapper\\Intl' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/StringWrapper/Intl.php', - 'Zend\\Stdlib\\StringWrapper\\MbString' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/StringWrapper/MbString.php', - 'Zend\\Stdlib\\StringWrapper\\Native' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/StringWrapper/Native.php', - 'Zend\\Stdlib\\StringWrapper\\StringWrapperInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/StringWrapper/StringWrapperInterface.php', 'voku\\cache\\AdapterApc' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/AdapterApc.php', 'voku\\cache\\AdapterApcu' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/AdapterApcu.php', 'voku\\cache\\AdapterArray' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/AdapterArray.php', @@ -338,9 +353,15 @@ class ComposerStaticInitcbda25b16bb8365467298ce193f0f30c 'voku\\cache\\CacheAdapterAutoManager' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/CacheAdapterAutoManager.php', 'voku\\cache\\CacheChain' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/CacheChain.php', 'voku\\cache\\CachePsr16' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/CachePsr16.php', + 'voku\\cache\\Exception\\ChmodException' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/Exception/ChmodException.php', + 'voku\\cache\\Exception\\FileErrorExceptionInterface' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/Exception/FileErrorExceptionInterface.php', 'voku\\cache\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/Exception/InvalidArgumentException.php', + 'voku\\cache\\Exception\\RenameException' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/Exception/RenameException.php', + 'voku\\cache\\Exception\\RuntimeException' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/Exception/RuntimeException.php', + 'voku\\cache\\Exception\\WriteContentException' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/Exception/WriteContentException.php', 'voku\\cache\\SerializerDefault' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/SerializerDefault.php', 'voku\\cache\\SerializerIgbinary' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/SerializerIgbinary.php', + 'voku\\cache\\SerializerMsgpack' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/SerializerMsgpack.php', 'voku\\cache\\SerializerNo' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/SerializerNo.php', 'voku\\cache\\iAdapter' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/iAdapter.php', 'voku\\cache\\iCache' => __DIR__ . '/..' . '/voku/simple-cache/src/voku/cache/iCache.php', diff --git a/bundled-libs/composer/installed.json b/bundled-libs/composer/installed.json index 356a7e48..96f61221 100644 --- a/bundled-libs/composer/installed.json +++ b/bundled-libs/composer/installed.json @@ -1,378 +1,432 @@ -[ - { - "name": "katzgrau/klogger", - "version": "1.0.0", - "version_normalized": "1.0.0.0", - "source": { - "type": "git", - "url": "https://github.com/katzgrau/klogger.git", - "reference": "46cdd92a9b4a8443120cc955bf831450cb274813" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/katzgrau/klogger/zipball/46cdd92a9b4a8443120cc955bf831450cb274813", - "reference": "46cdd92a9b4a8443120cc955bf831450cb274813", - "shasum": "" - }, - "require": { - "php": ">=5.3", - "psr/log": "1.0.0" - }, - "require-dev": { - "phpunit/phpunit": "4.0.*" - }, - "time": "2014-03-20T02:36:36+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Katzgrau\\KLogger\\": "src/" +{ + "packages": [ + { + "name": "katzgrau/klogger", + "version": "1.0.0", + "version_normalized": "1.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/katzgrau/klogger.git", + "reference": "46cdd92a9b4a8443120cc955bf831450cb274813" }, - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Dan Horrigan", - "email": "dan@dhorrigan.com", - "homepage": "http://dhorrigan.com", - "role": "Lead Developer" + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/katzgrau/klogger/zipball/46cdd92a9b4a8443120cc955bf831450cb274813", + "reference": "46cdd92a9b4a8443120cc955bf831450cb274813", + "shasum": "" }, - { - "name": "Kenny Katzgrau", - "email": "katzgrau@gmail.com" - } - ], - "description": "A Simple Logging Class", - "keywords": [ - "logging" - ] - }, - { - "name": "psr/log", - "version": "1.0.0", - "version_normalized": "1.0.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", - "shasum": "" - }, - "time": "2012-12-21T11:40:51+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-0": { - "Psr\\Log\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "keywords": [ - "log", - "psr", - "psr-3" - ] - }, - { - "name": "psr/simple-cache", - "version": "1.0.1", - "version_normalized": "1.0.1.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/simple-cache.git", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "time": "2017-10-23T01:57:42+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Psr\\SimpleCache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interfaces for simple caching", - "keywords": [ - "cache", - "caching", - "psr", - "psr-16", - "simple-cache" - ] - }, - { - "name": "voku/simple-cache", - "version": "4.0.1", - "version_normalized": "4.0.1.0", - "source": { - "type": "git", - "url": "https://github.com/voku/simple-cache.git", - "reference": "dfda1d803fd79d9ee918e1bac700c94a6f30659c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/voku/simple-cache/zipball/dfda1d803fd79d9ee918e1bac700c94a6f30659c", - "reference": "dfda1d803fd79d9ee918e1bac700c94a6f30659c", - "shasum": "" - }, - "require": { - "php": ">=7.0.0", - "psr/simple-cache": "~1.0" - }, - "provide": { - "psr/simple-cache-implementation": "1.0" - }, - "require-dev": { - "phpunit/phpunit": "~6.0 || ~7.0" - }, - "time": "2019-03-03T10:23:55+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "voku\\cache\\": "src/voku/cache/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Lars Moelleken", - "homepage": "http://www.moelleken.org/", - "role": "Developer" - } - ], - "description": "Simple Cache library", - "homepage": "https://github.com/voku/simple-cache", - "keywords": [ - "cache", - "caching", - "php", - "simple cache" - ] - }, - { - "name": "zendframework/zend-db", - "version": "2.10.0", - "version_normalized": "2.10.0.0", - "source": { - "type": "git", - "url": "https://github.com/zendframework/zend-db.git", - "reference": "320f5faaa0f98ebc93be5476ec4eda28255935c4" - }, - "dist": { - "type": "zip", - "url": "https://packages.zendframework.com/composer/zendframework-zend-db-2.10.0-5a43dc.zip", - "reference": "320f5faaa0f98ebc93be5476ec4eda28255935c4", - "shasum": "3f285fe0d475cac25e350787779019caa6ddb188" - }, - "require": { - "php": "^5.6 || ^7.0", - "zendframework/zend-stdlib": "^2.7 || ^3.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7.25 || ^6.4.4", - "zendframework/zend-coding-standard": "~1.0.0", - "zendframework/zend-eventmanager": "^2.6.2 || ^3.0", - "zendframework/zend-hydrator": "^1.1 || ^2.1 || ^3.0", - "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3" - }, - "suggest": { - "zendframework/zend-eventmanager": "Zend\\EventManager component", - "zendframework/zend-hydrator": "Zend\\Hydrator component for using HydratingResultSets", - "zendframework/zend-servicemanager": "Zend\\ServiceManager component" - }, - "time": "2019-02-25T11:37:45+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.9-dev", - "dev-develop": "2.10-dev" + "require": { + "php": ">=5.3", + "psr/log": "1.0.0" }, - "zf": { - "component": "Zend\\Db", - "config-provider": "Zend\\Db\\ConfigProvider" - } + "require-dev": { + "phpunit/phpunit": "4.0.*" + }, + "time": "2014-03-20T02:36:36+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Katzgrau\\KLogger\\": "src/" + }, + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dan Horrigan", + "email": "dan@dhorrigan.com", + "homepage": "http://dhorrigan.com", + "role": "Lead Developer" + }, + { + "name": "Kenny Katzgrau", + "email": "katzgrau@gmail.com" + } + ], + "description": "A Simple Logging Class", + "keywords": [ + "logging" + ], + "install-path": "../katzgrau/klogger" }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Zend\\Db\\": "src/" - } + { + "name": "laminas/laminas-db", + "version": "2.11.4", + "version_normalized": "2.11.4.0", + "source": { + "type": "git", + "url": "https://github.com/laminas/laminas-db.git", + "reference": "5b59413b8dd5d79e3fe58c2650c60b1730989f36" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laminas/laminas-db/zipball/5b59413b8dd5d79e3fe58c2650c60b1730989f36", + "reference": "5b59413b8dd5d79e3fe58c2650c60b1730989f36", + "shasum": "" + }, + "require": { + "laminas/laminas-stdlib": "^2.7 || ^3.0", + "laminas/laminas-zendframework-bridge": "^1.0", + "php": "^5.6 || ^7.0" + }, + "replace": { + "zendframework/zend-db": "^2.11.0" + }, + "require-dev": { + "laminas/laminas-coding-standard": "~1.0.0", + "laminas/laminas-eventmanager": "^2.6.2 || ^3.0", + "laminas/laminas-hydrator": "^1.1 || ^2.1 || ^3.0", + "laminas/laminas-servicemanager": "^2.7.5 || ^3.0.3", + "phpunit/phpunit": "^5.7.27 || ^6.5.14" + }, + "suggest": { + "laminas/laminas-eventmanager": "Laminas\\EventManager component", + "laminas/laminas-hydrator": "Laminas\\Hydrator component for using HydratingResultSets", + "laminas/laminas-servicemanager": "Laminas\\ServiceManager component" + }, + "time": "2021-02-20T18:52:15+00:00", + "type": "library", + "extra": { + "laminas": { + "component": "Laminas\\Db", + "config-provider": "Laminas\\Db\\ConfigProvider" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Laminas\\Db\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Database abstraction layer, SQL abstraction, result set abstraction, and RowDataGateway and TableDataGateway implementations", + "homepage": "https://laminas.dev", + "keywords": [ + "db", + "laminas" + ], + "support": { + "chat": "https://laminas.dev/chat", + "docs": "https://docs.laminas.dev/laminas-db/", + "forum": "https://discourse.laminas.dev", + "issues": "https://github.com/laminas/laminas-db/issues", + "rss": "https://github.com/laminas/laminas-db/releases.atom", + "source": "https://github.com/laminas/laminas-db" + }, + "funding": [ + { + "url": "https://funding.communitybridge.org/projects/laminas-project", + "type": "community_bridge" + } + ], + "install-path": "../laminas/laminas-db" }, - "autoload-dev": { - "files": [ - "test/autoload.php" + { + "name": "laminas/laminas-stdlib", + "version": "3.2.1", + "version_normalized": "3.2.1.0", + "source": { + "type": "git", + "url": "https://github.com/laminas/laminas-stdlib.git", + "reference": "2b18347625a2f06a1a485acfbc870f699dbe51c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laminas/laminas-stdlib/zipball/2b18347625a2f06a1a485acfbc870f699dbe51c6", + "reference": "2b18347625a2f06a1a485acfbc870f699dbe51c6", + "shasum": "" + }, + "require": { + "laminas/laminas-zendframework-bridge": "^1.0", + "php": "^5.6 || ^7.0" + }, + "replace": { + "zendframework/zend-stdlib": "self.version" + }, + "require-dev": { + "laminas/laminas-coding-standard": "~1.0.0", + "phpbench/phpbench": "^0.13", + "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2" + }, + "time": "2019-12-31T17:51:15+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2.x-dev", + "dev-develop": "3.3.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Laminas\\Stdlib\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" ], - "psr-4": { - "ZendTest\\Db\\": "test/unit", - "ZendIntegrationTest\\Db\\": "test/integration" - } + "description": "SPL extensions, array utilities, error handlers, and more", + "homepage": "https://laminas.dev", + "keywords": [ + "laminas", + "stdlib" + ], + "support": { + "chat": "https://laminas.dev/chat", + "docs": "https://docs.laminas.dev/laminas-stdlib/", + "forum": "https://discourse.laminas.dev", + "issues": "https://github.com/laminas/laminas-stdlib/issues", + "rss": "https://github.com/laminas/laminas-stdlib/releases.atom", + "source": "https://github.com/laminas/laminas-stdlib" + }, + "install-path": "../laminas/laminas-stdlib" }, - "scripts": { - "check": [ - "@cs-check", - "@test" + { + "name": "laminas/laminas-zendframework-bridge", + "version": "1.1.1", + "version_normalized": "1.1.1.0", + "source": { + "type": "git", + "url": "https://github.com/laminas/laminas-zendframework-bridge.git", + "reference": "6ede70583e101030bcace4dcddd648f760ddf642" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laminas/laminas-zendframework-bridge/zipball/6ede70583e101030bcace4dcddd648f760ddf642", + "reference": "6ede70583e101030bcace4dcddd648f760ddf642", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.1 || ^9.3", + "squizlabs/php_codesniffer": "^3.5" + }, + "time": "2020-09-14T14:23:00+00:00", + "type": "library", + "extra": { + "laminas": { + "module": "Laminas\\ZendFrameworkBridge" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/autoload.php" + ], + "psr-4": { + "Laminas\\ZendFrameworkBridge\\": "src//" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" ], - "cs-check": [ - "phpcs" + "description": "Alias legacy ZF class names to Laminas Project equivalents.", + "keywords": [ + "ZendFramework", + "autoloading", + "laminas", + "zf" ], - "cs-fix": [ - "phpcbf" + "support": { + "forum": "https://discourse.laminas.dev/", + "issues": "https://github.com/laminas/laminas-zendframework-bridge/issues", + "rss": "https://github.com/laminas/laminas-zendframework-bridge/releases.atom", + "source": "https://github.com/laminas/laminas-zendframework-bridge" + }, + "funding": [ + { + "url": "https://funding.communitybridge.org/projects/laminas-project", + "type": "community_bridge" + } ], - "test": [ - "phpunit --colors=always --testsuite \"unit test\"" - ], - "test-coverage": [ - "phpunit --colors=always --coverage-clover clover.xml" - ], - "test-integration": [ - "phpunit --colors=always --testsuite \"integration test\"" - ], - "upload-coverage": [ - "coveralls -v" - ] + "install-path": "../laminas/laminas-zendframework-bridge" }, - "license": [ - "BSD-3-Clause" - ], - "description": "Database abstraction layer, SQL abstraction, result set abstraction, and RowDataGateway and TableDataGateway implementations", - "keywords": [ - "db", - "zendframework", - "zf" - ], - "support": { - "docs": "https://docs.zendframework.com/zend-db/", - "issues": "https://github.com/zendframework/zend-db/issues", - "source": "https://github.com/zendframework/zend-db", - "rss": "https://github.com/zendframework/zend-db/releases.atom", - "slack": "https://zendframework-slack.herokuapp.com", - "forum": "https://discourse.zendframework.com/c/questions/components" + { + "name": "psr/log", + "version": "1.0.0", + "version_normalized": "1.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", + "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", + "shasum": "" + }, + "time": "2012-12-21T11:40:51+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "Psr\\Log\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "install-path": "../psr/log" + }, + { + "name": "psr/simple-cache", + "version": "1.0.1", + "version_normalized": "1.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2017-10-23T01:57:42+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ], + "install-path": "../psr/simple-cache" + }, + { + "name": "voku/simple-cache", + "version": "4.0.5", + "version_normalized": "4.0.5.0", + "source": { + "type": "git", + "url": "https://github.com/voku/simple-cache.git", + "reference": "416cf88902991f3bf6168b71c0683e6dabb3d5e1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/voku/simple-cache/zipball/416cf88902991f3bf6168b71c0683e6dabb3d5e1", + "reference": "416cf88902991f3bf6168b71c0683e6dabb3d5e1", + "shasum": "" + }, + "require": { + "php": ">=7.0.0", + "psr/simple-cache": "~1.0" + }, + "provide": { + "psr/simple-cache-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~6.0 || ~7.0" + }, + "suggest": { + "predis/predis": "~1.1", + "symfony/var-exporter": "~3.0 || ~4.0 || ~5.0" + }, + "time": "2020-03-15T21:00:57+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "voku\\cache\\": "src/voku/cache/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Lars Moelleken", + "homepage": "http://www.moelleken.org/", + "role": "Developer" + } + ], + "description": "Simple Cache library", + "homepage": "https://github.com/voku/simple-cache", + "keywords": [ + "cache", + "caching", + "php", + "simple cache" + ], + "support": { + "issues": "https://github.com/voku/simple-cache/issues", + "source": "https://github.com/voku/simple-cache/tree/master" + }, + "funding": [ + { + "url": "https://www.paypal.me/moelleken", + "type": "custom" + }, + { + "url": "https://github.com/voku", + "type": "github" + }, + { + "url": "https://www.patreon.com/voku", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/voku/simple-cache", + "type": "tidelift" + } + ], + "install-path": "../voku/simple-cache" } - }, - { - "name": "zendframework/zend-stdlib", - "version": "3.2.1", - "version_normalized": "3.2.1.0", - "source": { - "type": "git", - "url": "https://github.com/zendframework/zend-stdlib.git", - "reference": "04e09d7f961b2271b0e1cbbb6f5f53ad23cf8562" - }, - "dist": { - "type": "zip", - "url": "https://packages.zendframework.com/composer/zendframework-zend-stdlib-3.2.1-90faf1.zip", - "reference": "04e09d7f961b2271b0e1cbbb6f5f53ad23cf8562", - "shasum": "36f654611fab0d6fe1ea1c72184a43f9810ce7c8" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpbench/phpbench": "^0.13", - "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2", - "zendframework/zend-coding-standard": "~1.0.0" - }, - "time": "2018-08-28T21:34:05+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2.x-dev", - "dev-develop": "3.3.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Zend\\Stdlib\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "ZendTest\\Stdlib\\": "test/", - "ZendBench\\Stdlib\\": "benchmark/" - } - }, - "scripts": { - "check": [ - "@cs-check", - "@test" - ], - "cs-check": [ - "phpcs" - ], - "cs-fix": [ - "phpcbf" - ], - "test": [ - "phpunit --colors=always" - ], - "test-coverage": [ - "phpunit --colors=always --coverage-clover clover.xml" - ] - }, - "license": [ - "BSD-3-Clause" - ], - "description": "SPL extensions, array utilities, error handlers, and more", - "keywords": [ - "stdlib", - "zendframework", - "zf" - ], - "support": { - "docs": "https://docs.zendframework.com/zend-stdlib/", - "issues": "https://github.com/zendframework/zend-stdlib/issues", - "source": "https://github.com/zendframework/zend-stdlib", - "rss": "https://github.com/zendframework/zend-stdlib/releases.atom", - "slack": "https://zendframework-slack.herokuapp.com", - "forum": "https://discourse.zendframework.com/c/questions/components" - } - } -] + ], + "dev": true, + "dev-package-names": [] +} diff --git a/bundled-libs/composer/installed.php b/bundled-libs/composer/installed.php new file mode 100644 index 00000000..e2f73e65 --- /dev/null +++ b/bundled-libs/composer/installed.php @@ -0,0 +1,108 @@ + + array ( + 'pretty_version' => 'dev-master', + 'version' => 'dev-master', + 'aliases' => + array ( + ), + 'reference' => '05f58f90d743fe9ade24f3fdfe9a934d0b87c6a1', + 'name' => '__root__', + ), + 'versions' => + array ( + '__root__' => + array ( + 'pretty_version' => 'dev-master', + 'version' => 'dev-master', + 'aliases' => + array ( + ), + 'reference' => '05f58f90d743fe9ade24f3fdfe9a934d0b87c6a1', + ), + 'katzgrau/klogger' => + array ( + 'pretty_version' => '1.0.0', + 'version' => '1.0.0.0', + 'aliases' => + array ( + ), + 'reference' => '46cdd92a9b4a8443120cc955bf831450cb274813', + ), + 'laminas/laminas-db' => + array ( + 'pretty_version' => '2.11.4', + 'version' => '2.11.4.0', + 'aliases' => + array ( + ), + 'reference' => '5b59413b8dd5d79e3fe58c2650c60b1730989f36', + ), + 'laminas/laminas-stdlib' => + array ( + 'pretty_version' => '3.2.1', + 'version' => '3.2.1.0', + 'aliases' => + array ( + ), + 'reference' => '2b18347625a2f06a1a485acfbc870f699dbe51c6', + ), + 'laminas/laminas-zendframework-bridge' => + array ( + 'pretty_version' => '1.1.1', + 'version' => '1.1.1.0', + 'aliases' => + array ( + ), + 'reference' => '6ede70583e101030bcace4dcddd648f760ddf642', + ), + 'psr/log' => + array ( + 'pretty_version' => '1.0.0', + 'version' => '1.0.0.0', + 'aliases' => + array ( + ), + 'reference' => 'fe0936ee26643249e916849d48e3a51d5f5e278b', + ), + 'psr/simple-cache' => + array ( + 'pretty_version' => '1.0.1', + 'version' => '1.0.1.0', + 'aliases' => + array ( + ), + 'reference' => '408d5eafb83c57f6365a3ca330ff23aa4a5fa39b', + ), + 'psr/simple-cache-implementation' => + array ( + 'provided' => + array ( + 0 => '1.0', + ), + ), + 'voku/simple-cache' => + array ( + 'pretty_version' => '4.0.5', + 'version' => '4.0.5.0', + 'aliases' => + array ( + ), + 'reference' => '416cf88902991f3bf6168b71c0683e6dabb3d5e1', + ), + 'zendframework/zend-db' => + array ( + 'replaced' => + array ( + 0 => '^2.11.0', + ), + ), + 'zendframework/zend-stdlib' => + array ( + 'replaced' => + array ( + 0 => '3.2.1', + ), + ), + ), +); diff --git a/bundled-libs/composer/platform_check.php b/bundled-libs/composer/platform_check.php new file mode 100644 index 00000000..f79e574b --- /dev/null +++ b/bundled-libs/composer/platform_check.php @@ -0,0 +1,26 @@ += 70000)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 7.0.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; + } + } + trigger_error( + 'Composer detected issues in your platform: ' . implode(' ', $issues), + E_USER_ERROR + ); +} diff --git a/bundled-libs/laminas/laminas-db/.laminas-ci.json b/bundled-libs/laminas/laminas-db/.laminas-ci.json new file mode 100644 index 00000000..22c8d7c4 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/.laminas-ci.json @@ -0,0 +1,10 @@ +{ + "extensions": [ + "pdo-mysql", + "pdo-pgsql", + "pdo-sqlite", + "mysqli", + "pgsql", + "sqlite3" + ] +} diff --git a/bundled-libs/laminas/laminas-db/.laminas-ci/mysql_permissions.sql b/bundled-libs/laminas/laminas-db/.laminas-ci/mysql_permissions.sql new file mode 100644 index 00000000..59c1c608 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/.laminas-ci/mysql_permissions.sql @@ -0,0 +1,3 @@ +CREATE USER 'gha'@'%' IDENTIFIED WITH mysql_native_password BY 'password'; +GRANT ALL PRIVILEGES ON *.* TO 'gha'@'%'; +FLUSH PRIVILEGES; diff --git a/bundled-libs/laminas/laminas-db/.laminas-ci/phpunit.xml b/bundled-libs/laminas/laminas-db/.laminas-ci/phpunit.xml new file mode 100644 index 00000000..b6e4f865 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/.laminas-ci/phpunit.xml @@ -0,0 +1,67 @@ + + + + + ./test/unit + + + ./test/integration + + + + + + ./src + + ./src/Sql/Ddl/Column/Float.php + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bundled-libs/laminas/laminas-db/.laminas-ci/pre-run.sh b/bundled-libs/laminas/laminas-db/.laminas-ci/pre-run.sh new file mode 100755 index 00000000..660082ad --- /dev/null +++ b/bundled-libs/laminas/laminas-db/.laminas-ci/pre-run.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +set -e + +TEST_USER=$1 +WORKSPACE=$2 +JOB=$3 + +COMMAND=$(echo "${JOB}" | jq -r '.command') + +if [[ ! ${COMMAND} =~ phpunit ]]; then + exit 0 +fi + +PHP_VERSION=$(echo "${JOB}" | jq -r '.php') + +# Install CI version of phpunit config +cp .laminas-ci/phpunit.xml phpunit.xml + +# Install lsof (used in integration tests) +apt update -qq +apt install -yqq lsof diff --git a/bundled-libs/laminas/laminas-db/COPYRIGHT.md b/bundled-libs/laminas/laminas-db/COPYRIGHT.md new file mode 100644 index 00000000..0a8cccc0 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/COPYRIGHT.md @@ -0,0 +1 @@ +Copyright (c) 2020 Laminas Project a Series of LF Projects, LLC. (https://getlaminas.org/) diff --git a/bundled-libs/laminas/laminas-db/LICENSE.md b/bundled-libs/laminas/laminas-db/LICENSE.md new file mode 100644 index 00000000..10b40f14 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/LICENSE.md @@ -0,0 +1,26 @@ +Copyright (c) 2020 Laminas Project a Series of LF Projects, LLC. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +- Neither the name of Laminas Foundation nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/bundled-libs/laminas/laminas-db/README.md b/bundled-libs/laminas/laminas-db/README.md new file mode 100644 index 00000000..dcd25081 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/README.md @@ -0,0 +1,11 @@ +# laminas-db + +[![Build Status](https://github.com/laminas/laminas-config/workflows/Continuous%20Integration/badge.svg)](https://github.com/laminas/laminas-config/actions?query=workflow%3A"Continuous+Integration") + +`Laminas\Db` is a component that abstract the access to a Database using an object +oriented API to build the queries. `Laminas\Db` consumes different storage adapters +to access different database vendors such as MySQL, PostgreSQL, Oracle, IBM DB2, +Microsoft Sql Server, PDO, etc. + +- File issues at https://github.com/laminas/laminas-db/issues +- Documentation is at https://docs.laminas.dev/laminas-db/ diff --git a/bundled-libs/laminas/laminas-db/composer.json b/bundled-libs/laminas/laminas-db/composer.json new file mode 100644 index 00000000..be5520dd --- /dev/null +++ b/bundled-libs/laminas/laminas-db/composer.json @@ -0,0 +1,73 @@ +{ + "name": "laminas/laminas-db", + "description": "Database abstraction layer, SQL abstraction, result set abstraction, and RowDataGateway and TableDataGateway implementations", + "license": "BSD-3-Clause", + "keywords": [ + "laminas", + "db" + ], + "homepage": "https://laminas.dev", + "support": { + "docs": "https://docs.laminas.dev/laminas-db/", + "issues": "https://github.com/laminas/laminas-db/issues", + "source": "https://github.com/laminas/laminas-db", + "rss": "https://github.com/laminas/laminas-db/releases.atom", + "chat": "https://laminas.dev/chat", + "forum": "https://discourse.laminas.dev" + }, + "config": { + "sort-packages": true + }, + "extra": { + "laminas": { + "component": "Laminas\\Db", + "config-provider": "Laminas\\Db\\ConfigProvider" + } + }, + "require": { + "php": "^5.6 || ^7.0", + "laminas/laminas-stdlib": "^2.7 || ^3.0", + "laminas/laminas-zendframework-bridge": "^1.0" + }, + "require-dev": { + "laminas/laminas-coding-standard": "~1.0.0", + "laminas/laminas-eventmanager": "^2.6.2 || ^3.0", + "laminas/laminas-hydrator": "^1.1 || ^2.1 || ^3.0", + "laminas/laminas-servicemanager": "^2.7.5 || ^3.0.3", + "phpunit/phpunit": "^5.7.27 || ^6.5.14" + }, + "suggest": { + "laminas/laminas-eventmanager": "Laminas\\EventManager component", + "laminas/laminas-hydrator": "Laminas\\Hydrator component for using HydratingResultSets", + "laminas/laminas-servicemanager": "Laminas\\ServiceManager component" + }, + "autoload": { + "psr-4": { + "Laminas\\Db\\": "src/" + } + }, + "autoload-dev": { + "files": [ + "test/autoload.php" + ], + "psr-4": { + "LaminasTest\\Db\\": "test/unit/", + "LaminasIntegrationTest\\Db\\": "test/integration/" + } + }, + "scripts": { + "check": [ + "@cs-check", + "@test" + ], + "cs-check": "phpcs", + "cs-fix": "phpcbf", + "test": "phpunit --colors=always --testsuite \"unit test\"", + "test-coverage": "phpunit --colors=always --coverage-clover clover.xml", + "test-integration": "phpunit --colors=always --testsuite \"integration test\"", + "upload-coverage": "coveralls -v" + }, + "replace": { + "zendframework/zend-db": "^2.11.0" + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Adapter.php b/bundled-libs/laminas/laminas-db/src/Adapter/Adapter.php new file mode 100644 index 00000000..5f377f82 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Adapter.php @@ -0,0 +1,435 @@ +createProfiler($parameters); + } + $driver = $this->createDriver($parameters); + } elseif (! $driver instanceof Driver\DriverInterface) { + throw new Exception\InvalidArgumentException( + 'The supplied or instantiated driver object does not implement ' . Driver\DriverInterface::class + ); + } + + $driver->checkEnvironment(); + $this->driver = $driver; + + if ($platform === null) { + $platform = $this->createPlatform($parameters); + } + + $this->platform = $platform; + $this->queryResultSetPrototype = ($queryResultPrototype) ?: new ResultSet\ResultSet(); + + if ($profiler) { + $this->setProfiler($profiler); + } + } + + /** + * @param Profiler\ProfilerInterface $profiler + * @return self Provides a fluent interface + */ + public function setProfiler(Profiler\ProfilerInterface $profiler) + { + $this->profiler = $profiler; + if ($this->driver instanceof Profiler\ProfilerAwareInterface) { + $this->driver->setProfiler($profiler); + } + return $this; + } + + /** + * @return null|Profiler\ProfilerInterface + */ + public function getProfiler() + { + return $this->profiler; + } + + /** + * getDriver() + * + * @throws Exception\RuntimeException + * @return Driver\DriverInterface + */ + public function getDriver() + { + if ($this->driver === null) { + throw new Exception\RuntimeException('Driver has not been set or configured for this adapter.'); + } + return $this->driver; + } + + /** + * @return Platform\PlatformInterface + */ + public function getPlatform() + { + return $this->platform; + } + + /** + * @return ResultSet\ResultSetInterface + */ + public function getQueryResultSetPrototype() + { + return $this->queryResultSetPrototype; + } + + public function getCurrentSchema() + { + return $this->driver->getConnection()->getCurrentSchema(); + } + + /** + * query() is a convenience function + * + * @param string $sql + * @param string|array|ParameterContainer $parametersOrQueryMode + * @param \Laminas\Db\ResultSet\ResultSetInterface $resultPrototype + * @throws Exception\InvalidArgumentException + * @return Driver\StatementInterface|ResultSet\ResultSet + */ + public function query( + $sql, + $parametersOrQueryMode = self::QUERY_MODE_PREPARE, + ResultSet\ResultSetInterface $resultPrototype = null + ) { + if (is_string($parametersOrQueryMode) + && in_array($parametersOrQueryMode, [self::QUERY_MODE_PREPARE, self::QUERY_MODE_EXECUTE]) + ) { + $mode = $parametersOrQueryMode; + $parameters = null; + } elseif (is_array($parametersOrQueryMode) || $parametersOrQueryMode instanceof ParameterContainer) { + $mode = self::QUERY_MODE_PREPARE; + $parameters = $parametersOrQueryMode; + } else { + throw new Exception\InvalidArgumentException( + 'Parameter 2 to this method must be a flag, an array, or ParameterContainer' + ); + } + + if ($mode == self::QUERY_MODE_PREPARE) { + $this->lastPreparedStatement = null; + $this->lastPreparedStatement = $this->driver->createStatement($sql); + $this->lastPreparedStatement->prepare(); + if (is_array($parameters) || $parameters instanceof ParameterContainer) { + if (is_array($parameters)) { + $this->lastPreparedStatement->setParameterContainer(new ParameterContainer($parameters)); + } else { + $this->lastPreparedStatement->setParameterContainer($parameters); + } + $result = $this->lastPreparedStatement->execute(); + } else { + return $this->lastPreparedStatement; + } + } else { + $result = $this->driver->getConnection()->execute($sql); + } + + if ($result instanceof Driver\ResultInterface && $result->isQueryResult()) { + $resultSet = clone ($resultPrototype ?: $this->queryResultSetPrototype); + $resultSet->initialize($result); + return $resultSet; + } + + return $result; + } + + /** + * Create statement + * + * @param string $initialSql + * @param ParameterContainer $initialParameters + * @return Driver\StatementInterface + */ + public function createStatement($initialSql = null, $initialParameters = null) + { + $statement = $this->driver->createStatement($initialSql); + if ($initialParameters === null + || ! $initialParameters instanceof ParameterContainer + && is_array($initialParameters) + ) { + $initialParameters = new ParameterContainer((is_array($initialParameters) ? $initialParameters : [])); + } + $statement->setParameterContainer($initialParameters); + return $statement; + } + + public function getHelpers() + { + $functions = []; + $platform = $this->platform; + foreach (func_get_args() as $arg) { + switch ($arg) { + case self::FUNCTION_QUOTE_IDENTIFIER: + $functions[] = function ($value) use ($platform) { + return $platform->quoteIdentifier($value); + }; + break; + case self::FUNCTION_QUOTE_VALUE: + $functions[] = function ($value) use ($platform) { + return $platform->quoteValue($value); + }; + break; + } + } + } + + /** + * @param $name + * @throws Exception\InvalidArgumentException + * @return Driver\DriverInterface|Platform\PlatformInterface + */ + public function __get($name) + { + switch (strtolower($name)) { + case 'driver': + return $this->driver; + case 'platform': + return $this->platform; + default: + throw new Exception\InvalidArgumentException('Invalid magic property on adapter'); + } + } + + /** + * @param array $parameters + * @return Driver\DriverInterface + * @throws \InvalidArgumentException + * @throws Exception\InvalidArgumentException + */ + protected function createDriver($parameters) + { + if (! isset($parameters['driver'])) { + throw new Exception\InvalidArgumentException( + __FUNCTION__ . ' expects a "driver" key to be present inside the parameters' + ); + } + + if ($parameters['driver'] instanceof Driver\DriverInterface) { + return $parameters['driver']; + } + + if (! is_string($parameters['driver'])) { + throw new Exception\InvalidArgumentException( + __FUNCTION__ . ' expects a "driver" to be a string or instance of DriverInterface' + ); + } + + $options = []; + if (isset($parameters['options'])) { + $options = (array) $parameters['options']; + unset($parameters['options']); + } + + $driverName = strtolower($parameters['driver']); + switch ($driverName) { + case 'mysqli': + $driver = new Driver\Mysqli\Mysqli($parameters, null, null, $options); + break; + case 'sqlsrv': + $driver = new Driver\Sqlsrv\Sqlsrv($parameters); + break; + case 'oci8': + $driver = new Driver\Oci8\Oci8($parameters); + break; + case 'pgsql': + $driver = new Driver\Pgsql\Pgsql($parameters); + break; + case 'ibmdb2': + $driver = new Driver\IbmDb2\IbmDb2($parameters); + break; + case 'pdo': + default: + if ($driverName == 'pdo' || strpos($driverName, 'pdo') === 0) { + $driver = new Driver\Pdo\Pdo($parameters); + } + } + + if (! isset($driver) || ! $driver instanceof Driver\DriverInterface) { + throw new Exception\InvalidArgumentException('DriverInterface expected', null, null); + } + + return $driver; + } + + /** + * @param array $parameters + * @return Platform\PlatformInterface + */ + protected function createPlatform(array $parameters) + { + if (isset($parameters['platform'])) { + $platformName = $parameters['platform']; + } elseif ($this->driver instanceof Driver\DriverInterface) { + $platformName = $this->driver->getDatabasePlatformName(Driver\DriverInterface::NAME_FORMAT_CAMELCASE); + } else { + throw new Exception\InvalidArgumentException( + 'A platform could not be determined from the provided configuration' + ); + } + + // currently only supported by the IbmDb2 & Oracle concrete implementations + $options = (isset($parameters['platform_options'])) ? $parameters['platform_options'] : []; + + switch ($platformName) { + case 'Mysql': + // mysqli or pdo_mysql driver + if ($this->driver instanceof Driver\Mysqli\Mysqli || $this->driver instanceof Driver\Pdo\Pdo) { + $driver = $this->driver; + } else { + $driver = null; + } + return new Platform\Mysql($driver); + case 'SqlServer': + // PDO is only supported driver for quoting values in this platform + return new Platform\SqlServer(($this->driver instanceof Driver\Pdo\Pdo) ? $this->driver : null); + case 'Oracle': + if ($this->driver instanceof Driver\Oci8\Oci8 || $this->driver instanceof Driver\Pdo\Pdo) { + $driver = $this->driver; + } else { + $driver = null; + } + return new Platform\Oracle($options, $driver); + case 'Sqlite': + // PDO is only supported driver for quoting values in this platform + if ($this->driver instanceof Driver\Pdo\Pdo) { + return new Platform\Sqlite($this->driver); + } + return new Platform\Sqlite(null); + case 'Postgresql': + // pgsql or pdo postgres driver + if ($this->driver instanceof Driver\Pgsql\Pgsql || $this->driver instanceof Driver\Pdo\Pdo) { + $driver = $this->driver; + } else { + $driver = null; + } + return new Platform\Postgresql($driver); + case 'IbmDb2': + // ibm_db2 driver escaping does not need an action connection + return new Platform\IbmDb2($options); + default: + return new Platform\Sql92(); + } + } + + /** + * + * @param array $parameters + * @return Profiler\ProfilerInterface + * @throws Exception\InvalidArgumentException + */ + protected function createProfiler($parameters) + { + if ($parameters['profiler'] instanceof Profiler\ProfilerInterface) { + $profiler = $parameters['profiler']; + } elseif (is_bool($parameters['profiler'])) { + $profiler = ($parameters['profiler'] == true) ? new Profiler\Profiler : null; + } else { + throw new Exception\InvalidArgumentException( + '"profiler" parameter must be an instance of ProfilerInterface or a boolean' + ); + } + return $profiler; + } + + /** + * @param array $parameters + * @return Driver\DriverInterface + * @throws \InvalidArgumentException + * @throws Exception\InvalidArgumentException + * @deprecated + */ + protected function createDriverFromParameters(array $parameters) + { + return $this->createDriver($parameters); + } + + /** + * @param Driver\DriverInterface $driver + * @return Platform\PlatformInterface + * @deprecated + */ + protected function createPlatformFromDriver(Driver\DriverInterface $driver) + { + return $this->createPlatform($driver); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/AdapterAbstractServiceFactory.php b/bundled-libs/laminas/laminas-db/src/Adapter/AdapterAbstractServiceFactory.php new file mode 100644 index 00000000..669c138d --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/AdapterAbstractServiceFactory.php @@ -0,0 +1,124 @@ +getConfig($container); + if (empty($config)) { + return false; + } + + return ( + isset($config[$requestedName]) + && is_array($config[$requestedName]) + && ! empty($config[$requestedName]) + ); + } + + /** + * Determine if we can create a service with name (SM v2 compatibility) + * + * @param ServiceLocatorInterface $serviceLocator + * @param string $name + * @param string $requestedName + * @return bool + */ + public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) + { + return $this->canCreate($serviceLocator, $requestedName); + } + + /** + * Create a DB adapter + * + * @param ContainerInterface $container + * @param string $requestedName + * @param array $options + * @return Adapter + */ + public function __invoke(ContainerInterface $container, $requestedName, array $options = null) + { + $config = $this->getConfig($container); + return new Adapter($config[$requestedName]); + } + + /** + * Create service with name + * + * @param ServiceLocatorInterface $serviceLocator + * @param string $name + * @param string $requestedName + * @return Adapter + */ + public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) + { + return $this($serviceLocator, $requestedName); + } + + /** + * Get db configuration, if any + * + * @param ContainerInterface $container + * @return array + */ + protected function getConfig(ContainerInterface $container) + { + if ($this->config !== null) { + return $this->config; + } + + if (! $container->has('config')) { + $this->config = []; + return $this->config; + } + + $config = $container->get('config'); + if (! isset($config['db']) + || ! is_array($config['db']) + ) { + $this->config = []; + return $this->config; + } + + $config = $config['db']; + if (! isset($config['adapters']) + || ! is_array($config['adapters']) + ) { + $this->config = []; + return $this->config; + } + + $this->config = $config['adapters']; + return $this->config; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/AdapterAwareInterface.php b/bundled-libs/laminas/laminas-db/src/Adapter/AdapterAwareInterface.php new file mode 100644 index 00000000..1678a601 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/AdapterAwareInterface.php @@ -0,0 +1,20 @@ +adapter = $adapter; + + return $this; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/AdapterInterface.php b/bundled-libs/laminas/laminas-db/src/Adapter/AdapterInterface.php new file mode 100644 index 00000000..389eb2a4 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/AdapterInterface.php @@ -0,0 +1,27 @@ +get('config'); + return new Adapter($config['db']); + } + + /** + * Create db adapter service (v2) + * + * @param ServiceLocatorInterface $container + * @return Adapter + */ + public function createService(ServiceLocatorInterface $container) + { + return $this($container, Adapter::class); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/AbstractConnection.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/AbstractConnection.php new file mode 100644 index 00000000..9e3eee0b --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/AbstractConnection.php @@ -0,0 +1,134 @@ +isConnected()) { + $this->resource = null; + } + + return $this; + } + + /** + * Get connection parameters + * + * @return array + */ + public function getConnectionParameters() + { + return $this->connectionParameters; + } + + /** + * Get driver name + * + * @return null|string + */ + public function getDriverName() + { + return $this->driverName; + } + + /** + * @return null|ProfilerInterface + */ + public function getProfiler() + { + return $this->profiler; + } + + /** + * {@inheritDoc} + * + * @return resource + */ + public function getResource() + { + if (! $this->isConnected()) { + $this->connect(); + } + + return $this->resource; + } + + /** + * Checks whether the connection is in transaction state. + * + * @return boolean + */ + public function inTransaction() + { + return $this->inTransaction; + } + + /** + * @param array $connectionParameters + * @return self Provides a fluent interface + */ + public function setConnectionParameters(array $connectionParameters) + { + $this->connectionParameters = $connectionParameters; + + return $this; + } + + /** + * {@inheritDoc} + * + * @return self Provides a fluent interface + */ + public function setProfiler(ProfilerInterface $profiler) + { + $this->profiler = $profiler; + + return $this; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/ConnectionInterface.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/ConnectionInterface.php new file mode 100644 index 00000000..6133486a --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/ConnectionInterface.php @@ -0,0 +1,84 @@ +driver = $driver; + } + + /** + * Get name + * + * @return string + */ + abstract public function getName(); +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Feature/DriverFeatureInterface.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Feature/DriverFeatureInterface.php new file mode 100644 index 00000000..e516771f --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Feature/DriverFeatureInterface.php @@ -0,0 +1,36 @@ +setConnectionParameters($connectionParameters); + } elseif (is_resource($connectionParameters)) { + $this->setResource($connectionParameters); + } elseif (null !== $connectionParameters) { + throw new Exception\InvalidArgumentException( + '$connection must be an array of parameters, a db2 connection resource or null' + ); + } + } + + /** + * Set driver + * + * @param IbmDb2 $driver + * @return self Provides a fluent interface + */ + public function setDriver(IbmDb2 $driver) + { + $this->driver = $driver; + + return $this; + } + + /** + * @param resource $resource DB2 resource + * @return self Provides a fluent interface + */ + public function setResource($resource) + { + if (! is_resource($resource) || get_resource_type($resource) !== 'DB2 Connection') { + throw new Exception\InvalidArgumentException('The resource provided must be of type "DB2 Connection"'); + } + $this->resource = $resource; + + return $this; + } + + /** + * {@inheritDoc} + */ + public function getCurrentSchema() + { + if (! $this->isConnected()) { + $this->connect(); + } + + $info = db2_server_info($this->resource); + + return (isset($info->DB_NAME) ? $info->DB_NAME : ''); + } + + /** + * {@inheritDoc} + */ + public function connect() + { + if (is_resource($this->resource)) { + return $this; + } + + // localize + $p = $this->connectionParameters; + + // given a list of key names, test for existence in $p + $findParameterValue = function (array $names) use ($p) { + foreach ($names as $name) { + if (isset($p[$name])) { + return $p[$name]; + } + } + + return; + }; + + $database = $findParameterValue(['database', 'db']); + $username = $findParameterValue(['username', 'uid', 'UID']); + $password = $findParameterValue(['password', 'pwd', 'PWD']); + $isPersistent = $findParameterValue(['persistent', 'PERSISTENT', 'Persistent']); + $options = (isset($p['driver_options']) ? $p['driver_options'] : []); + $connect = ((bool) $isPersistent) ? 'db2_pconnect' : 'db2_connect'; + + $this->resource = $connect($database, $username, $password, $options); + + if ($this->resource === false) { + throw new Exception\RuntimeException(sprintf( + '%s: Unable to connect to database', + __METHOD__ + )); + } + + return $this; + } + + /** + * {@inheritDoc} + */ + public function isConnected() + { + return ($this->resource !== null); + } + + /** + * {@inheritDoc} + */ + public function disconnect() + { + if ($this->resource) { + db2_close($this->resource); + $this->resource = null; + } + + return $this; + } + + /** + * {@inheritDoc} + */ + public function beginTransaction() + { + if ($this->isI5() && ! ini_get('ibm_db2.i5_allow_commit')) { + throw new Exception\RuntimeException( + 'DB2 transactions are not enabled, you need to set the ibm_db2.i5_allow_commit=1 in your php.ini' + ); + } + + if (! $this->isConnected()) { + $this->connect(); + } + + $this->prevAutocommit = db2_autocommit($this->resource); + db2_autocommit($this->resource, DB2_AUTOCOMMIT_OFF); + $this->inTransaction = true; + + return $this; + } + + /** + * {@inheritDoc} + */ + public function commit() + { + if (! $this->isConnected()) { + $this->connect(); + } + + if (! db2_commit($this->resource)) { + throw new Exception\RuntimeException("The commit has not been successful"); + } + + if ($this->prevAutocommit) { + db2_autocommit($this->resource, $this->prevAutocommit); + } + + $this->inTransaction = false; + + return $this; + } + + /** + * Rollback + * + * @return self Provides a fluent interface + * @throws Exception\RuntimeException + */ + public function rollback() + { + if (! $this->isConnected()) { + throw new Exception\RuntimeException('Must be connected before you can rollback.'); + } + + if (! $this->inTransaction()) { + throw new Exception\RuntimeException('Must call beginTransaction() before you can rollback.'); + } + + if (! db2_rollback($this->resource)) { + throw new Exception\RuntimeException('The rollback has not been successful'); + } + + if ($this->prevAutocommit) { + db2_autocommit($this->resource, $this->prevAutocommit); + } + + $this->inTransaction = false; + + return $this; + } + + /** + * {@inheritDoc} + */ + public function execute($sql) + { + if (! $this->isConnected()) { + $this->connect(); + } + + if ($this->profiler) { + $this->profiler->profilerStart($sql); + } + + set_error_handler(function () { + }, E_WARNING); // suppress warnings + $resultResource = db2_exec($this->resource, $sql); + restore_error_handler(); + + if ($this->profiler) { + $this->profiler->profilerFinish($sql); + } + + // if the returnValue is something other than a pg result resource, bypass wrapping it + if ($resultResource === false) { + throw new Exception\InvalidQueryException(db2_stmt_errormsg()); + } + + return $this->driver->createResult(($resultResource === true) ? $this->resource : $resultResource); + } + + /** + * {@inheritDoc} + */ + public function getLastGeneratedValue($name = null) + { + return db2_last_insert_id($this->resource); + } + + /** + * Determine if the OS is OS400 (AS400, IBM i) + * + * @return bool + */ + protected function isI5() + { + if (isset($this->i5)) { + return $this->i5; + } + + $this->i5 = (php_uname('s') == 'OS400'); + + return $this->i5; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/IbmDb2/IbmDb2.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/IbmDb2/IbmDb2.php new file mode 100644 index 00000000..873dfa30 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/IbmDb2/IbmDb2.php @@ -0,0 +1,213 @@ +registerConnection($connection); + $this->registerStatementPrototype(($statementPrototype) ?: new Statement()); + $this->registerResultPrototype(($resultPrototype) ?: new Result()); + } + + /** + * @param Profiler\ProfilerInterface $profiler + * @return self Provides a fluent interface + */ + public function setProfiler(Profiler\ProfilerInterface $profiler) + { + $this->profiler = $profiler; + if ($this->connection instanceof Profiler\ProfilerAwareInterface) { + $this->connection->setProfiler($profiler); + } + if ($this->statementPrototype instanceof Profiler\ProfilerAwareInterface) { + $this->statementPrototype->setProfiler($profiler); + } + return $this; + } + + /** + * @return null|Profiler\ProfilerInterface + */ + public function getProfiler() + { + return $this->profiler; + } + + /** + * @param Connection $connection + * @return self Provides a fluent interface + */ + public function registerConnection(Connection $connection) + { + $this->connection = $connection; + $this->connection->setDriver($this); + return $this; + } + + /** + * @param Statement $statementPrototype + * @return self Provides a fluent interface + */ + public function registerStatementPrototype(Statement $statementPrototype) + { + $this->statementPrototype = $statementPrototype; + $this->statementPrototype->setDriver($this); + return $this; + } + + /** + * @param Result $resultPrototype + * @return self Provides a fluent interface + */ + public function registerResultPrototype(Result $resultPrototype) + { + $this->resultPrototype = $resultPrototype; + return $this; + } + + /** + * Get database platform name + * + * @param string $nameFormat + * @return string + */ + public function getDatabasePlatformName($nameFormat = self::NAME_FORMAT_CAMELCASE) + { + if ($nameFormat == self::NAME_FORMAT_CAMELCASE) { + return 'IbmDb2'; + } else { + return 'IBM DB2'; + } + } + + /** + * Check environment + * + * @return bool + */ + public function checkEnvironment() + { + if (! extension_loaded('ibm_db2')) { + throw new Exception\RuntimeException('The ibm_db2 extension is required by this driver.'); + } + } + + /** + * Get connection + * + * @return Connection + */ + public function getConnection() + { + return $this->connection; + } + + /** + * Create statement + * + * @param string|resource $sqlOrResource + * @return Statement + */ + public function createStatement($sqlOrResource = null) + { + $statement = clone $this->statementPrototype; + if (is_resource($sqlOrResource) && get_resource_type($sqlOrResource) == 'DB2 Statement') { + $statement->setResource($sqlOrResource); + } else { + if (is_string($sqlOrResource)) { + $statement->setSql($sqlOrResource); + } elseif ($sqlOrResource !== null) { + throw new Exception\InvalidArgumentException( + __FUNCTION__ . ' only accepts an SQL string or an ibm_db2 resource' + ); + } + if (! $this->connection->isConnected()) { + $this->connection->connect(); + } + $statement->initialize($this->connection->getResource()); + } + return $statement; + } + + /** + * Create result + * + * @param resource $resource + * @return Result + */ + public function createResult($resource) + { + $result = clone $this->resultPrototype; + $result->initialize($resource, $this->connection->getLastGeneratedValue()); + return $result; + } + + /** + * Get prepare type + * + * @return string + */ + public function getPrepareType() + { + return self::PARAMETERIZATION_POSITIONAL; + } + + /** + * Format parameter name + * + * @param string $name + * @param mixed $type + * @return string + */ + public function formatParameterName($name, $type = null) + { + return '?'; + } + + /** + * Get last generated value + * + * @return mixed + */ + public function getLastGeneratedValue() + { + return $this->connection->getLastGeneratedValue(); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/IbmDb2/Result.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/IbmDb2/Result.php new file mode 100644 index 00000000..08a06ae4 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/IbmDb2/Result.php @@ -0,0 +1,191 @@ +resource = $resource; + $this->generatedValue = $generatedValue; + return $this; + } + + /** + * (PHP 5 >= 5.0.0)
+ * Return the current element + * @link http://php.net/manual/en/iterator.current.php + * @return mixed Can return any type. + */ + public function current() + { + if ($this->currentComplete) { + return $this->currentData; + } + + $this->currentData = db2_fetch_assoc($this->resource); + return $this->currentData; + } + + /** + * @return mixed + */ + public function next() + { + $this->currentData = db2_fetch_assoc($this->resource); + $this->currentComplete = true; + $this->position++; + return $this->currentData; + } + + /** + * @return int|string + */ + public function key() + { + return $this->position; + } + + /** + * @return bool + */ + public function valid() + { + return ($this->currentData !== false); + } + + /** + * (PHP 5 >= 5.0.0)
+ * Rewind the Iterator to the first element + * @link http://php.net/manual/en/iterator.rewind.php + * @return void Any returned value is ignored. + */ + public function rewind() + { + if ($this->position > 0) { + throw new Exception\RuntimeException( + 'This result is a forward only result set, calling rewind() after moving forward is not supported' + ); + } + $this->currentData = db2_fetch_assoc($this->resource); + $this->currentComplete = true; + $this->position = 1; + } + + /** + * Force buffering + * + * @return void + */ + public function buffer() + { + return; + } + + /** + * Check if is buffered + * + * @return bool|null + */ + public function isBuffered() + { + return false; + } + + /** + * Is query result? + * + * @return bool + */ + public function isQueryResult() + { + return (db2_num_fields($this->resource) > 0); + } + + /** + * Get affected rows + * + * @return int + */ + public function getAffectedRows() + { + return db2_num_rows($this->resource); + } + + /** + * Get generated value + * + * @return mixed|null + */ + public function getGeneratedValue() + { + return $this->generatedValue; + } + + /** + * Get the resource + * + * @return mixed + */ + public function getResource() + { + return $this->resource; + } + + /** + * Get field count + * + * @return int + */ + public function getFieldCount() + { + return db2_num_fields($this->resource); + } + + /** + * @return null|int + */ + public function count() + { + return; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/IbmDb2/Statement.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/IbmDb2/Statement.php new file mode 100644 index 00000000..ee2ece16 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/IbmDb2/Statement.php @@ -0,0 +1,276 @@ +db2 = $resource; + return $this; + } + + /** + * @param IbmDb2 $driver + * @return self Provides a fluent interface + */ + public function setDriver(IbmDb2 $driver) + { + $this->driver = $driver; + return $this; + } + + /** + * @param Profiler\ProfilerInterface $profiler + * @return self Provides a fluent interface + */ + public function setProfiler(Profiler\ProfilerInterface $profiler) + { + $this->profiler = $profiler; + return $this; + } + + /** + * @return null|Profiler\ProfilerInterface + */ + public function getProfiler() + { + return $this->profiler; + } + + /** + * Set sql + * + * @param $sql + * @return self Provides a fluent interface + */ + public function setSql($sql) + { + $this->sql = $sql; + return $this; + } + + /** + * Get sql + * + * @return mixed + */ + public function getSql() + { + return $this->sql; + } + + /** + * Set parameter container + * + * @param ParameterContainer $parameterContainer + * @return self Provides a fluent interface + */ + public function setParameterContainer(ParameterContainer $parameterContainer) + { + $this->parameterContainer = $parameterContainer; + return $this; + } + + /** + * Get parameter container + * + * @return mixed + */ + public function getParameterContainer() + { + return $this->parameterContainer; + } + + /** + * @param $resource + * @throws \Laminas\Db\Adapter\Exception\InvalidArgumentException + */ + public function setResource($resource) + { + if (get_resource_type($resource) !== 'DB2 Statement') { + throw new Exception\InvalidArgumentException('Resource must be of type DB2 Statement'); + } + $this->resource = $resource; + } + + /** + * Get resource + * + * @return resource + */ + public function getResource() + { + return $this->resource; + } + + /** + * Prepare sql + * + * @param string|null $sql + * @return self Provides a fluent interface + * @throws Exception\RuntimeException + */ + public function prepare($sql = null) + { + if ($this->isPrepared) { + throw new Exception\RuntimeException('This statement has been prepared already'); + } + + if ($sql === null) { + $sql = $this->sql; + } + + try { + set_error_handler($this->createErrorHandler()); + $this->resource = db2_prepare($this->db2, $sql); + } catch (ErrorException $e) { + throw new Exception\RuntimeException($e->getMessage() . '. ' . db2_stmt_errormsg(), db2_stmt_error(), $e); + } finally { + restore_error_handler(); + } + + if ($this->resource === false) { + throw new Exception\RuntimeException(db2_stmt_errormsg(), db2_stmt_error()); + } + + $this->isPrepared = true; + return $this; + } + + /** + * Check if is prepared + * + * @return bool + */ + public function isPrepared() + { + return $this->isPrepared; + } + + /** + * Execute + * + * @param null|array|ParameterContainer $parameters + * @return Result + */ + public function execute($parameters = null) + { + if (! $this->isPrepared) { + $this->prepare(); + } + + /** START Standard ParameterContainer Merging Block */ + if (! $this->parameterContainer instanceof ParameterContainer) { + if ($parameters instanceof ParameterContainer) { + $this->parameterContainer = $parameters; + $parameters = null; + } else { + $this->parameterContainer = new ParameterContainer(); + } + } + + if (is_array($parameters)) { + $this->parameterContainer->setFromArray($parameters); + } + /** END Standard ParameterContainer Merging Block */ + + if ($this->profiler) { + $this->profiler->profilerStart($this); + } + + set_error_handler(function () { + }, E_WARNING); // suppress warnings + $response = db2_execute($this->resource, $this->parameterContainer->getPositionalArray()); + restore_error_handler(); + + if ($this->profiler) { + $this->profiler->profilerFinish(); + } + + if ($response === false) { + throw new Exception\RuntimeException(db2_stmt_errormsg($this->resource)); + } + + $result = $this->driver->createResult($this->resource); + return $result; + } + + /** + * Creates and returns a callable error handler that raises exceptions. + * + * Only raises exceptions for errors that are within the error_reporting mask. + * + * @return callable + */ + private function createErrorHandler() + { + /** + * @param int $errno + * @param string $errstr + * @param string $errfile + * @param int $errline + * @return void + * @throws ErrorException if error is not within the error_reporting mask. + */ + return function ($errno, $errstr, $errfile, $errline) { + if (! (error_reporting() & $errno)) { + // error_reporting does not include this error + return; + } + + throw new ErrorException($errstr, 0, $errno, $errfile, $errline); + }; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Mysqli/Connection.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Mysqli/Connection.php new file mode 100644 index 00000000..abf4d09c --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Mysqli/Connection.php @@ -0,0 +1,297 @@ +setConnectionParameters($connectionInfo); + } elseif ($connectionInfo instanceof \mysqli) { + $this->setResource($connectionInfo); + } elseif (null !== $connectionInfo) { + throw new Exception\InvalidArgumentException( + '$connection must be an array of parameters, a mysqli object or null' + ); + } + } + + /** + * @param Mysqli $driver + * @return self Provides a fluent interface + */ + public function setDriver(Mysqli $driver) + { + $this->driver = $driver; + + return $this; + } + + /** + * {@inheritDoc} + */ + public function getCurrentSchema() + { + if (! $this->isConnected()) { + $this->connect(); + } + + $result = $this->resource->query('SELECT DATABASE()'); + $r = $result->fetch_row(); + + return $r[0]; + } + + /** + * Set resource + * + * @param \mysqli $resource + * @return self Provides a fluent interface + */ + public function setResource(\mysqli $resource) + { + $this->resource = $resource; + + return $this; + } + + /** + * {@inheritDoc} + */ + public function connect() + { + if ($this->resource instanceof \mysqli) { + return $this; + } + + // localize + $p = $this->connectionParameters; + + // given a list of key names, test for existence in $p + $findParameterValue = function (array $names) use ($p) { + foreach ($names as $name) { + if (isset($p[$name])) { + return $p[$name]; + } + } + + return; + }; + + $hostname = $findParameterValue(['hostname', 'host']); + $username = $findParameterValue(['username', 'user']); + $password = $findParameterValue(['password', 'passwd', 'pw']); + $database = $findParameterValue(['database', 'dbname', 'db', 'schema']); + $port = (isset($p['port'])) ? (int) $p['port'] : null; + $socket = (isset($p['socket'])) ? $p['socket'] : null; + + $useSSL = (isset($p['use_ssl'])) ? $p['use_ssl'] : 0; + $clientKey = (isset($p['client_key'])) ? $p['client_key'] : null; + $clientCert = (isset($p['client_cert'])) ? $p['client_cert'] : null; + $caCert = (isset($p['ca_cert'])) ? $p['ca_cert'] : null; + $caPath = (isset($p['ca_path'])) ? $p['ca_path'] : null; + $cipher = (isset($p['cipher'])) ? $p['cipher'] : null; + + $this->resource = $this->createResource(); + $this->resource->init(); + + if (! empty($p['driver_options'])) { + foreach ($p['driver_options'] as $option => $value) { + if (is_string($option)) { + $option = strtoupper($option); + if (! defined($option)) { + continue; + } + $option = constant($option); + } + $this->resource->options($option, $value); + } + } + + $flags = null; + + if ($useSSL && ! $socket) { + // Even though mysqli docs are not quite clear on this, MYSQLI_CLIENT_SSL + // needs to be set to make sure SSL is used. ssl_set can also cause it to + // be implicitly set, but only when any of the parameters is non-empty. + $flags = MYSQLI_CLIENT_SSL; + $this->resource->ssl_set($clientKey, $clientCert, $caCert, $caPath, $cipher); + //MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT is not valid option, needs to be set as flag + if (isset($p['driver_options']) + && isset($p['driver_options'][MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT]) + ) { + $flags |= MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT; + } + } + + try { + $this->resource->real_connect($hostname, $username, $password, $database, $port, $socket, $flags); + } catch (GenericException $e) { + throw new Exception\RuntimeException( + 'Connection error', + null, + new Exception\ErrorException($this->resource->connect_error, $this->resource->connect_errno) + ); + } + + if ($this->resource->connect_error) { + throw new Exception\RuntimeException( + 'Connection error', + null, + new Exception\ErrorException($this->resource->connect_error, $this->resource->connect_errno) + ); + } + + if (! empty($p['charset'])) { + $this->resource->set_charset($p['charset']); + } + + return $this; + } + + /** + * {@inheritDoc} + */ + public function isConnected() + { + return ($this->resource instanceof \mysqli); + } + + /** + * {@inheritDoc} + */ + public function disconnect() + { + if ($this->resource instanceof \mysqli) { + $this->resource->close(); + } + $this->resource = null; + } + + /** + * {@inheritDoc} + */ + public function beginTransaction() + { + if (! $this->isConnected()) { + $this->connect(); + } + + $this->resource->autocommit(false); + $this->inTransaction = true; + + return $this; + } + + /** + * {@inheritDoc} + */ + public function commit() + { + if (! $this->isConnected()) { + $this->connect(); + } + + $this->resource->commit(); + $this->inTransaction = false; + $this->resource->autocommit(true); + + return $this; + } + + /** + * {@inheritDoc} + */ + public function rollback() + { + if (! $this->isConnected()) { + throw new Exception\RuntimeException('Must be connected before you can rollback.'); + } + + if (! $this->inTransaction) { + throw new Exception\RuntimeException('Must call beginTransaction() before you can rollback.'); + } + + $this->resource->rollback(); + $this->resource->autocommit(true); + $this->inTransaction = false; + + return $this; + } + + /** + * {@inheritDoc} + * + * @throws Exception\InvalidQueryException + */ + public function execute($sql) + { + if (! $this->isConnected()) { + $this->connect(); + } + + if ($this->profiler) { + $this->profiler->profilerStart($sql); + } + + $resultResource = $this->resource->query($sql); + + if ($this->profiler) { + $this->profiler->profilerFinish($sql); + } + + // if the returnValue is something other than a mysqli_result, bypass wrapping it + if ($resultResource === false) { + throw new Exception\InvalidQueryException($this->resource->error); + } + + $resultPrototype = $this->driver->createResult(($resultResource === true) ? $this->resource : $resultResource); + + return $resultPrototype; + } + + /** + * {@inheritDoc} + */ + public function getLastGeneratedValue($name = null) + { + return $this->resource->insert_id; + } + + /** + * Create a new mysqli resource + * + * @return \mysqli + */ + protected function createResource() + { + return new \mysqli(); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Mysqli/Mysqli.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Mysqli/Mysqli.php new file mode 100644 index 00000000..513cf454 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Mysqli/Mysqli.php @@ -0,0 +1,261 @@ + false + ]; + + /** + * Constructor + * + * @param array|Connection|\mysqli $connection + * @param null|Statement $statementPrototype + * @param null|Result $resultPrototype + * @param array $options + */ + public function __construct( + $connection, + Statement $statementPrototype = null, + Result $resultPrototype = null, + array $options = [] + ) { + if (! $connection instanceof Connection) { + $connection = new Connection($connection); + } + + $options = array_intersect_key(array_merge($this->options, $options), $this->options); + + $this->registerConnection($connection); + $this->registerStatementPrototype(($statementPrototype) ?: new Statement($options['buffer_results'])); + $this->registerResultPrototype(($resultPrototype) ?: new Result()); + } + + /** + * @param Profiler\ProfilerInterface $profiler + * @return self Provides a fluent interface + */ + public function setProfiler(Profiler\ProfilerInterface $profiler) + { + $this->profiler = $profiler; + if ($this->connection instanceof Profiler\ProfilerAwareInterface) { + $this->connection->setProfiler($profiler); + } + if ($this->statementPrototype instanceof Profiler\ProfilerAwareInterface) { + $this->statementPrototype->setProfiler($profiler); + } + return $this; + } + + /** + * @return null|Profiler\ProfilerInterface + */ + public function getProfiler() + { + return $this->profiler; + } + + /** + * Register connection + * + * @param Connection $connection + * @return self Provides a fluent interface + */ + public function registerConnection(Connection $connection) + { + $this->connection = $connection; + $this->connection->setDriver($this); // needs access to driver to createStatement() + return $this; + } + + /** + * Register statement prototype + * + * @param Statement $statementPrototype + */ + public function registerStatementPrototype(Statement $statementPrototype) + { + $this->statementPrototype = $statementPrototype; + $this->statementPrototype->setDriver($this); // needs access to driver to createResult() + } + + /** + * Get statement prototype + * + * @return null|Statement + */ + public function getStatementPrototype() + { + return $this->statementPrototype; + } + + /** + * Register result prototype + * + * @param Result $resultPrototype + */ + public function registerResultPrototype(Result $resultPrototype) + { + $this->resultPrototype = $resultPrototype; + } + + /** + * @return null|Result + */ + public function getResultPrototype() + { + return $this->resultPrototype; + } + + /** + * Get database platform name + * + * @param string $nameFormat + * @return string + */ + public function getDatabasePlatformName($nameFormat = self::NAME_FORMAT_CAMELCASE) + { + if ($nameFormat == self::NAME_FORMAT_CAMELCASE) { + return 'Mysql'; + } + + return 'MySQL'; + } + + /** + * Check environment + * + * @throws Exception\RuntimeException + * @return void + */ + public function checkEnvironment() + { + if (! extension_loaded('mysqli')) { + throw new Exception\RuntimeException( + 'The Mysqli extension is required for this adapter but the extension is not loaded' + ); + } + } + + /** + * Get connection + * + * @return Connection + */ + public function getConnection() + { + return $this->connection; + } + + /** + * Create statement + * + * @param string $sqlOrResource + * @return Statement + */ + public function createStatement($sqlOrResource = null) + { + /** + * @todo Resource tracking + if (is_resource($sqlOrResource) && !in_array($sqlOrResource, $this->resources, true)) { + $this->resources[] = $sqlOrResource; + } + */ + + $statement = clone $this->statementPrototype; + if ($sqlOrResource instanceof mysqli_stmt) { + $statement->setResource($sqlOrResource); + } else { + if (is_string($sqlOrResource)) { + $statement->setSql($sqlOrResource); + } + if (! $this->connection->isConnected()) { + $this->connection->connect(); + } + $statement->initialize($this->connection->getResource()); + } + return $statement; + } + + /** + * Create result + * + * @param resource $resource + * @param null|bool $isBuffered + * @return Result + */ + public function createResult($resource, $isBuffered = null) + { + $result = clone $this->resultPrototype; + $result->initialize($resource, $this->connection->getLastGeneratedValue(), $isBuffered); + return $result; + } + + /** + * Get prepare type + * + * @return string + */ + public function getPrepareType() + { + return self::PARAMETERIZATION_POSITIONAL; + } + + /** + * Format parameter name + * + * @param string $name + * @param mixed $type + * @return string + */ + public function formatParameterName($name, $type = null) + { + return '?'; + } + + /** + * Get last generated value + * + * @return mixed + */ + public function getLastGeneratedValue() + { + return $this->getConnection()->getLastGeneratedValue(); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Mysqli/Result.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Mysqli/Result.php new file mode 100644 index 00000000..0170b180 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Mysqli/Result.php @@ -0,0 +1,341 @@ + null, 'values' => []]; + + /** + * @var mixed + */ + protected $generatedValue = null; + + /** + * Initialize + * + * @param mixed $resource + * @param mixed $generatedValue + * @param bool|null $isBuffered + * @return self Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function initialize($resource, $generatedValue, $isBuffered = null) + { + if (! $resource instanceof \mysqli + && ! $resource instanceof \mysqli_result + && ! $resource instanceof \mysqli_stmt + ) { + throw new Exception\InvalidArgumentException('Invalid resource provided.'); + } + + if ($isBuffered !== null) { + $this->isBuffered = $isBuffered; + } else { + if ($resource instanceof \mysqli || $resource instanceof \mysqli_result + || $resource instanceof \mysqli_stmt && $resource->num_rows != 0) { + $this->isBuffered = true; + } + } + + $this->resource = $resource; + $this->generatedValue = $generatedValue; + return $this; + } + + /** + * Force buffering + * + * @throws Exception\RuntimeException + */ + public function buffer() + { + if ($this->resource instanceof \mysqli_stmt && $this->isBuffered !== true) { + if ($this->position > 0) { + throw new Exception\RuntimeException('Cannot buffer a result set that has started iteration.'); + } + $this->resource->store_result(); + $this->isBuffered = true; + } + } + + /** + * Check if is buffered + * + * @return bool|null + */ + public function isBuffered() + { + return $this->isBuffered; + } + + /** + * Return the resource + * + * @return mixed + */ + public function getResource() + { + return $this->resource; + } + + /** + * Is query result? + * + * @return bool + */ + public function isQueryResult() + { + return ($this->resource->field_count > 0); + } + + /** + * Get affected rows + * + * @return int + */ + public function getAffectedRows() + { + if ($this->resource instanceof \mysqli || $this->resource instanceof \mysqli_stmt) { + return $this->resource->affected_rows; + } + + return $this->resource->num_rows; + } + + /** + * Current + * + * @return mixed + */ + public function current() + { + if ($this->currentComplete) { + return $this->currentData; + } + + if ($this->resource instanceof \mysqli_stmt) { + $this->loadDataFromMysqliStatement(); + return $this->currentData; + } else { + $this->loadFromMysqliResult(); + return $this->currentData; + } + } + + /** + * Mysqli's binding and returning of statement values + * + * Mysqli requires you to bind variables to the extension in order to + * get data out. These values have to be references: + * @see http://php.net/manual/en/mysqli-stmt.bind-result.php + * + * @throws Exception\RuntimeException + * @return bool + */ + protected function loadDataFromMysqliStatement() + { + // build the default reference based bind structure, if it does not already exist + if ($this->statementBindValues['keys'] === null) { + $this->statementBindValues['keys'] = []; + $resultResource = $this->resource->result_metadata(); + foreach ($resultResource->fetch_fields() as $col) { + $this->statementBindValues['keys'][] = $col->name; + } + $this->statementBindValues['values'] = array_fill(0, count($this->statementBindValues['keys']), null); + $refs = []; + foreach ($this->statementBindValues['values'] as $i => &$f) { + $refs[$i] = &$f; + } + call_user_func_array([$this->resource, 'bind_result'], $this->statementBindValues['values']); + } + + if (($r = $this->resource->fetch()) === null) { + if (! $this->isBuffered) { + $this->resource->close(); + } + return false; + } elseif ($r === false) { + throw new Exception\RuntimeException($this->resource->error); + } + + // dereference + for ($i = 0, $count = count($this->statementBindValues['keys']); $i < $count; $i++) { + $this->currentData[$this->statementBindValues['keys'][$i]] = $this->statementBindValues['values'][$i]; + } + $this->currentComplete = true; + $this->nextComplete = true; + $this->position++; + return true; + } + + /** + * Load from mysqli result + * + * @return bool + */ + protected function loadFromMysqliResult() + { + $this->currentData = null; + + if (($data = $this->resource->fetch_assoc()) === null) { + return false; + } + + $this->position++; + $this->currentData = $data; + $this->currentComplete = true; + $this->nextComplete = true; + $this->position++; + return true; + } + + /** + * Next + * + * @return void + */ + public function next() + { + $this->currentComplete = false; + + if ($this->nextComplete == false) { + $this->position++; + } + + $this->nextComplete = false; + } + + /** + * Key + * + * @return mixed + */ + public function key() + { + return $this->position; + } + + /** + * Rewind + * + * @throws Exception\RuntimeException + * @return void + */ + public function rewind() + { + if (0 !== $this->position && false === $this->isBuffered) { + throw new Exception\RuntimeException('Unbuffered results cannot be rewound for multiple iterations'); + } + + $this->resource->data_seek(0); // works for both mysqli_result & mysqli_stmt + $this->currentComplete = false; + $this->position = 0; + } + + /** + * Valid + * + * @return bool + */ + public function valid() + { + if ($this->currentComplete) { + return true; + } + + if ($this->resource instanceof \mysqli_stmt) { + return $this->loadDataFromMysqliStatement(); + } + + return $this->loadFromMysqliResult(); + } + + /** + * Count + * + * @throws Exception\RuntimeException + * @return int + */ + public function count() + { + if ($this->isBuffered === false) { + throw new Exception\RuntimeException('Row count is not available in unbuffered result sets.'); + } + return $this->resource->num_rows; + } + + /** + * Get field count + * + * @return int + */ + public function getFieldCount() + { + return $this->resource->field_count; + } + + /** + * Get generated value + * + * @return mixed|null + */ + public function getGeneratedValue() + { + return $this->generatedValue; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Mysqli/Statement.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Mysqli/Statement.php new file mode 100644 index 00000000..e3004820 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Mysqli/Statement.php @@ -0,0 +1,314 @@ +bufferResults = (bool) $bufferResults; + } + + /** + * Set driver + * + * @param Mysqli $driver + * @return self Provides a fluent interface + */ + public function setDriver(Mysqli $driver) + { + $this->driver = $driver; + return $this; + } + + /** + * @param Profiler\ProfilerInterface $profiler + * @return self Provides a fluent interface + */ + public function setProfiler(Profiler\ProfilerInterface $profiler) + { + $this->profiler = $profiler; + return $this; + } + + /** + * @return null|Profiler\ProfilerInterface + */ + public function getProfiler() + { + return $this->profiler; + } + + /** + * Initialize + * + * @param \mysqli $mysqli + * @return self Provides a fluent interface + */ + public function initialize(\mysqli $mysqli) + { + $this->mysqli = $mysqli; + return $this; + } + + /** + * Set sql + * + * @param string $sql + * @return self Provides a fluent interface + */ + public function setSql($sql) + { + $this->sql = $sql; + return $this; + } + + /** + * Set Parameter container + * + * @param ParameterContainer $parameterContainer + * @return self Provides a fluent interface + */ + public function setParameterContainer(ParameterContainer $parameterContainer) + { + $this->parameterContainer = $parameterContainer; + return $this; + } + + /** + * Get resource + * + * @return mixed + */ + public function getResource() + { + return $this->resource; + } + + /** + * Set resource + * + * @param \mysqli_stmt $mysqliStatement + * @return self Provides a fluent interface + */ + public function setResource(\mysqli_stmt $mysqliStatement) + { + $this->resource = $mysqliStatement; + $this->isPrepared = true; + return $this; + } + + /** + * Get sql + * + * @return string + */ + public function getSql() + { + return $this->sql; + } + + /** + * Get parameter count + * + * @return ParameterContainer + */ + public function getParameterContainer() + { + return $this->parameterContainer; + } + + /** + * Is prepared + * + * @return bool + */ + public function isPrepared() + { + return $this->isPrepared; + } + + /** + * Prepare + * + * @param string $sql + * @return self Provides a fluent interface + * @throws Exception\InvalidQueryException + * @throws Exception\RuntimeException + */ + public function prepare($sql = null) + { + if ($this->isPrepared) { + throw new Exception\RuntimeException('This statement has already been prepared'); + } + + $sql = ($sql) ?: $this->sql; + + $this->resource = $this->mysqli->prepare($sql); + if (! $this->resource instanceof \mysqli_stmt) { + throw new Exception\InvalidQueryException( + 'Statement couldn\'t be produced with sql: ' . $sql, + null, + new Exception\ErrorException($this->mysqli->error, $this->mysqli->errno) + ); + } + + $this->isPrepared = true; + return $this; + } + + /** + * Execute + * + * @param null|array|ParameterContainer $parameters + * @throws Exception\RuntimeException + * @return mixed + */ + public function execute($parameters = null) + { + if (! $this->isPrepared) { + $this->prepare(); + } + + /** START Standard ParameterContainer Merging Block */ + if (! $this->parameterContainer instanceof ParameterContainer) { + if ($parameters instanceof ParameterContainer) { + $this->parameterContainer = $parameters; + $parameters = null; + } else { + $this->parameterContainer = new ParameterContainer(); + } + } + + if (is_array($parameters)) { + $this->parameterContainer->setFromArray($parameters); + } + + if ($this->parameterContainer->count() > 0) { + $this->bindParametersFromContainer(); + } + /** END Standard ParameterContainer Merging Block */ + + if ($this->profiler) { + $this->profiler->profilerStart($this); + } + + $return = $this->resource->execute(); + + if ($this->profiler) { + $this->profiler->profilerFinish(); + } + + if ($return === false) { + throw new Exception\RuntimeException($this->resource->error); + } + + if ($this->bufferResults === true) { + $this->resource->store_result(); + $this->isPrepared = false; + $buffered = true; + } else { + $buffered = false; + } + + $result = $this->driver->createResult($this->resource, $buffered); + return $result; + } + + /** + * Bind parameters from container + * + * @return void + */ + protected function bindParametersFromContainer() + { + $parameters = $this->parameterContainer->getNamedArray(); + $type = ''; + $args = []; + + foreach ($parameters as $name => &$value) { + if ($this->parameterContainer->offsetHasErrata($name)) { + switch ($this->parameterContainer->offsetGetErrata($name)) { + case ParameterContainer::TYPE_DOUBLE: + $type .= 'd'; + break; + case ParameterContainer::TYPE_NULL: + $value = null; // as per @see http://www.php.net/manual/en/mysqli-stmt.bind-param.php#96148 + case ParameterContainer::TYPE_INTEGER: + $type .= 'i'; + break; + case ParameterContainer::TYPE_STRING: + default: + $type .= 's'; + break; + } + } else { + $type .= 's'; + } + $args[] = &$value; + } + + if ($args) { + array_unshift($args, $type); + call_user_func_array([$this->resource, 'bind_param'], $args); + } + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Oci8/Connection.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Oci8/Connection.php new file mode 100644 index 00000000..f6a618dd --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Oci8/Connection.php @@ -0,0 +1,267 @@ +setConnectionParameters($connectionInfo); + } elseif ($connectionInfo instanceof \oci8) { + $this->setResource($connectionInfo); + } elseif (null !== $connectionInfo) { + throw new Exception\InvalidArgumentException( + '$connection must be an array of parameters, an oci8 resource or null' + ); + } + } + + /** + * @param Oci8 $driver + * @return self Provides a fluent interface + */ + public function setDriver(Oci8 $driver) + { + $this->driver = $driver; + + return $this; + } + + /** + * {@inheritDoc} + */ + public function getCurrentSchema() + { + if (! $this->isConnected()) { + $this->connect(); + } + + $query = "SELECT sys_context('USERENV', 'CURRENT_SCHEMA') as \"current_schema\" FROM DUAL"; + $stmt = oci_parse($this->resource, $query); + oci_execute($stmt); + $dbNameArray = oci_fetch_array($stmt, OCI_ASSOC); + + return $dbNameArray['current_schema']; + } + + /** + * Set resource + * + * @param resource $resource + * @return self Provides a fluent interface + */ + public function setResource($resource) + { + if (! is_resource($resource) || get_resource_type($resource) !== 'oci8 connection') { + throw new Exception\InvalidArgumentException('A resource of type "oci8 connection" was expected'); + } + $this->resource = $resource; + + return $this; + } + + /** + * {@inheritDoc} + */ + public function connect() + { + if (is_resource($this->resource)) { + return $this; + } + + // localize + $p = $this->connectionParameters; + + // given a list of key names, test for existence in $p + $findParameterValue = function (array $names) use ($p) { + foreach ($names as $name) { + if (isset($p[$name])) { + return $p[$name]; + } + } + + return; + }; + + // http://www.php.net/manual/en/function.oci-connect.php + $username = $findParameterValue(['username']); + $password = $findParameterValue(['password']); + $connectionString = $findParameterValue([ + 'connection_string', + 'connectionstring', + 'connection', + 'hostname', + 'instance' + ]); + $characterSet = $findParameterValue(['character_set', 'charset', 'encoding']); + $sessionMode = $findParameterValue(['session_mode']); + + // connection modifiers + $isUnique = $findParameterValue(['unique']); + $isPersistent = $findParameterValue(['persistent']); + + if ($isUnique == true) { + $this->resource = oci_new_connect($username, $password, $connectionString, $characterSet, $sessionMode); + } elseif ($isPersistent == true) { + $this->resource = oci_pconnect($username, $password, $connectionString, $characterSet, $sessionMode); + } else { + $this->resource = oci_connect($username, $password, $connectionString, $characterSet, $sessionMode); + } + + if (! $this->resource) { + $e = oci_error(); + throw new Exception\RuntimeException( + 'Connection error', + null, + new Exception\ErrorException($e['message'], $e['code']) + ); + } + + return $this; + } + + /** + * {@inheritDoc} + */ + public function isConnected() + { + return (is_resource($this->resource)); + } + + /** + * {@inheritDoc} + */ + public function disconnect() + { + if (is_resource($this->resource)) { + oci_close($this->resource); + } + } + + /** + * {@inheritDoc} + */ + public function beginTransaction() + { + if (! $this->isConnected()) { + $this->connect(); + } + + // A transaction begins when the first SQL statement that changes data is executed with oci_execute() using + // the OCI_NO_AUTO_COMMIT flag. + $this->inTransaction = true; + + return $this; + } + + /** + * {@inheritDoc} + */ + public function commit() + { + if (! $this->isConnected()) { + $this->connect(); + } + + if ($this->inTransaction()) { + $valid = oci_commit($this->resource); + if ($valid === false) { + $e = oci_error($this->resource); + throw new Exception\InvalidQueryException($e['message'], $e['code']); + } + + $this->inTransaction = false; + } + + return $this; + } + + /** + * {@inheritDoc} + */ + public function rollback() + { + if (! $this->isConnected()) { + throw new Exception\RuntimeException('Must be connected before you can rollback.'); + } + + if (! $this->inTransaction()) { + throw new Exception\RuntimeException('Must call commit() before you can rollback.'); + } + + $valid = oci_rollback($this->resource); + if ($valid === false) { + $e = oci_error($this->resource); + throw new Exception\InvalidQueryException($e['message'], $e['code']); + } + + $this->inTransaction = false; + + return $this; + } + + /** + * {@inheritDoc} + */ + public function execute($sql) + { + if (! $this->isConnected()) { + $this->connect(); + } + + if ($this->profiler) { + $this->profiler->profilerStart($sql); + } + + $ociStmt = oci_parse($this->resource, $sql); + + if ($this->inTransaction) { + $valid = @oci_execute($ociStmt, OCI_NO_AUTO_COMMIT); + } else { + $valid = @oci_execute($ociStmt, OCI_COMMIT_ON_SUCCESS); + } + + if ($this->profiler) { + $this->profiler->profilerFinish($sql); + } + + if ($valid === false) { + $e = oci_error($ociStmt); + throw new Exception\InvalidQueryException($e['message'], $e['code']); + } + + $resultPrototype = $this->driver->createResult($ociStmt); + + return $resultPrototype; + } + + /** + * {@inheritDoc} + */ + public function getLastGeneratedValue($name = null) + { + // @todo Get Last Generated Value in Connection (this might not apply) + return; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Oci8/Feature/RowCounter.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Oci8/Feature/RowCounter.php new file mode 100644 index 00000000..ae907056 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Oci8/Feature/RowCounter.php @@ -0,0 +1,74 @@ +getSql(); + if ($sql == '' || stripos(strtolower($sql), 'select') === false) { + return; + } + $countSql = 'SELECT COUNT(*) as "count" FROM (' . $sql . ')'; + $countStmt->prepare($countSql); + $result = $countStmt->execute(); + $countRow = $result->current(); + return $countRow['count']; + } + + /** + * @param string $sql + * @return null|int + */ + public function getCountForSql($sql) + { + if (stripos(strtolower($sql), 'select') === false) { + return; + } + $countSql = 'SELECT COUNT(*) as "count" FROM (' . $sql . ')'; + $result = $this->driver->getConnection()->execute($countSql); + $countRow = $result->current(); + return $countRow['count']; + } + + /** + * @param \Laminas\Db\Adapter\Driver\Oci8\Statement|string $context + * @return callable + */ + public function getRowCountClosure($context) + { + $rowCounter = $this; + return function () use ($rowCounter, $context) { + /** @var $rowCounter RowCounter */ + return ($context instanceof Statement) + ? $rowCounter->getCountForStatement($context) + : $rowCounter->getCountForSql($context); + }; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Oci8/Oci8.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Oci8/Oci8.php new file mode 100644 index 00000000..820de0e8 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Oci8/Oci8.php @@ -0,0 +1,301 @@ +options, $options), $this->options); + $this->registerConnection($connection); + $this->registerStatementPrototype(($statementPrototype) ?: new Statement()); + $this->registerResultPrototype(($resultPrototype) ?: new Result()); + if (is_array($features)) { + foreach ($features as $name => $feature) { + $this->addFeature($name, $feature); + } + } elseif ($features instanceof AbstractFeature) { + $this->addFeature($features->getName(), $features); + } elseif ($features === self::FEATURES_DEFAULT) { + $this->setupDefaultFeatures(); + } + } + + /** + * @param Profiler\ProfilerInterface $profiler + * @return self Provides a fluent interface + */ + public function setProfiler(Profiler\ProfilerInterface $profiler) + { + $this->profiler = $profiler; + if ($this->connection instanceof Profiler\ProfilerAwareInterface) { + $this->connection->setProfiler($profiler); + } + if ($this->statementPrototype instanceof Profiler\ProfilerAwareInterface) { + $this->statementPrototype->setProfiler($profiler); + } + return $this; + } + + /** + * @return null|Profiler\ProfilerInterface + */ + public function getProfiler() + { + return $this->profiler; + } + + /** + * Register connection + * + * @param Connection $connection + * @return self Provides a fluent interface + */ + public function registerConnection(Connection $connection) + { + $this->connection = $connection; + $this->connection->setDriver($this); // needs access to driver to createStatement() + return $this; + } + + /** + * Register statement prototype + * + * @param Statement $statementPrototype + * @return self Provides a fluent interface + */ + public function registerStatementPrototype(Statement $statementPrototype) + { + $this->statementPrototype = $statementPrototype; + $this->statementPrototype->setDriver($this); // needs access to driver to createResult() + return $this; + } + + /** + * @return null|Statement + */ + public function getStatementPrototype() + { + return $this->statementPrototype; + } + + /** + * Register result prototype + * + * @param Result $resultPrototype + * @return self Provides a fluent interface + */ + public function registerResultPrototype(Result $resultPrototype) + { + $this->resultPrototype = $resultPrototype; + return $this; + } + + /** + * @return null|Result + */ + public function getResultPrototype() + { + return $this->resultPrototype; + } + + /** + * Add feature + * + * @param string $name + * @param AbstractFeature $feature + * @return self Provides a fluent interface + */ + public function addFeature($name, $feature) + { + if ($feature instanceof AbstractFeature) { + $name = $feature->getName(); // overwrite the name, just in case + $feature->setDriver($this); + } + $this->features[$name] = $feature; + return $this; + } + + /** + * Setup the default features for Pdo + * + * @return self Provides a fluent interface + */ + public function setupDefaultFeatures() + { + $this->addFeature(null, new Feature\RowCounter()); + return $this; + } + + /** + * Get feature + * + * @param string $name + * @return AbstractFeature|false + */ + public function getFeature($name) + { + if (isset($this->features[$name])) { + return $this->features[$name]; + } + return false; + } + + /** + * Get database platform name + * + * @param string $nameFormat + * @return string + */ + public function getDatabasePlatformName($nameFormat = self::NAME_FORMAT_CAMELCASE) + { + return 'Oracle'; + } + + /** + * Check environment + */ + public function checkEnvironment() + { + if (! extension_loaded('oci8')) { + throw new Exception\RuntimeException( + 'The Oci8 extension is required for this adapter but the extension is not loaded' + ); + } + } + + /** + * @return Connection + */ + public function getConnection() + { + return $this->connection; + } + + /** + * @param string $sqlOrResource + * @return Statement + */ + public function createStatement($sqlOrResource = null) + { + $statement = clone $this->statementPrototype; + if (is_resource($sqlOrResource) && get_resource_type($sqlOrResource) == 'oci8 statement') { + $statement->setResource($sqlOrResource); + } else { + if (is_string($sqlOrResource)) { + $statement->setSql($sqlOrResource); + } elseif ($sqlOrResource !== null) { + throw new Exception\InvalidArgumentException( + 'Oci8 only accepts an SQL string or an oci8 resource in ' . __FUNCTION__ + ); + } + if (! $this->connection->isConnected()) { + $this->connection->connect(); + } + $statement->initialize($this->connection->getResource()); + } + return $statement; + } + + /** + * @param resource $resource + * @param null $context + * @return Result + */ + public function createResult($resource, $context = null) + { + $result = clone $this->resultPrototype; + $rowCount = null; + // special feature, oracle Oci counter + if ($context && ($rowCounter = $this->getFeature('RowCounter')) && oci_num_fields($resource) > 0) { + $rowCount = $rowCounter->getRowCountClosure($context); + } + $result->initialize($resource, null, $rowCount); + return $result; + } + + /** + * @return string + */ + public function getPrepareType() + { + return self::PARAMETERIZATION_NAMED; + } + + /** + * @param string $name + * @param mixed $type + * @return string + */ + public function formatParameterName($name, $type = null) + { + return ':' . $name; + } + + /** + * @return mixed + */ + public function getLastGeneratedValue() + { + return $this->getConnection()->getLastGeneratedValue(); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Oci8/Result.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Oci8/Result.php new file mode 100644 index 00000000..0b5df2d7 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Oci8/Result.php @@ -0,0 +1,230 @@ + null, 'values' => []]; + + /** + * @var mixed + */ + protected $generatedValue = null; + + /** + * Initialize + * @param resource $resource + * @param null|int $generatedValue + * @param null|int $rowCount + * @return self Provides a fluent interface + */ + public function initialize($resource, $generatedValue = null, $rowCount = null) + { + if (! is_resource($resource) && get_resource_type($resource) !== 'oci8 statement') { + throw new Exception\InvalidArgumentException('Invalid resource provided.'); + } + $this->resource = $resource; + $this->generatedValue = $generatedValue; + $this->rowCount = $rowCount; + return $this; + } + + /** + * Force buffering at driver level + * + * Oracle does not support this, to my knowledge (@ralphschindler) + * + * @throws Exception\RuntimeException + */ + public function buffer() + { + return; + } + + /** + * Is the result buffered? + * + * @return bool + */ + public function isBuffered() + { + return false; + } + + /** + * Return the resource + * @return mixed + */ + public function getResource() + { + return $this->resource; + } + + /** + * Is query result? + * + * @return bool + */ + public function isQueryResult() + { + return (oci_num_fields($this->resource) > 0); + } + + /** + * Get affected rows + * @return int + */ + public function getAffectedRows() + { + return oci_num_rows($this->resource); + } + + /** + * Current + * @return mixed + */ + public function current() + { + if ($this->currentComplete == false) { + if ($this->loadData() === false) { + return false; + } + } + return $this->currentData; + } + + /** + * Load from oci8 result + * + * @return bool + */ + protected function loadData() + { + $this->currentComplete = true; + $this->currentData = oci_fetch_assoc($this->resource); + if ($this->currentData !== false) { + $this->position++; + return true; + } + return false; + } + + /** + * Next + */ + public function next() + { + return $this->loadData(); + } + + /** + * Key + * @return mixed + */ + public function key() + { + return $this->position; + } + + /** + * Rewind + */ + public function rewind() + { + if ($this->position > 0) { + throw new Exception\RuntimeException('Oci8 results cannot be rewound for multiple iterations'); + } + } + + /** + * Valid + * @return bool + */ + public function valid() + { + if ($this->currentComplete) { + return ($this->currentData !== false); + } + return $this->loadData(); + } + + /** + * Count + * @return null|int + */ + public function count() + { + if (is_int($this->rowCount)) { + return $this->rowCount; + } + if (is_callable($this->rowCount)) { + $this->rowCount = (int) call_user_func($this->rowCount); + return $this->rowCount; + } + return; + } + + /** + * @return int + */ + public function getFieldCount() + { + return oci_num_fields($this->resource); + } + + /** + * @return null + */ + public function getGeneratedValue() + { + // @todo OCI8 generated value in Driver Result + return; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Oci8/Statement.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Oci8/Statement.php new file mode 100644 index 00000000..574e5146 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Oci8/Statement.php @@ -0,0 +1,326 @@ +driver = $driver; + return $this; + } + + /** + * @param Profiler\ProfilerInterface $profiler + * @return self Provides a fluent interface + */ + public function setProfiler(Profiler\ProfilerInterface $profiler) + { + $this->profiler = $profiler; + return $this; + } + + /** + * @return null|Profiler\ProfilerInterface + */ + public function getProfiler() + { + return $this->profiler; + } + + /** + * Initialize + * + * @param resource $oci8 + * @return self Provides a fluent interface + */ + public function initialize($oci8) + { + $this->oci8 = $oci8; + return $this; + } + + /** + * Set sql + * + * @param string $sql + * @return self Provides a fluent interface + */ + public function setSql($sql) + { + $this->sql = $sql; + return $this; + } + + /** + * Set Parameter container + * + * @param ParameterContainer $parameterContainer + * @return self Provides a fluent interface + */ + public function setParameterContainer(ParameterContainer $parameterContainer) + { + $this->parameterContainer = $parameterContainer; + return $this; + } + + /** + * Get resource + * + * @return mixed + */ + public function getResource() + { + return $this->resource; + } + + /** + * Set resource + * + * @param resource $oci8Statement + * @return self Provides a fluent interface + */ + public function setResource($oci8Statement) + { + $type = oci_statement_type($oci8Statement); + if (false === $type || 'UNKNOWN' == $type) { + throw new Exception\InvalidArgumentException(sprintf( + 'Invalid statement provided to %s', + __METHOD__ + )); + } + $this->resource = $oci8Statement; + $this->isPrepared = true; + return $this; + } + + /** + * Get sql + * + * @return string + */ + public function getSql() + { + return $this->sql; + } + + /** + * @return ParameterContainer + */ + public function getParameterContainer() + { + return $this->parameterContainer; + } + + /** + * @return bool + */ + public function isPrepared() + { + return $this->isPrepared; + } + + /** + * @param string $sql + * @return self Provides a fluent interface + */ + public function prepare($sql = null) + { + if ($this->isPrepared) { + throw new Exception\RuntimeException('This statement has already been prepared'); + } + + $sql = ($sql) ?: $this->sql; + + // get oci8 statement resource + $this->resource = oci_parse($this->oci8, $sql); + + if (! $this->resource) { + $e = oci_error($this->oci8); + throw new Exception\InvalidQueryException( + 'Statement couldn\'t be produced with sql: ' . $sql, + null, + new Exception\ErrorException($e['message'], $e['code']) + ); + } + + $this->isPrepared = true; + return $this; + } + + /** + * Execute + * + * @param null|array|ParameterContainer $parameters + * @return mixed + */ + public function execute($parameters = null) + { + if (! $this->isPrepared) { + $this->prepare(); + } + + /** START Standard ParameterContainer Merging Block */ + if (! $this->parameterContainer instanceof ParameterContainer) { + if ($parameters instanceof ParameterContainer) { + $this->parameterContainer = $parameters; + $parameters = null; + } else { + $this->parameterContainer = new ParameterContainer(); + } + } + + if (is_array($parameters)) { + $this->parameterContainer->setFromArray($parameters); + } + + if ($this->parameterContainer->count() > 0) { + $this->bindParametersFromContainer(); + } + /** END Standard ParameterContainer Merging Block */ + + if ($this->profiler) { + $this->profiler->profilerStart($this); + } + + if ($this->driver->getConnection()->inTransaction()) { + $ret = @oci_execute($this->resource, OCI_NO_AUTO_COMMIT); + } else { + $ret = @oci_execute($this->resource, OCI_COMMIT_ON_SUCCESS); + } + + if ($this->profiler) { + $this->profiler->profilerFinish(); + } + + if ($ret === false) { + $e = oci_error($this->resource); + throw new Exception\RuntimeException($e['message'], $e['code']); + } + + $result = $this->driver->createResult($this->resource, $this); + return $result; + } + + /** + * Bind parameters from container + */ + protected function bindParametersFromContainer() + { + $parameters = $this->parameterContainer->getNamedArray(); + + foreach ($parameters as $name => &$value) { + if ($this->parameterContainer->offsetHasErrata($name)) { + switch ($this->parameterContainer->offsetGetErrata($name)) { + case ParameterContainer::TYPE_NULL: + $type = null; + $value = null; + break; + case ParameterContainer::TYPE_DOUBLE: + case ParameterContainer::TYPE_INTEGER: + $type = SQLT_INT; + if (is_string($value)) { + $value = (int) $value; + } + break; + case ParameterContainer::TYPE_BINARY: + $type = SQLT_BIN; + break; + case ParameterContainer::TYPE_LOB: + $type = OCI_B_CLOB; + $clob = oci_new_descriptor($this->driver->getConnection()->getResource(), OCI_DTYPE_LOB); + $clob->writetemporary($value, OCI_TEMP_CLOB); + $value = $clob; + break; + case ParameterContainer::TYPE_STRING: + default: + $type = SQLT_CHR; + break; + } + } else { + $type = SQLT_CHR; + } + + $maxLength = -1; + if ($this->parameterContainer->offsetHasMaxLength($name)) { + $maxLength = $this->parameterContainer->offsetGetMaxLength($name); + } + + oci_bind_by_name($this->resource, $name, $value, $maxLength, $type); + } + } + + /** + * Perform a deep clone + */ + public function __clone() + { + $this->isPrepared = false; + $this->parametersBound = false; + $this->resource = null; + if ($this->parameterContainer) { + $this->parameterContainer = clone $this->parameterContainer; + } + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pdo/Connection.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pdo/Connection.php new file mode 100644 index 00000000..54165b80 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pdo/Connection.php @@ -0,0 +1,431 @@ +setConnectionParameters($connectionParameters); + } elseif ($connectionParameters instanceof \PDO) { + $this->setResource($connectionParameters); + } elseif (null !== $connectionParameters) { + throw new Exception\InvalidArgumentException( + '$connection must be an array of parameters, a PDO object or null' + ); + } + } + + /** + * Set driver + * + * @param Pdo $driver + * @return self Provides a fluent interface + */ + public function setDriver(Pdo $driver) + { + $this->driver = $driver; + + return $this; + } + + /** + * {@inheritDoc} + */ + public function setConnectionParameters(array $connectionParameters) + { + $this->connectionParameters = $connectionParameters; + if (isset($connectionParameters['dsn'])) { + $this->driverName = substr( + $connectionParameters['dsn'], + 0, + strpos($connectionParameters['dsn'], ':') + ); + } elseif (isset($connectionParameters['pdodriver'])) { + $this->driverName = strtolower($connectionParameters['pdodriver']); + } elseif (isset($connectionParameters['driver'])) { + $this->driverName = strtolower(substr( + str_replace(['-', '_', ' '], '', $connectionParameters['driver']), + 3 + )); + } + } + + /** + * Get the dsn string for this connection + * @throws \Laminas\Db\Adapter\Exception\RunTimeException + * @return string + */ + public function getDsn() + { + if (! $this->dsn) { + throw new Exception\RuntimeException( + 'The DSN has not been set or constructed from parameters in connect() for this Connection' + ); + } + + return $this->dsn; + } + + /** + * {@inheritDoc} + */ + public function getCurrentSchema() + { + if (! $this->isConnected()) { + $this->connect(); + } + + switch ($this->driverName) { + case 'mysql': + $sql = 'SELECT DATABASE()'; + break; + case 'sqlite': + return 'main'; + case 'sqlsrv': + case 'dblib': + $sql = 'SELECT SCHEMA_NAME()'; + break; + case 'pgsql': + default: + $sql = 'SELECT CURRENT_SCHEMA'; + break; + } + + /** @var $result \PDOStatement */ + $result = $this->resource->query($sql); + if ($result instanceof \PDOStatement) { + return $result->fetchColumn(); + } + + return false; + } + + /** + * Set resource + * + * @param \PDO $resource + * @return self Provides a fluent interface + */ + public function setResource(\PDO $resource) + { + $this->resource = $resource; + $this->driverName = strtolower($this->resource->getAttribute(\PDO::ATTR_DRIVER_NAME)); + + return $this; + } + + /** + * {@inheritDoc} + * + * @throws Exception\InvalidConnectionParametersException + * @throws Exception\RuntimeException + */ + public function connect() + { + if ($this->resource) { + return $this; + } + + $dsn = $username = $password = $hostname = $database = null; + $options = []; + foreach ($this->connectionParameters as $key => $value) { + switch (strtolower($key)) { + case 'dsn': + $dsn = $value; + break; + case 'driver': + $value = strtolower((string) $value); + if (strpos($value, 'pdo') === 0) { + $pdoDriver = str_replace(['-', '_', ' '], '', $value); + $pdoDriver = substr($pdoDriver, 3) ?: ''; + } + break; + case 'pdodriver': + $pdoDriver = (string) $value; + break; + case 'user': + case 'username': + $username = (string) $value; + break; + case 'pass': + case 'password': + $password = (string) $value; + break; + case 'host': + case 'hostname': + $hostname = (string) $value; + break; + case 'port': + $port = (int) $value; + break; + case 'database': + case 'dbname': + $database = (string) $value; + break; + case 'charset': + $charset = (string) $value; + break; + case 'unix_socket': + $unix_socket = (string) $value; + break; + case 'version': + $version = (string) $value; + break; + case 'driver_options': + case 'options': + $value = (array) $value; + $options = array_diff_key($options, $value) + $value; + break; + default: + $options[$key] = $value; + break; + } + } + + if (isset($hostname) && isset($unix_socket)) { + throw new Exception\InvalidConnectionParametersException( + 'Ambiguous connection parameters, both hostname and unix_socket parameters were set', + $this->connectionParameters + ); + } + + if (! isset($dsn) && isset($pdoDriver)) { + $dsn = []; + switch ($pdoDriver) { + case 'sqlite': + $dsn[] = $database; + break; + case 'sqlsrv': + if (isset($database)) { + $dsn[] = "database={$database}"; + } + if (isset($hostname)) { + $dsn[] = "server={$hostname}"; + } + break; + default: + if (isset($database)) { + $dsn[] = "dbname={$database}"; + } + if (isset($hostname)) { + $dsn[] = "host={$hostname}"; + } + if (isset($port)) { + $dsn[] = "port={$port}"; + } + if (isset($charset) && $pdoDriver != 'pgsql') { + $dsn[] = "charset={$charset}"; + } + if (isset($unix_socket)) { + $dsn[] = "unix_socket={$unix_socket}"; + } + if (isset($version)) { + $dsn[] = "version={$version}"; + } + break; + } + $dsn = $pdoDriver . ':' . implode(';', $dsn); + } elseif (! isset($dsn)) { + throw new Exception\InvalidConnectionParametersException( + 'A dsn was not provided or could not be constructed from your parameters', + $this->connectionParameters + ); + } + + $this->dsn = $dsn; + + try { + $this->resource = new \PDO($dsn, $username, $password, $options); + $this->resource->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); + if (isset($charset) && $pdoDriver == 'pgsql') { + $this->resource->exec('SET NAMES ' . $this->resource->quote($charset)); + } + $this->driverName = strtolower($this->resource->getAttribute(\PDO::ATTR_DRIVER_NAME)); + } catch (\PDOException $e) { + $code = $e->getCode(); + if (! is_long($code)) { + $code = null; + } + throw new Exception\RuntimeException('Connect Error: ' . $e->getMessage(), $code, $e); + } + + return $this; + } + + /** + * {@inheritDoc} + */ + public function isConnected() + { + return ($this->resource instanceof \PDO); + } + + /** + * {@inheritDoc} + */ + public function beginTransaction() + { + if (! $this->isConnected()) { + $this->connect(); + } + + if (0 === $this->nestedTransactionsCount) { + $this->resource->beginTransaction(); + $this->inTransaction = true; + } + + $this->nestedTransactionsCount ++; + + return $this; + } + + /** + * {@inheritDoc} + */ + public function commit() + { + if (! $this->isConnected()) { + $this->connect(); + } + + if ($this->inTransaction) { + $this->nestedTransactionsCount -= 1; + } + + /* + * This shouldn't check for being in a transaction since + * after issuing a SET autocommit=0; we have to commit too. + */ + if (0 === $this->nestedTransactionsCount) { + $this->resource->commit(); + $this->inTransaction = false; + } + + return $this; + } + + /** + * {@inheritDoc} + * + * @throws Exception\RuntimeException + */ + public function rollback() + { + if (! $this->isConnected()) { + throw new Exception\RuntimeException('Must be connected before you can rollback'); + } + + if (! $this->inTransaction()) { + throw new Exception\RuntimeException('Must call beginTransaction() before you can rollback'); + } + + $this->resource->rollBack(); + + $this->inTransaction = false; + $this->nestedTransactionsCount = 0; + + return $this; + } + + /** + * {@inheritDoc} + * + * @throws Exception\InvalidQueryException + */ + public function execute($sql) + { + if (! $this->isConnected()) { + $this->connect(); + } + + if ($this->profiler) { + $this->profiler->profilerStart($sql); + } + + $resultResource = $this->resource->query($sql); + + if ($this->profiler) { + $this->profiler->profilerFinish($sql); + } + + if ($resultResource === false) { + $errorInfo = $this->resource->errorInfo(); + throw new Exception\InvalidQueryException($errorInfo[2]); + } + + $result = $this->driver->createResult($resultResource, $sql); + + return $result; + } + + /** + * Prepare + * + * @param string $sql + * @return Statement + */ + public function prepare($sql) + { + if (! $this->isConnected()) { + $this->connect(); + } + + $statement = $this->driver->createStatement($sql); + + return $statement; + } + + /** + * {@inheritDoc} + * + * @param string $name + * @return string|null|false + */ + public function getLastGeneratedValue($name = null) + { + if ($name === null + && ($this->driverName == 'pgsql' || $this->driverName == 'firebird')) { + return; + } + + try { + return $this->resource->lastInsertId($name); + } catch (\Exception $e) { + // do nothing + } + + return false; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pdo/Feature/OracleRowCounter.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pdo/Feature/OracleRowCounter.php new file mode 100644 index 00000000..781aca3d --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pdo/Feature/OracleRowCounter.php @@ -0,0 +1,75 @@ +getSql(); + if ($sql == '' || stripos($sql, 'select') === false) { + return; + } + $countSql = 'SELECT COUNT(*) as "count" FROM (' . $sql . ')'; + $countStmt->prepare($countSql); + $result = $countStmt->execute(); + $countRow = $result->getResource()->fetch(\PDO::FETCH_ASSOC); + unset($statement, $result); + return $countRow['count']; + } + + /** + * @param $sql + * @return null|int + */ + public function getCountForSql($sql) + { + if (stripos($sql, 'select') === false) { + return; + } + $countSql = 'SELECT COUNT(*) as count FROM (' . $sql . ')'; + /** @var $pdo \PDO */ + $pdo = $this->driver->getConnection()->getResource(); + $result = $pdo->query($countSql); + $countRow = $result->fetch(\PDO::FETCH_ASSOC); + return $countRow['count']; + } + + /** + * @param $context + * @return \Closure + */ + public function getRowCountClosure($context) + { + return function () use ($context) { + return ($context instanceof Pdo\Statement) + ? $this->getCountForStatement($context) + : $this->getCountForSql($context); + }; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pdo/Feature/SqliteRowCounter.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pdo/Feature/SqliteRowCounter.php new file mode 100644 index 00000000..eb922f5c --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pdo/Feature/SqliteRowCounter.php @@ -0,0 +1,75 @@ +getSql(); + if ($sql == '' || stripos($sql, 'select') === false) { + return; + } + $countSql = 'SELECT COUNT(*) as "count" FROM (' . $sql . ')'; + $countStmt->prepare($countSql); + $result = $countStmt->execute(); + $countRow = $result->getResource()->fetch(\PDO::FETCH_ASSOC); + unset($statement, $result); + return $countRow['count']; + } + + /** + * @param $sql + * @return null|int + */ + public function getCountForSql($sql) + { + if (stripos($sql, 'select') === false) { + return; + } + $countSql = 'SELECT COUNT(*) as count FROM (' . $sql . ')'; + /** @var $pdo \PDO */ + $pdo = $this->driver->getConnection()->getResource(); + $result = $pdo->query($countSql); + $countRow = $result->fetch(\PDO::FETCH_ASSOC); + return $countRow['count']; + } + + /** + * @param $context + * @return \Closure + */ + public function getRowCountClosure($context) + { + return function () use ($context) { + return ($context instanceof Pdo\Statement) + ? $this->getCountForStatement($context) + : $this->getCountForSql($context); + }; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pdo/Pdo.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pdo/Pdo.php new file mode 100644 index 00000000..d445d584 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pdo/Pdo.php @@ -0,0 +1,330 @@ +registerConnection($connection); + $this->registerStatementPrototype(($statementPrototype) ?: new Statement()); + $this->registerResultPrototype(($resultPrototype) ?: new Result()); + if (is_array($features)) { + foreach ($features as $name => $feature) { + $this->addFeature($name, $feature); + } + } elseif ($features instanceof AbstractFeature) { + $this->addFeature($features->getName(), $features); + } elseif ($features === self::FEATURES_DEFAULT) { + $this->setupDefaultFeatures(); + } + } + + /** + * @param Profiler\ProfilerInterface $profiler + * @return self Provides a fluent interface + */ + public function setProfiler(Profiler\ProfilerInterface $profiler) + { + $this->profiler = $profiler; + if ($this->connection instanceof Profiler\ProfilerAwareInterface) { + $this->connection->setProfiler($profiler); + } + if ($this->statementPrototype instanceof Profiler\ProfilerAwareInterface) { + $this->statementPrototype->setProfiler($profiler); + } + return $this; + } + + /** + * @return null|Profiler\ProfilerInterface + */ + public function getProfiler() + { + return $this->profiler; + } + + /** + * Register connection + * + * @param Connection $connection + * @return self Provides a fluent interface + */ + public function registerConnection(Connection $connection) + { + $this->connection = $connection; + $this->connection->setDriver($this); + return $this; + } + + /** + * Register statement prototype + * + * @param Statement $statementPrototype + */ + public function registerStatementPrototype(Statement $statementPrototype) + { + $this->statementPrototype = $statementPrototype; + $this->statementPrototype->setDriver($this); + } + + /** + * Register result prototype + * + * @param Result $resultPrototype + */ + public function registerResultPrototype(Result $resultPrototype) + { + $this->resultPrototype = $resultPrototype; + } + + /** + * Add feature + * + * @param string $name + * @param AbstractFeature $feature + * @return self Provides a fluent interface + */ + public function addFeature($name, $feature) + { + if ($feature instanceof AbstractFeature) { + $name = $feature->getName(); // overwrite the name, just in case + $feature->setDriver($this); + } + $this->features[$name] = $feature; + return $this; + } + + /** + * Setup the default features for Pdo + * + * @return self Provides a fluent interface + */ + public function setupDefaultFeatures() + { + $driverName = $this->connection->getDriverName(); + if ($driverName == 'sqlite') { + $this->addFeature(null, new Feature\SqliteRowCounter); + } elseif ($driverName == 'oci') { + $this->addFeature(null, new Feature\OracleRowCounter); + } + return $this; + } + + /** + * Get feature + * + * @param $name + * @return AbstractFeature|false + */ + public function getFeature($name) + { + if (isset($this->features[$name])) { + return $this->features[$name]; + } + return false; + } + + /** + * Get database platform name + * + * @param string $nameFormat + * @return string + */ + public function getDatabasePlatformName($nameFormat = self::NAME_FORMAT_CAMELCASE) + { + $name = $this->getConnection()->getDriverName(); + if ($nameFormat == self::NAME_FORMAT_CAMELCASE) { + switch ($name) { + case 'pgsql': + return 'Postgresql'; + case 'oci': + return 'Oracle'; + case 'dblib': + case 'sqlsrv': + return 'SqlServer'; + default: + return ucfirst($name); + } + } else { + switch ($name) { + case 'sqlite': + return 'SQLite'; + case 'mysql': + return 'MySQL'; + case 'pgsql': + return 'PostgreSQL'; + case 'oci': + return 'Oracle'; + case 'dblib': + case 'sqlsrv': + return 'SQLServer'; + default: + return ucfirst($name); + } + } + } + + /** + * Check environment + */ + public function checkEnvironment() + { + if (! extension_loaded('PDO')) { + throw new Exception\RuntimeException( + 'The PDO extension is required for this adapter but the extension is not loaded' + ); + } + } + + /** + * @return Connection + */ + public function getConnection() + { + return $this->connection; + } + + /** + * @param string|PDOStatement $sqlOrResource + * @return Statement + */ + public function createStatement($sqlOrResource = null) + { + $statement = clone $this->statementPrototype; + if ($sqlOrResource instanceof PDOStatement) { + $statement->setResource($sqlOrResource); + } else { + if (is_string($sqlOrResource)) { + $statement->setSql($sqlOrResource); + } + if (! $this->connection->isConnected()) { + $this->connection->connect(); + } + $statement->initialize($this->connection->getResource()); + } + return $statement; + } + + /** + * @param resource $resource + * @param mixed $context + * @return Result + */ + public function createResult($resource, $context = null) + { + $result = clone $this->resultPrototype; + $rowCount = null; + + // special feature, sqlite PDO counter + if ($this->connection->getDriverName() == 'sqlite' + && ($sqliteRowCounter = $this->getFeature('SqliteRowCounter')) + && $resource->columnCount() > 0) { + $rowCount = $sqliteRowCounter->getRowCountClosure($context); + } + + // special feature, oracle PDO counter + if ($this->connection->getDriverName() == 'oci' + && ($oracleRowCounter = $this->getFeature('OracleRowCounter')) + && $resource->columnCount() > 0) { + $rowCount = $oracleRowCounter->getRowCountClosure($context); + } + + + $result->initialize($resource, $this->connection->getLastGeneratedValue(), $rowCount); + return $result; + } + + /** + * @return string + */ + public function getPrepareType() + { + return self::PARAMETERIZATION_NAMED; + } + + /** + * @param string $name + * @param string|null $type + * @return string + */ + public function formatParameterName($name, $type = null) + { + if ($type === null && ! is_numeric($name) || $type == self::PARAMETERIZATION_NAMED) { + $name = ltrim($name, ':'); + // @see https://bugs.php.net/bug.php?id=43130 + if (preg_match('/[^a-zA-Z0-9_]/', $name)) { + throw new Exception\RuntimeException(sprintf( + 'The PDO param %s contains invalid characters.' + . ' Only alphabetic characters, digits, and underscores (_)' + . ' are allowed.', + $name + )); + } + return ':' . $name; + } + + return '?'; + } + + /** + * @param string|null $name + * @return string|null|false + */ + public function getLastGeneratedValue($name = null) + { + return $this->connection->getLastGeneratedValue($name); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pdo/Result.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pdo/Result.php new file mode 100644 index 00000000..be69af29 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pdo/Result.php @@ -0,0 +1,277 @@ +resource = $resource; + $this->generatedValue = $generatedValue; + $this->rowCount = $rowCount; + + return $this; + } + + /** + * @return null + */ + public function buffer() + { + return; + } + + /** + * @return bool|null + */ + public function isBuffered() + { + return false; + } + + /** + * @param int $fetchMode + * @throws Exception\InvalidArgumentException on invalid fetch mode + */ + public function setFetchMode($fetchMode) + { + if (! in_array($fetchMode, self::VALID_FETCH_MODES, true)) { + throw new Exception\InvalidArgumentException( + 'The fetch mode must be one of the PDO::FETCH_* constants.' + ); + } + + $this->fetchMode = (int) $fetchMode; + } + + /** + * @return int + */ + public function getFetchMode() + { + return $this->fetchMode; + } + + /** + * Get resource + * + * @return mixed + */ + public function getResource() + { + return $this->resource; + } + + /** + * Get the data + * @return mixed + */ + public function current() + { + if ($this->currentComplete) { + return $this->currentData; + } + + $this->currentData = $this->resource->fetch($this->fetchMode); + $this->currentComplete = true; + return $this->currentData; + } + + /** + * Next + * + * @return mixed + */ + public function next() + { + $this->currentData = $this->resource->fetch($this->fetchMode); + $this->currentComplete = true; + $this->position++; + return $this->currentData; + } + + /** + * Key + * + * @return mixed + */ + public function key() + { + return $this->position; + } + + /** + * @throws Exception\RuntimeException + * @return void + */ + public function rewind() + { + if ($this->statementMode == self::STATEMENT_MODE_FORWARD && $this->position > 0) { + throw new Exception\RuntimeException( + 'This result is a forward only result set, calling rewind() after moving forward is not supported' + ); + } + $this->currentData = $this->resource->fetch($this->fetchMode); + $this->currentComplete = true; + $this->position = 0; + } + + /** + * Valid + * + * @return bool + */ + public function valid() + { + return ($this->currentData !== false); + } + + /** + * Count + * + * @return int + */ + public function count() + { + if (is_int($this->rowCount)) { + return $this->rowCount; + } + if ($this->rowCount instanceof \Closure) { + $this->rowCount = (int) call_user_func($this->rowCount); + } else { + $this->rowCount = (int) $this->resource->rowCount(); + } + return $this->rowCount; + } + + /** + * @return int + */ + public function getFieldCount() + { + return $this->resource->columnCount(); + } + + /** + * Is query result + * + * @return bool + */ + public function isQueryResult() + { + return ($this->resource->columnCount() > 0); + } + + /** + * Get affected rows + * + * @return int + */ + public function getAffectedRows() + { + return $this->resource->rowCount(); + } + + /** + * @return mixed|null + */ + public function getGeneratedValue() + { + return $this->generatedValue; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pdo/Statement.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pdo/Statement.php new file mode 100644 index 00000000..23c7fd03 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pdo/Statement.php @@ -0,0 +1,309 @@ +driver = $driver; + return $this; + } + + /** + * @param Profiler\ProfilerInterface $profiler + * @return self Provides a fluent interface + */ + public function setProfiler(Profiler\ProfilerInterface $profiler) + { + $this->profiler = $profiler; + return $this; + } + + /** + * @return null|Profiler\ProfilerInterface + */ + public function getProfiler() + { + return $this->profiler; + } + + /** + * Initialize + * + * @param \PDO $connectionResource + * @return self Provides a fluent interface + */ + public function initialize(\PDO $connectionResource) + { + $this->pdo = $connectionResource; + return $this; + } + + /** + * Set resource + * + * @param \PDOStatement $pdoStatement + * @return self Provides a fluent interface + */ + public function setResource(\PDOStatement $pdoStatement) + { + $this->resource = $pdoStatement; + return $this; + } + + /** + * Get resource + * + * @return mixed + */ + public function getResource() + { + return $this->resource; + } + + /** + * Set sql + * + * @param string $sql + * @return self Provides a fluent interface + */ + public function setSql($sql) + { + $this->sql = $sql; + return $this; + } + + /** + * Get sql + * + * @return string + */ + public function getSql() + { + return $this->sql; + } + + /** + * @param ParameterContainer $parameterContainer + * @return self Provides a fluent interface + */ + public function setParameterContainer(ParameterContainer $parameterContainer) + { + $this->parameterContainer = $parameterContainer; + return $this; + } + + /** + * @return ParameterContainer + */ + public function getParameterContainer() + { + return $this->parameterContainer; + } + + /** + * @param string $sql + * @throws Exception\RuntimeException + */ + public function prepare($sql = null) + { + if ($this->isPrepared) { + throw new Exception\RuntimeException('This statement has been prepared already'); + } + + if ($sql === null) { + $sql = $this->sql; + } + + $this->resource = $this->pdo->prepare($sql); + + if ($this->resource === false) { + $error = $this->pdo->errorInfo(); + throw new Exception\RuntimeException($error[2]); + } + + $this->isPrepared = true; + } + + /** + * @return bool + */ + public function isPrepared() + { + return $this->isPrepared; + } + + /** + * @param null|array|ParameterContainer $parameters + * @throws Exception\InvalidQueryException + * @return Result + */ + public function execute($parameters = null) + { + if (! $this->isPrepared) { + $this->prepare(); + } + + /** START Standard ParameterContainer Merging Block */ + if (! $this->parameterContainer instanceof ParameterContainer) { + if ($parameters instanceof ParameterContainer) { + $this->parameterContainer = $parameters; + $parameters = null; + } else { + $this->parameterContainer = new ParameterContainer(); + } + } + + if (is_array($parameters)) { + $this->parameterContainer->setFromArray($parameters); + } + + if ($this->parameterContainer->count() > 0) { + $this->bindParametersFromContainer(); + } + /** END Standard ParameterContainer Merging Block */ + + if ($this->profiler) { + $this->profiler->profilerStart($this); + } + + try { + $this->resource->execute(); + } catch (\PDOException $e) { + if ($this->profiler) { + $this->profiler->profilerFinish(); + } + throw new Exception\InvalidQueryException( + 'Statement could not be executed (' . implode(' - ', $this->resource->errorInfo()) . ')', + null, + $e + ); + } + + if ($this->profiler) { + $this->profiler->profilerFinish(); + } + + $result = $this->driver->createResult($this->resource, $this); + return $result; + } + + /** + * Bind parameters from container + */ + protected function bindParametersFromContainer() + { + if ($this->parametersBound) { + return; + } + + $parameters = $this->parameterContainer->getNamedArray(); + foreach ($parameters as $name => &$value) { + if (is_bool($value)) { + $type = \PDO::PARAM_BOOL; + } elseif (is_int($value)) { + $type = \PDO::PARAM_INT; + } else { + $type = \PDO::PARAM_STR; + } + if ($this->parameterContainer->offsetHasErrata($name)) { + switch ($this->parameterContainer->offsetGetErrata($name)) { + case ParameterContainer::TYPE_INTEGER: + $type = \PDO::PARAM_INT; + break; + case ParameterContainer::TYPE_NULL: + $type = \PDO::PARAM_NULL; + break; + case ParameterContainer::TYPE_LOB: + $type = \PDO::PARAM_LOB; + break; + } + } + + // parameter is named or positional, value is reference + $parameter = is_int($name) ? ($name + 1) : $this->driver->formatParameterName($name); + $this->resource->bindParam($parameter, $value, $type); + } + } + + /** + * Perform a deep clone + * @return Statement A cloned statement + */ + public function __clone() + { + $this->isPrepared = false; + $this->parametersBound = false; + $this->resource = null; + if ($this->parameterContainer) { + $this->parameterContainer = clone $this->parameterContainer; + } + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pgsql/Connection.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pgsql/Connection.php new file mode 100644 index 00000000..df123441 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pgsql/Connection.php @@ -0,0 +1,315 @@ +setConnectionParameters($connectionInfo); + } elseif (is_resource($connectionInfo)) { + $this->setResource($connectionInfo); + } + } + + /** + * Set resource + * + * @param resource $resource + * @return self Provides a fluent interface + */ + public function setResource($resource) + { + $this->resource = $resource; + + return $this; + } + + + /** + * Set driver + * + * @param Pgsql $driver + * @return self Provides a fluent interface + */ + public function setDriver(Pgsql $driver) + { + $this->driver = $driver; + + return $this; + } + + /** + * @param int|null $type + * @return self Provides a fluent interface + */ + public function setType($type) + { + $invalidConectionType = ($type !== PGSQL_CONNECT_FORCE_NEW); + + // Compatibility with PHP < 5.6 + if ($invalidConectionType && defined('PGSQL_CONNECT_ASYNC')) { + $invalidConectionType = ($type !== PGSQL_CONNECT_ASYNC); + } + + if ($invalidConectionType) { + throw new Exception\InvalidArgumentException( + 'Connection type is not valid. (See: http://php.net/manual/en/function.pg-connect.php)' + ); + } + $this->type = $type; + return $this; + } + + /** + * {@inheritDoc} + * + * @return null|string + */ + public function getCurrentSchema() + { + if (! $this->isConnected()) { + $this->connect(); + } + + $result = pg_query($this->resource, 'SELECT CURRENT_SCHEMA AS "currentschema"'); + if ($result == false) { + return; + } + + return pg_fetch_result($result, 0, 'currentschema'); + } + + /** + * {@inheritDoc} + * + * @throws Exception\RuntimeException on failure + */ + public function connect() + { + if (is_resource($this->resource)) { + return $this; + } + + $connection = $this->getConnectionString(); + set_error_handler(function ($number, $string) { + throw new Exception\RuntimeException( + __CLASS__ . '::connect: Unable to connect to database', + null, + new Exception\ErrorException($string, $number) + ); + }); + try { + $this->resource = pg_connect($connection); + } finally { + restore_error_handler(); + } + + if ($this->resource === false) { + throw new Exception\RuntimeException(sprintf( + '%s: Unable to connect to database', + __METHOD__ + )); + } + + $p = $this->connectionParameters; + + if (! empty($p['charset'])) { + if (-1 === pg_set_client_encoding($this->resource, $p['charset'])) { + throw new Exception\RuntimeException(sprintf( + "%s: Unable to set client encoding '%s'", + __METHOD__, + $p['charset'] + )); + } + } + + return $this; + } + + /** + * {@inheritDoc} + */ + public function isConnected() + { + return (is_resource($this->resource)); + } + + /** + * {@inheritDoc} + */ + public function disconnect() + { + pg_close($this->resource); + return $this; + } + + /** + * {@inheritDoc} + */ + public function beginTransaction() + { + if ($this->inTransaction()) { + throw new Exception\RuntimeException('Nested transactions are not supported'); + } + + if (! $this->isConnected()) { + $this->connect(); + } + + pg_query($this->resource, 'BEGIN'); + $this->inTransaction = true; + + return $this; + } + + /** + * {@inheritDoc} + */ + public function commit() + { + if (! $this->isConnected()) { + $this->connect(); + } + + if (! $this->inTransaction()) { + return; // We ignore attempts to commit non-existing transaction + } + + pg_query($this->resource, 'COMMIT'); + $this->inTransaction = false; + + return $this; + } + + /** + * {@inheritDoc} + */ + public function rollback() + { + if (! $this->isConnected()) { + throw new Exception\RuntimeException('Must be connected before you can rollback'); + } + + if (! $this->inTransaction()) { + throw new Exception\RuntimeException('Must call beginTransaction() before you can rollback'); + } + + pg_query($this->resource, 'ROLLBACK'); + $this->inTransaction = false; + + return $this; + } + + /** + * {@inheritDoc} + * + * @throws Exception\InvalidQueryException + * @return resource|\Laminas\Db\ResultSet\ResultSetInterface + */ + public function execute($sql) + { + if (! $this->isConnected()) { + $this->connect(); + } + + if ($this->profiler) { + $this->profiler->profilerStart($sql); + } + + $resultResource = pg_query($this->resource, $sql); + + if ($this->profiler) { + $this->profiler->profilerFinish($sql); + } + + // if the returnValue is something other than a pg result resource, bypass wrapping it + if ($resultResource === false) { + throw new Exception\InvalidQueryException(pg_errormessage()); + } + + $resultPrototype = $this->driver->createResult(($resultResource === true) ? $this->resource : $resultResource); + + return $resultPrototype; + } + + /** + * {@inheritDoc} + * + * @return string + */ + public function getLastGeneratedValue($name = null) + { + if ($name === null) { + return; + } + $result = pg_query( + $this->resource, + 'SELECT CURRVAL(\'' . str_replace('\'', '\\\'', $name) . '\') as "currval"' + ); + + return pg_fetch_result($result, 0, 'currval'); + } + + /** + * Get Connection String + * + * @return string + */ + private function getConnectionString() + { + // localize + $p = $this->connectionParameters; + + // given a list of key names, test for existence in $p + $findParameterValue = function (array $names) use ($p) { + foreach ($names as $name) { + if (isset($p[$name])) { + return $p[$name]; + } + } + return; + }; + + $connectionParameters = [ + 'host' => $findParameterValue(['hostname', 'host']), + 'user' => $findParameterValue(['username', 'user']), + 'password' => $findParameterValue(['password', 'passwd', 'pw']), + 'dbname' => $findParameterValue(['database', 'dbname', 'db', 'schema']), + 'port' => isset($p['port']) ? (int) $p['port'] : null, + 'socket' => isset($p['socket']) ? $p['socket'] : null, + ]; + + return urldecode(http_build_query(array_filter($connectionParameters), null, ' ')); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pgsql/Pgsql.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pgsql/Pgsql.php new file mode 100644 index 00000000..5db7180f --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pgsql/Pgsql.php @@ -0,0 +1,236 @@ + false + ]; + + /** + * Constructor + * + * @param array|Connection|resource $connection + * @param null|Statement $statementPrototype + * @param null|Result $resultPrototype + * @param array $options + */ + public function __construct( + $connection, + Statement $statementPrototype = null, + Result $resultPrototype = null, + $options = null + ) { + if (! $connection instanceof Connection) { + $connection = new Connection($connection); + } + + $this->registerConnection($connection); + $this->registerStatementPrototype(($statementPrototype) ?: new Statement()); + $this->registerResultPrototype(($resultPrototype) ?: new Result()); + } + + /** + * @param Profiler\ProfilerInterface $profiler + * @return self Provides a fluent interface + */ + public function setProfiler(Profiler\ProfilerInterface $profiler) + { + $this->profiler = $profiler; + if ($this->connection instanceof Profiler\ProfilerAwareInterface) { + $this->connection->setProfiler($profiler); + } + if ($this->statementPrototype instanceof Profiler\ProfilerAwareInterface) { + $this->statementPrototype->setProfiler($profiler); + } + return $this; + } + + /** + * @return null|Profiler\ProfilerInterface + */ + public function getProfiler() + { + return $this->profiler; + } + + /** + * Register connection + * + * @param Connection $connection + * @return self Provides a fluent interface + */ + public function registerConnection(Connection $connection) + { + $this->connection = $connection; + $this->connection->setDriver($this); + return $this; + } + + /** + * Register statement prototype + * + * @param Statement $statement + * @return self Provides a fluent interface + */ + public function registerStatementPrototype(Statement $statement) + { + $this->statementPrototype = $statement; + $this->statementPrototype->setDriver($this); // needs access to driver to createResult() + return $this; + } + + /** + * Register result prototype + * + * @param Result $result + * @return self Provides a fluent interface + */ + public function registerResultPrototype(Result $result) + { + $this->resultPrototype = $result; + return $this; + } + + /** + * Get database platform name + * + * @param string $nameFormat + * @return string + */ + public function getDatabasePlatformName($nameFormat = self::NAME_FORMAT_CAMELCASE) + { + if ($nameFormat == self::NAME_FORMAT_CAMELCASE) { + return 'Postgresql'; + } + + return 'PostgreSQL'; + } + + /** + * Check environment + * + * @throws Exception\RuntimeException + * @return bool + */ + public function checkEnvironment() + { + if (! extension_loaded('pgsql')) { + throw new Exception\RuntimeException( + 'The PostgreSQL (pgsql) extension is required for this adapter but the extension is not loaded' + ); + } + } + + /** + * Get connection + * + * @return Connection + */ + public function getConnection() + { + return $this->connection; + } + + /** + * Create statement + * + * @param string|null $sqlOrResource + * @return Statement + */ + public function createStatement($sqlOrResource = null) + { + $statement = clone $this->statementPrototype; + + if (is_string($sqlOrResource)) { + $statement->setSql($sqlOrResource); + } + + if (! $this->connection->isConnected()) { + $this->connection->connect(); + } + + $statement->initialize($this->connection->getResource()); + return $statement; + } + + /** + * Create result + * + * @param resource $resource + * @return Result + */ + public function createResult($resource) + { + $result = clone $this->resultPrototype; + $result->initialize($resource, $this->connection->getLastGeneratedValue()); + return $result; + } + + /** + * Get prepare Type + * + * @return string + */ + public function getPrepareType() + { + return self::PARAMETERIZATION_POSITIONAL; + } + + /** + * Format parameter name + * + * @param string $name + * @param mixed $type + * @return string + */ + public function formatParameterName($name, $type = null) + { + return '$#'; + } + + /** + * Get last generated value + * + * @param string $name + * @return mixed + */ + public function getLastGeneratedValue($name = null) + { + return $this->connection->getLastGeneratedValue($name); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pgsql/Result.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pgsql/Result.php new file mode 100644 index 00000000..24d332e2 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pgsql/Result.php @@ -0,0 +1,191 @@ +resource = $resource; + $this->count = pg_num_rows($this->resource); + $this->generatedValue = $generatedValue; + } + + /** + * Current + * + * @return array|bool|mixed + */ + public function current() + { + if ($this->count === 0) { + return false; + } + return pg_fetch_assoc($this->resource, $this->position); + } + + /** + * Next + * + * @return void + */ + public function next() + { + $this->position++; + } + + /** + * Key + * + * @return int|mixed + */ + public function key() + { + return $this->position; + } + + /** + * Valid + * + * @return bool + */ + public function valid() + { + return ($this->position < $this->count); + } + + /** + * Rewind + * + * @return void + */ + public function rewind() + { + $this->position = 0; + } + + /** + * Buffer + * + * @return null + */ + public function buffer() + { + return; + } + + /** + * Is buffered + * + * @return false + */ + public function isBuffered() + { + return false; + } + + /** + * Is query result + * + * @return bool + */ + public function isQueryResult() + { + return (pg_num_fields($this->resource) > 0); + } + + /** + * Get affected rows + * + * @return int + */ + public function getAffectedRows() + { + return pg_affected_rows($this->resource); + } + + /** + * Get generated value + * + * @return mixed|null + */ + public function getGeneratedValue() + { + return $this->generatedValue; + } + + /** + * Get resource + */ + public function getResource() + { + // TODO: Implement getResource() method. + } + + /** + * Count + * + * (PHP 5 >= 5.1.0)
+ * Count elements of an object + * @link http://php.net/manual/en/countable.count.php + * @return int The custom count as an integer. + *

+ *

+ * The return value is cast to an integer. + */ + public function count() + { + return $this->count; + } + + /** + * Get field count + * + * @return int + */ + public function getFieldCount() + { + return pg_num_fields($this->resource); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pgsql/Statement.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pgsql/Statement.php new file mode 100644 index 00000000..d24aefc9 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Pgsql/Statement.php @@ -0,0 +1,241 @@ +driver = $driver; + return $this; + } + + /** + * @param Profiler\ProfilerInterface $profiler + * @return self Provides a fluent interface + */ + public function setProfiler(Profiler\ProfilerInterface $profiler) + { + $this->profiler = $profiler; + return $this; + } + + /** + * @return null|Profiler\ProfilerInterface + */ + public function getProfiler() + { + return $this->profiler; + } + + /** + * Initialize + * + * @param resource $pgsql + * @return void + * @throws Exception\RuntimeException for invalid or missing postgresql connection + */ + public function initialize($pgsql) + { + if (! is_resource($pgsql) || get_resource_type($pgsql) !== 'pgsql link') { + throw new Exception\RuntimeException(sprintf( + '%s: Invalid or missing postgresql connection; received "%s"', + __METHOD__, + get_resource_type($pgsql) + )); + } + $this->pgsql = $pgsql; + } + + /** + * Get resource + * + * @return resource + */ + public function getResource() + { + // TODO: Implement getResource() method. + } + + /** + * Set sql + * + * @param string $sql + * @return self Provides a fluent interface + */ + public function setSql($sql) + { + $this->sql = $sql; + return $this; + } + + /** + * Get sql + * + * @return string + */ + public function getSql() + { + return $this->sql; + } + + /** + * Set parameter container + * + * @param ParameterContainer $parameterContainer + * @return self Provides a fluent interface + */ + public function setParameterContainer(ParameterContainer $parameterContainer) + { + $this->parameterContainer = $parameterContainer; + return $this; + } + + /** + * Get parameter container + * + * @return ParameterContainer + */ + public function getParameterContainer() + { + return $this->parameterContainer; + } + + /** + * Prepare + * + * @param string $sql + */ + public function prepare($sql = null) + { + $sql = ($sql) ?: $this->sql; + + $pCount = 1; + $sql = preg_replace_callback( + '#\$\##', + function () use (&$pCount) { + return '$' . $pCount++; + }, + $sql + ); + + $this->sql = $sql; + $this->statementName = 'statement' . ++static::$statementIndex; + $this->resource = pg_prepare($this->pgsql, $this->statementName, $sql); + } + + /** + * Is prepared + * + * @return bool + */ + public function isPrepared() + { + return isset($this->resource); + } + + /** + * Execute + * + * @param null|array|ParameterContainer $parameters + * @throws Exception\InvalidQueryException + * @return Result + */ + public function execute($parameters = null) + { + if (! $this->isPrepared()) { + $this->prepare(); + } + + /** START Standard ParameterContainer Merging Block */ + if (! $this->parameterContainer instanceof ParameterContainer) { + if ($parameters instanceof ParameterContainer) { + $this->parameterContainer = $parameters; + $parameters = null; + } else { + $this->parameterContainer = new ParameterContainer(); + } + } + + if (is_array($parameters)) { + $this->parameterContainer->setFromArray($parameters); + } + + if ($this->parameterContainer->count() > 0) { + $parameters = $this->parameterContainer->getPositionalArray(); + } + /** END Standard ParameterContainer Merging Block */ + + if ($this->profiler) { + $this->profiler->profilerStart($this); + } + + $resultResource = pg_execute($this->pgsql, $this->statementName, (array) $parameters); + + if ($this->profiler) { + $this->profiler->profilerFinish(); + } + + if ($resultResource === false) { + throw new Exception\InvalidQueryException(pg_last_error()); + } + + $result = $this->driver->createResult($resultResource); + return $result; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/ResultInterface.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/ResultInterface.php new file mode 100644 index 00000000..31240d9a --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/ResultInterface.php @@ -0,0 +1,66 @@ +setConnectionParameters($connectionInfo); + } elseif (is_resource($connectionInfo)) { + $this->setResource($connectionInfo); + } else { + throw new Exception\InvalidArgumentException('$connection must be an array of parameters or a resource'); + } + } + + /** + * Set driver + * + * @param Sqlsrv $driver + * @return self Provides a fluent interface + */ + public function setDriver(Sqlsrv $driver) + { + $this->driver = $driver; + + return $this; + } + + /** + * {@inheritDoc} + */ + public function getCurrentSchema() + { + if (! $this->isConnected()) { + $this->connect(); + } + + $result = sqlsrv_query($this->resource, 'SELECT SCHEMA_NAME()'); + $r = sqlsrv_fetch_array($result); + + return $r[0]; + } + + /** + * Set resource + * + * @param resource $resource + * @return self Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function setResource($resource) + { + if (get_resource_type($resource) !== 'SQL Server Connection') { + throw new Exception\InvalidArgumentException('Resource provided was not of type SQL Server Connection'); + } + $this->resource = $resource; + + return $this; + } + + /** + * {@inheritDoc} + * + * @throws Exception\RuntimeException + */ + public function connect() + { + if ($this->resource) { + return $this; + } + + $serverName = '.'; + $params = [ + 'ReturnDatesAsStrings' => true + ]; + foreach ($this->connectionParameters as $key => $value) { + switch (strtolower($key)) { + case 'hostname': + case 'servername': + $serverName = (string) $value; + break; + case 'username': + case 'uid': + $params['UID'] = (string) $value; + break; + case 'password': + case 'pwd': + $params['PWD'] = (string) $value; + break; + case 'database': + case 'dbname': + $params['Database'] = (string) $value; + break; + case 'charset': + $params['CharacterSet'] = (string) $value; + break; + case 'driver_options': + case 'options': + $params = array_merge($params, (array) $value); + break; + } + } + + $this->resource = sqlsrv_connect($serverName, $params); + + if (! $this->resource) { + throw new Exception\RuntimeException( + 'Connect Error', + null, + new ErrorException(sqlsrv_errors()) + ); + } + + return $this; + } + + /** + * {@inheritDoc} + */ + public function isConnected() + { + return (is_resource($this->resource)); + } + + /** + * {@inheritDoc} + */ + public function disconnect() + { + sqlsrv_close($this->resource); + $this->resource = null; + } + + /** + * {@inheritDoc} + */ + public function beginTransaction() + { + if (! $this->isConnected()) { + $this->connect(); + } + + if (sqlsrv_begin_transaction($this->resource) === false) { + throw new Exception\RuntimeException( + new ErrorException(sqlsrv_errors()) + ); + } + + $this->inTransaction = true; + + return $this; + } + + /** + * {@inheritDoc} + */ + public function commit() + { + // http://msdn.microsoft.com/en-us/library/cc296194.aspx + + if (! $this->isConnected()) { + $this->connect(); + } + + sqlsrv_commit($this->resource); + + $this->inTransaction = false; + + return $this; + } + + /** + * {@inheritDoc} + */ + public function rollback() + { + // http://msdn.microsoft.com/en-us/library/cc296176.aspx + + if (! $this->isConnected()) { + throw new Exception\RuntimeException('Must be connected before you can rollback.'); + } + + sqlsrv_rollback($this->resource); + $this->inTransaction = false; + + return $this; + } + + /** + * {@inheritDoc} + * + * @throws Exception\RuntimeException + */ + public function execute($sql) + { + if (! $this->isConnected()) { + $this->connect(); + } + + if (! $this->driver instanceof Sqlsrv) { + throw new Exception\RuntimeException('Connection is missing an instance of Sqlsrv'); + } + + if ($this->profiler) { + $this->profiler->profilerStart($sql); + } + + $returnValue = sqlsrv_query($this->resource, $sql); + + if ($this->profiler) { + $this->profiler->profilerFinish($sql); + } + + // if the returnValue is something other than a Sqlsrv_result, bypass wrapping it + if ($returnValue === false) { + $errors = sqlsrv_errors(); + // ignore general warnings + if ($errors[0]['SQLSTATE'] != '01000') { + throw new Exception\RuntimeException( + 'An exception occurred while trying to execute the provided $sql', + null, + new ErrorException($errors) + ); + } + } + + $result = $this->driver->createResult($returnValue); + + return $result; + } + + /** + * Prepare + * + * @param string $sql + * @return string + */ + public function prepare($sql) + { + if (! $this->isConnected()) { + $this->connect(); + } + + $statement = $this->driver->createStatement($sql); + + return $statement; + } + + /** + * {@inheritDoc} + * + * @return mixed + */ + public function getLastGeneratedValue($name = null) + { + if (! $this->resource) { + $this->connect(); + } + $sql = 'SELECT @@IDENTITY as Current_Identity'; + $result = sqlsrv_query($this->resource, $sql); + $row = sqlsrv_fetch_array($result); + + return $row['Current_Identity']; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Sqlsrv/Exception/ErrorException.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Sqlsrv/Exception/ErrorException.php new file mode 100644 index 00000000..e4db36d2 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Sqlsrv/Exception/ErrorException.php @@ -0,0 +1,31 @@ +errors = ($errors === false) ? sqlsrv_errors() : $errors; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Sqlsrv/Exception/ExceptionInterface.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Sqlsrv/Exception/ExceptionInterface.php new file mode 100644 index 00000000..217fb590 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Sqlsrv/Exception/ExceptionInterface.php @@ -0,0 +1,15 @@ +resource = $resource; + $this->generatedValue = $generatedValue; + return $this; + } + + /** + * @return null + */ + public function buffer() + { + return; + } + + /** + * @return bool + */ + public function isBuffered() + { + return false; + } + + /** + * Get resource + * + * @return resource + */ + public function getResource() + { + return $this->resource; + } + + /** + * Current + * + * @return mixed + */ + public function current() + { + if ($this->currentComplete) { + return $this->currentData; + } + + $this->load(); + return $this->currentData; + } + + /** + * Next + * + * @return bool + */ + public function next() + { + $this->load(); + return true; + } + + /** + * Load + * + * @param int $row + * @return mixed + */ + protected function load($row = SQLSRV_SCROLL_NEXT) + { + $this->currentData = sqlsrv_fetch_array($this->resource, SQLSRV_FETCH_ASSOC, $row); + $this->currentComplete = true; + $this->position++; + return $this->currentData; + } + + /** + * Key + * + * @return mixed + */ + public function key() + { + return $this->position; + } + + /** + * Rewind + * + * @return bool + */ + public function rewind() + { + $this->position = 0; + $this->load(SQLSRV_SCROLL_FIRST); + return true; + } + + /** + * Valid + * + * @return bool + */ + public function valid() + { + if ($this->currentComplete && $this->currentData) { + return true; + } + + return $this->load(); + } + + /** + * Count + * + * @return int + */ + public function count() + { + return sqlsrv_num_rows($this->resource); + } + + /** + * @return bool|int + */ + public function getFieldCount() + { + return sqlsrv_num_fields($this->resource); + } + + /** + * Is query result + * + * @return bool + */ + public function isQueryResult() + { + if (is_bool($this->resource)) { + return false; + } + return (sqlsrv_num_fields($this->resource) > 0); + } + + /** + * Get affected rows + * + * @return int + */ + public function getAffectedRows() + { + return sqlsrv_rows_affected($this->resource); + } + + /** + * @return mixed|null + */ + public function getGeneratedValue() + { + return $this->generatedValue; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Sqlsrv/Sqlsrv.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Sqlsrv/Sqlsrv.php new file mode 100644 index 00000000..bfe0868b --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Sqlsrv/Sqlsrv.php @@ -0,0 +1,214 @@ +registerConnection($connection); + $this->registerStatementPrototype(($statementPrototype) ?: new Statement()); + $this->registerResultPrototype(($resultPrototype) ?: new Result()); + } + + /** + * @param Profiler\ProfilerInterface $profiler + * @return self Provides a fluent interface + */ + public function setProfiler(Profiler\ProfilerInterface $profiler) + { + $this->profiler = $profiler; + if ($this->connection instanceof Profiler\ProfilerAwareInterface) { + $this->connection->setProfiler($profiler); + } + if ($this->statementPrototype instanceof Profiler\ProfilerAwareInterface) { + $this->statementPrototype->setProfiler($profiler); + } + return $this; + } + + /** + * @return null|Profiler\ProfilerInterface + */ + public function getProfiler() + { + return $this->profiler; + } + + /** + * Register connection + * + * @param Connection $connection + * @return self Provides a fluent interface + */ + public function registerConnection(Connection $connection) + { + $this->connection = $connection; + $this->connection->setDriver($this); + return $this; + } + + /** + * Register statement prototype + * + * @param Statement $statementPrototype + * @return self Provides a fluent interface + */ + public function registerStatementPrototype(Statement $statementPrototype) + { + $this->statementPrototype = $statementPrototype; + $this->statementPrototype->setDriver($this); + return $this; + } + + /** + * Register result prototype + * + * @param Result $resultPrototype + * @return self Provides a fluent interface + */ + public function registerResultPrototype(Result $resultPrototype) + { + $this->resultPrototype = $resultPrototype; + return $this; + } + + /** + * Get database paltform name + * + * @param string $nameFormat + * @return string + */ + public function getDatabasePlatformName($nameFormat = self::NAME_FORMAT_CAMELCASE) + { + if ($nameFormat == self::NAME_FORMAT_CAMELCASE) { + return 'SqlServer'; + } + + return 'SQLServer'; + } + + /** + * Check environment + * + * @throws Exception\RuntimeException + * @return void + */ + public function checkEnvironment() + { + if (! extension_loaded('sqlsrv')) { + throw new Exception\RuntimeException( + 'The Sqlsrv extension is required for this adapter but the extension is not loaded' + ); + } + } + + /** + * @return Connection + */ + public function getConnection() + { + return $this->connection; + } + + /** + * @param string|resource $sqlOrResource + * @return Statement + */ + public function createStatement($sqlOrResource = null) + { + $statement = clone $this->statementPrototype; + if (is_resource($sqlOrResource)) { + $statement->initialize($sqlOrResource); + } else { + if (! $this->connection->isConnected()) { + $this->connection->connect(); + } + $statement->initialize($this->connection->getResource()); + if (is_string($sqlOrResource)) { + $statement->setSql($sqlOrResource); + } elseif ($sqlOrResource !== null) { + throw new Exception\InvalidArgumentException( + 'createStatement() only accepts an SQL string or a Sqlsrv resource' + ); + } + } + return $statement; + } + + /** + * @param resource $resource + * @return Result + */ + public function createResult($resource) + { + $result = clone $this->resultPrototype; + $result->initialize($resource, $this->connection->getLastGeneratedValue()); + return $result; + } + + /** + * @return string + */ + public function getPrepareType() + { + return self::PARAMETERIZATION_POSITIONAL; + } + + /** + * @param string $name + * @param mixed $type + * @return string + */ + public function formatParameterName($name, $type = null) + { + return '?'; + } + + /** + * @return mixed + */ + public function getLastGeneratedValue() + { + return $this->getConnection()->getLastGeneratedValue(); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Sqlsrv/Statement.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Sqlsrv/Statement.php new file mode 100644 index 00000000..267e1543 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/Sqlsrv/Statement.php @@ -0,0 +1,316 @@ +driver = $driver; + return $this; + } + + /** + * @param Profiler\ProfilerInterface $profiler + * @return self Provides a fluent interface + */ + public function setProfiler(Profiler\ProfilerInterface $profiler) + { + $this->profiler = $profiler; + return $this; + } + + /** + * @return null|Profiler\ProfilerInterface + */ + public function getProfiler() + { + return $this->profiler; + } + + /** + * + * One of two resource types will be provided here: + * a) "SQL Server Connection" when a prepared statement needs to still be produced + * b) "SQL Server Statement" when a prepared statement has been already produced + * (there will need to already be a bound param set if it applies to this query) + * + * @param resource $resource + * @return self Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function initialize($resource) + { + $resourceType = get_resource_type($resource); + + if ($resourceType == 'SQL Server Connection') { + $this->sqlsrv = $resource; + } elseif ($resourceType == 'SQL Server Statement') { + $this->resource = $resource; + $this->isPrepared = true; + } else { + throw new Exception\InvalidArgumentException('Invalid resource provided to ' . __CLASS__); + } + + return $this; + } + + /** + * Set parameter container + * + * @param ParameterContainer $parameterContainer + * @return self Provides a fluent interface + */ + public function setParameterContainer(ParameterContainer $parameterContainer) + { + $this->parameterContainer = $parameterContainer; + return $this; + } + + /** + * @return ParameterContainer + */ + public function getParameterContainer() + { + return $this->parameterContainer; + } + + /** + * @param $resource + * @return self Provides a fluent interface + */ + public function setResource($resource) + { + $this->resource = $resource; + return $this; + } + + /** + * Get resource + * + * @return resource + */ + public function getResource() + { + return $this->resource; + } + + /** + * @param string $sql + * @return self Provides a fluent interface + */ + public function setSql($sql) + { + $this->sql = $sql; + return $this; + } + + /** + * Get sql + * + * @return string + */ + public function getSql() + { + return $this->sql; + } + + /** + * @param string $sql + * @param array $options + * @return self Provides a fluent interface + * @throws Exception\RuntimeException + */ + public function prepare($sql = null, array $options = []) + { + if ($this->isPrepared) { + throw new Exception\RuntimeException('Already prepared'); + } + $sql = ($sql) ?: $this->sql; + $options = ($options) ?: $this->prepareOptions; + + $pRef = &$this->parameterReferences; + for ($position = 0, $count = substr_count($sql, '?'); $position < $count; $position++) { + if (! isset($this->prepareParams[$position])) { + $pRef[$position] = [&$this->parameterReferenceValues[$position], SQLSRV_PARAM_IN, null, null]; + } else { + $pRef[$position] = &$this->prepareParams[$position]; + } + } + + $this->resource = sqlsrv_prepare($this->sqlsrv, $sql, $pRef, $options); + + $this->isPrepared = true; + + return $this; + } + + /** + * @return bool + */ + public function isPrepared() + { + return $this->isPrepared; + } + + /** + * Execute + * + * @param null|array|ParameterContainer $parameters + * @throws Exception\RuntimeException + * @return Result + */ + public function execute($parameters = null) + { + /** END Standard ParameterContainer Merging Block */ + if (! $this->isPrepared) { + $this->prepare(); + } + + /** START Standard ParameterContainer Merging Block */ + if (! $this->parameterContainer instanceof ParameterContainer) { + if ($parameters instanceof ParameterContainer) { + $this->parameterContainer = $parameters; + $parameters = null; + } else { + $this->parameterContainer = new ParameterContainer(); + } + } + + if (is_array($parameters)) { + $this->parameterContainer->setFromArray($parameters); + } + + if ($this->parameterContainer->count() > 0) { + $this->bindParametersFromContainer(); + } + + if ($this->profiler) { + $this->profiler->profilerStart($this); + } + + $resultValue = sqlsrv_execute($this->resource); + + if ($this->profiler) { + $this->profiler->profilerFinish(); + } + + if ($resultValue === false) { + $errors = sqlsrv_errors(); + // ignore general warnings + if ($errors[0]['SQLSTATE'] != '01000') { + throw new Exception\RuntimeException($errors[0]['message']); + } + } + + $result = $this->driver->createResult($this->resource); + return $result; + } + + /** + * Bind parameters from container + * + */ + protected function bindParametersFromContainer() + { + $values = $this->parameterContainer->getPositionalArray(); + $position = 0; + foreach ($values as $value) { + $this->parameterReferences[$position++][0] = $value; + } + } + + /** + * @param array $prepareParams + */ + public function setPrepareParams(array $prepareParams) + { + $this->prepareParams = $prepareParams; + } + + /** + * @param array $prepareOptions + */ + public function setPrepareOptions(array $prepareOptions) + { + $this->prepareOptions = $prepareOptions; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Driver/StatementInterface.php b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/StatementInterface.php new file mode 100644 index 00000000..e5576384 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Driver/StatementInterface.php @@ -0,0 +1,44 @@ +parameters = $parameters; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Exception/InvalidQueryException.php b/bundled-libs/laminas/laminas-db/src/Adapter/Exception/InvalidQueryException.php new file mode 100644 index 00000000..ea660318 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Exception/InvalidQueryException.php @@ -0,0 +1,13 @@ +setFromArray($data); + } + } + + /** + * Offset exists + * + * @param string $name + * @return bool + */ + public function offsetExists($name) + { + return (isset($this->data[$name])); + } + + /** + * Offset get + * + * @param string $name + * @return mixed + */ + public function offsetGet($name) + { + return (isset($this->data[$name])) ? $this->data[$name] : null; + } + + /** + * @param $name + * @param $from + */ + public function offsetSetReference($name, $from) + { + $this->data[$name] =& $this->data[$from]; + } + + /** + * Offset set + * + * @param string|int $name + * @param mixed $value + * @param mixed $errata + * @param mixed $maxLength + * @throws Exception\InvalidArgumentException + */ + public function offsetSet($name, $value, $errata = null, $maxLength = null) + { + $position = false; + + // if integer, get name for this position + if (is_int($name)) { + if (isset($this->positions[$name])) { + $position = $name; + $name = $this->positions[$name]; + } else { + $name = (string) $name; + } + } elseif (is_string($name)) { + // is a string: + $position = array_key_exists($name, $this->data); + } elseif ($name === null) { + $name = (string) count($this->data); + } else { + throw new Exception\InvalidArgumentException('Keys must be string, integer or null'); + } + + if ($position === false) { + $this->positions[] = $name; + } + + $this->data[$name] = $value; + + if ($errata) { + $this->offsetSetErrata($name, $errata); + } + + if ($maxLength) { + $this->offsetSetMaxLength($name, $maxLength); + } + } + + /** + * Offset unset + * + * @param string $name + * @return self Provides a fluent interface + */ + public function offsetUnset($name) + { + if (is_int($name) && isset($this->positions[$name])) { + $name = $this->positions[$name]; + } + unset($this->data[$name]); + return $this; + } + + /** + * Set from array + * + * @param array $data + * @return self Provides a fluent interface + */ + public function setFromArray(array $data) + { + foreach ($data as $n => $v) { + $this->offsetSet($n, $v); + } + return $this; + } + + /** + * Offset set max length + * + * @param string|int $name + * @param mixed $maxLength + */ + public function offsetSetMaxLength($name, $maxLength) + { + if (is_int($name)) { + $name = $this->positions[$name]; + } + $this->maxLength[$name] = $maxLength; + } + + /** + * Offset get max length + * + * @param string|int $name + * @throws Exception\InvalidArgumentException + * @return mixed + */ + public function offsetGetMaxLength($name) + { + if (is_int($name)) { + $name = $this->positions[$name]; + } + if (! array_key_exists($name, $this->data)) { + throw new Exception\InvalidArgumentException('Data does not exist for this name/position'); + } + return $this->maxLength[$name]; + } + + /** + * Offset has max length + * + * @param string|int $name + * @return bool + */ + public function offsetHasMaxLength($name) + { + if (is_int($name)) { + $name = $this->positions[$name]; + } + return (isset($this->maxLength[$name])); + } + + /** + * Offset unset max length + * + * @param string|int $name + * @throws Exception\InvalidArgumentException + */ + public function offsetUnsetMaxLength($name) + { + if (is_int($name)) { + $name = $this->positions[$name]; + } + if (! array_key_exists($name, $this->maxLength)) { + throw new Exception\InvalidArgumentException('Data does not exist for this name/position'); + } + $this->maxLength[$name] = null; + } + + /** + * Get max length iterator + * + * @return \ArrayIterator + */ + public function getMaxLengthIterator() + { + return new \ArrayIterator($this->maxLength); + } + + /** + * Offset set errata + * + * @param string|int $name + * @param mixed $errata + */ + public function offsetSetErrata($name, $errata) + { + if (is_int($name)) { + $name = $this->positions[$name]; + } + $this->errata[$name] = $errata; + } + + /** + * Offset get errata + * + * @param string|int $name + * @throws Exception\InvalidArgumentException + * @return mixed + */ + public function offsetGetErrata($name) + { + if (is_int($name)) { + $name = $this->positions[$name]; + } + if (! array_key_exists($name, $this->data)) { + throw new Exception\InvalidArgumentException('Data does not exist for this name/position'); + } + return $this->errata[$name]; + } + + /** + * Offset has errata + * + * @param string|int $name + * @return bool + */ + public function offsetHasErrata($name) + { + if (is_int($name)) { + $name = $this->positions[$name]; + } + return (isset($this->errata[$name])); + } + + /** + * Offset unset errata + * + * @param string|int $name + * @throws Exception\InvalidArgumentException + */ + public function offsetUnsetErrata($name) + { + if (is_int($name)) { + $name = $this->positions[$name]; + } + if (! array_key_exists($name, $this->errata)) { + throw new Exception\InvalidArgumentException('Data does not exist for this name/position'); + } + $this->errata[$name] = null; + } + + /** + * Get errata iterator + * + * @return \ArrayIterator + */ + public function getErrataIterator() + { + return new \ArrayIterator($this->errata); + } + + /** + * getNamedArray + * + * @return array + */ + public function getNamedArray() + { + return $this->data; + } + + /** + * getNamedArray + * + * @return array + */ + public function getPositionalArray() + { + return array_values($this->data); + } + + /** + * count + * + * @return int + */ + public function count() + { + return count($this->data); + } + + /** + * Current + * + * @return mixed + */ + public function current() + { + return current($this->data); + } + + /** + * Next + * + * @return mixed + */ + public function next() + { + return next($this->data); + } + + /** + * Key + * + * @return mixed + */ + public function key() + { + return key($this->data); + } + + /** + * Valid + * + * @return bool + */ + public function valid() + { + return (current($this->data) !== false); + } + + /** + * Rewind + */ + public function rewind() + { + reset($this->data); + } + + /** + * @param array|ParameterContainer $parameters + * @return self Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function merge($parameters) + { + if (! is_array($parameters) && ! $parameters instanceof ParameterContainer) { + throw new Exception\InvalidArgumentException( + '$parameters must be an array or an instance of ParameterContainer' + ); + } + + if (count($parameters) == 0) { + return $this; + } + + if ($parameters instanceof ParameterContainer) { + $parameters = $parameters->getNamedArray(); + } + + foreach ($parameters as $key => $value) { + if (is_int($key)) { + $key = null; + } + $this->offsetSet($key, $value); + } + return $this; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Platform/AbstractPlatform.php b/bundled-libs/laminas/laminas-db/src/Adapter/Platform/AbstractPlatform.php new file mode 100644 index 00000000..46537206 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Platform/AbstractPlatform.php @@ -0,0 +1,141 @@ +quoteIdentifiers) { + return $identifier; + } + + $safeWordsInt = ['*' => true, ' ' => true, '.' => true, 'as' => true]; + + foreach ($safeWords as $sWord) { + $safeWordsInt[strtolower($sWord)] = true; + } + + $parts = preg_split( + $this->quoteIdentifierFragmentPattern, + $identifier, + -1, + PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY + ); + + $identifier = ''; + + foreach ($parts as $part) { + $identifier .= isset($safeWordsInt[strtolower($part)]) + ? $part + : $this->quoteIdentifier[0] + . str_replace($this->quoteIdentifier[0], $this->quoteIdentifierTo, $part) + . $this->quoteIdentifier[1]; + } + + return $identifier; + } + + /** + * {@inheritDoc} + */ + public function quoteIdentifier($identifier) + { + if (! $this->quoteIdentifiers) { + return $identifier; + } + + return $this->quoteIdentifier[0] + . str_replace($this->quoteIdentifier[0], $this->quoteIdentifierTo, $identifier) + . $this->quoteIdentifier[1]; + } + + /** + * {@inheritDoc} + */ + public function quoteIdentifierChain($identifierChain) + { + return '"' . implode('"."', (array) str_replace('"', '\\"', $identifierChain)) . '"'; + } + + /** + * {@inheritDoc} + */ + public function getQuoteIdentifierSymbol() + { + return $this->quoteIdentifier[0]; + } + + /** + * {@inheritDoc} + */ + public function getQuoteValueSymbol() + { + return '\''; + } + + /** + * {@inheritDoc} + */ + public function quoteValue($value) + { + trigger_error( + 'Attempting to quote a value in ' . get_class($this) . + ' without extension/driver support can introduce security vulnerabilities in a production environment' + ); + return '\'' . addcslashes((string) $value, "\x00\n\r\\'\"\x1a") . '\''; + } + + /** + * {@inheritDoc} + */ + public function quoteTrustedValue($value) + { + return '\'' . addcslashes((string) $value, "\x00\n\r\\'\"\x1a") . '\''; + } + + /** + * {@inheritDoc} + */ + public function quoteValueList($valueList) + { + return implode(', ', array_map([$this, 'quoteValue'], (array) $valueList)); + } + + /** + * {@inheritDoc} + */ + public function getIdentifierSeparator() + { + return '.'; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Platform/IbmDb2.php b/bundled-libs/laminas/laminas-db/src/Adapter/Platform/IbmDb2.php new file mode 100644 index 00000000..29734199 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Platform/IbmDb2.php @@ -0,0 +1,124 @@ +quoteIdentifiers = false; + } + + if (isset($options['identifier_separator'])) { + $this->identifierSeparator = $options['identifier_separator']; + } + } + + /** + * {@inheritDoc} + */ + public function getName() + { + return 'IBM DB2'; + } + + /** + * {@inheritDoc} + */ + public function quoteIdentifierInFragment($identifier, array $safeWords = []) + { + if (! $this->quoteIdentifiers) { + return $identifier; + } + $safeWordsInt = ['*' => true, ' ' => true, '.' => true, 'as' => true]; + foreach ($safeWords as $sWord) { + $safeWordsInt[strtolower($sWord)] = true; + } + $parts = preg_split( + '/([^0-9,a-z,A-Z$#_:])/i', + $identifier, + -1, + PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY + ); + $identifier = ''; + foreach ($parts as $part) { + $identifier .= isset($safeWordsInt[strtolower($part)]) + ? $part + : $this->quoteIdentifier[0] + . str_replace($this->quoteIdentifier[0], $this->quoteIdentifierTo, $part) + . $this->quoteIdentifier[1]; + } + return $identifier; + } + + /** + * {@inheritDoc} + */ + public function quoteIdentifierChain($identifierChain) + { + if ($this->quoteIdentifiers === false) { + if (is_array($identifierChain)) { + return implode($this->identifierSeparator, $identifierChain); + } else { + return $identifierChain; + } + } + $identifierChain = str_replace('"', '\\"', $identifierChain); + if (is_array($identifierChain)) { + $identifierChain = implode('"' . $this->identifierSeparator . '"', $identifierChain); + } + return '"' . $identifierChain . '"'; + } + + /** + * {@inheritDoc} + */ + public function quoteValue($value) + { + if (function_exists('db2_escape_string')) { + return '\'' . db2_escape_string($value) . '\''; + } + trigger_error( + 'Attempting to quote a value in ' . __CLASS__ . ' without extension/driver support ' + . 'can introduce security vulnerabilities in a production environment.' + ); + return '\'' . str_replace("'", "''", $value) . '\''; + } + + /** + * {@inheritDoc} + */ + public function quoteTrustedValue($value) + { + if (function_exists('db2_escape_string')) { + return '\'' . db2_escape_string($value) . '\''; + } + return '\'' . str_replace("'", "''", $value) . '\''; + } + + /** + * {@inheritDoc} + */ + public function getIdentifierSeparator() + { + return $this->identifierSeparator; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Platform/Mysql.php b/bundled-libs/laminas/laminas-db/src/Adapter/Platform/Mysql.php new file mode 100644 index 00000000..6f30ddce --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Platform/Mysql.php @@ -0,0 +1,129 @@ +setDriver($driver); + } + } + + /** + * @param \Laminas\Db\Adapter\Driver\Mysqli\Mysqli|\Laminas\Db\Adapter\Driver\Pdo\Pdo|\mysqli|\PDO $driver + * @return self Provides a fluent interface + * @throws \Laminas\Db\Adapter\Exception\InvalidArgumentException + */ + public function setDriver($driver) + { + // handle Laminas\Db drivers + if ($driver instanceof Mysqli\Mysqli + || ($driver instanceof Pdo\Pdo && $driver->getDatabasePlatformName() == 'Mysql') + || ($driver instanceof \mysqli) + || ($driver instanceof \PDO && $driver->getAttribute(\PDO::ATTR_DRIVER_NAME) == 'mysql') + ) { + $this->driver = $driver; + return $this; + } + + throw new Exception\InvalidArgumentException( + '$driver must be a Mysqli or Mysql PDO Laminas\Db\Adapter\Driver, Mysqli instance or MySQL PDO instance' + ); + } + + /** + * {@inheritDoc} + */ + public function getName() + { + return 'MySQL'; + } + + /** + * {@inheritDoc} + */ + public function quoteIdentifierChain($identifierChain) + { + return '`' . implode('`.`', (array) str_replace('`', '``', $identifierChain)) . '`'; + } + + /** + * {@inheritDoc} + */ + public function quoteValue($value) + { + $quotedViaDriverValue = $this->quoteViaDriver($value); + + return $quotedViaDriverValue !== null ? $quotedViaDriverValue : parent::quoteValue($value); + } + + /** + * {@inheritDoc} + */ + public function quoteTrustedValue($value) + { + $quotedViaDriverValue = $this->quoteViaDriver($value); + + return $quotedViaDriverValue !== null ? $quotedViaDriverValue : parent::quoteTrustedValue($value); + } + + /** + * @param string $value + * @return string|null + */ + protected function quoteViaDriver($value) + { + if ($this->driver instanceof DriverInterface) { + $resource = $this->driver->getConnection()->getResource(); + } else { + $resource = $this->driver; + } + + if ($resource instanceof \mysqli) { + return '\'' . $resource->real_escape_string($value) . '\''; + } + if ($resource instanceof \PDO) { + return $resource->quote($value); + } + + return null; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Platform/Oracle.php b/bundled-libs/laminas/laminas-db/src/Adapter/Platform/Oracle.php new file mode 100644 index 00000000..dd4dade9 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Platform/Oracle.php @@ -0,0 +1,130 @@ +quoteIdentifiers = false; + } + + if ($driver) { + $this->setDriver($driver); + } + } + + /** + * @param Pdo|Oci8 $driver + * @return self Provides a fluent interface + * @throws InvalidArgumentException + */ + public function setDriver($driver) + { + if ($driver instanceof Oci8 + || ($driver instanceof Pdo && $driver->getDatabasePlatformName() == 'Oracle') + || ($driver instanceof Pdo && $driver->getDatabasePlatformName() == 'Sqlite') + || ($driver instanceof \oci8) + || ($driver instanceof \PDO && $driver->getAttribute(\PDO::ATTR_DRIVER_NAME) == 'oci') + ) { + $this->resource = $driver; + return $this; + } + + throw new InvalidArgumentException( + '$driver must be a Oci8 or Oracle PDO Laminas\Db\Adapter\Driver, ' + . 'Oci8 instance, or Oci PDO instance' + ); + } + + /** + * @return null|Pdo|Oci8 + */ + public function getDriver() + { + return $this->resource; + } + + /** + * {@inheritDoc} + */ + public function getName() + { + return 'Oracle'; + } + + /** + * {@inheritDoc} + */ + public function quoteIdentifierChain($identifierChain) + { + if ($this->quoteIdentifiers === false) { + return implode('.', (array) $identifierChain); + } + + return '"' . implode('"."', (array) str_replace('"', '\\"', $identifierChain)) . '"'; + } + + /** + * {@inheritDoc} + */ + public function quoteValue($value) + { + if ($this->resource instanceof DriverInterface) { + $resource = $this->resource->getConnection()->getResource(); + } else { + $resource = $this->resource; + } + + if ($resource) { + if ($resource instanceof \PDO) { + return $resource->quote($value); + } + + if (get_resource_type($resource) == 'oci8 connection' + || get_resource_type($resource) == 'oci8 persistent connection' + ) { + return "'" . addcslashes(str_replace("'", "''", $value), "\x00\n\r\"\x1a") . "'"; + } + } + + trigger_error( + 'Attempting to quote a value in ' . __CLASS__ . ' without extension/driver support ' + . 'can introduce security vulnerabilities in a production environment.' + ); + + return "'" . addcslashes(str_replace("'", "''", $value), "\x00\n\r\"\x1a") . "'"; + } + + /** + * {@inheritDoc} + */ + public function quoteTrustedValue($value) + { + return "'" . addcslashes(str_replace('\'', '\'\'', $value), "\x00\n\r\"\x1a") . "'"; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Platform/PlatformInterface.php b/bundled-libs/laminas/laminas-db/src/Adapter/Platform/PlatformInterface.php new file mode 100644 index 00000000..7b504f43 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Platform/PlatformInterface.php @@ -0,0 +1,93 @@ +setDriver($driver); + } + } + + /** + * @param \Laminas\Db\Adapter\Driver\Pgsql\Pgsql|\Laminas\Db\Adapter\Driver\Pdo\Pdo|resource|\PDO $driver + * @return self Provides a fluent interface + * @throws \Laminas\Db\Adapter\Exception\InvalidArgumentException + */ + public function setDriver($driver) + { + if ($driver instanceof Pgsql\Pgsql + || ($driver instanceof Pdo\Pdo && $driver->getDatabasePlatformName() == 'Postgresql') + || (is_resource($driver) && (in_array(get_resource_type($driver), ['pgsql link', 'pgsql link persistent']))) + || ($driver instanceof \PDO && $driver->getAttribute(\PDO::ATTR_DRIVER_NAME) == 'pgsql') + ) { + $this->driver = $driver; + return $this; + } + + throw new Exception\InvalidArgumentException( + '$driver must be a Pgsql or Postgresql PDO Laminas\Db\Adapter\Driver, pgsql link resource' + . ' or Postgresql PDO instance' + ); + } + + /** + * {@inheritDoc} + */ + public function getName() + { + return 'PostgreSQL'; + } + + /** + * {@inheritDoc} + */ + public function quoteIdentifierChain($identifierChain) + { + return '"' . implode('"."', (array) str_replace('"', '""', $identifierChain)) . '"'; + } + + /** + * {@inheritDoc} + */ + public function quoteValue($value) + { + $quotedViaDriverValue = $this->quoteViaDriver($value); + + return $quotedViaDriverValue !== null ? $quotedViaDriverValue : ('E' . parent::quoteValue($value)); + } + + /** + * {@inheritDoc} + */ + public function quoteTrustedValue($value) + { + $quotedViaDriverValue = $this->quoteViaDriver($value); + + return $quotedViaDriverValue !== null ? $quotedViaDriverValue : ('E' . parent::quoteTrustedValue($value)); + } + + /** + * @param string $value + * @return string|null + */ + protected function quoteViaDriver($value) + { + if ($this->driver instanceof DriverInterface) { + $resource = $this->driver->getConnection()->getResource(); + } else { + $resource = $this->driver; + } + + if (is_resource($resource)) { + return '\'' . pg_escape_string($resource, $value) . '\''; + } + if ($resource instanceof \PDO) { + return $resource->quote($value); + } + + return null; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Platform/Sql92.php b/bundled-libs/laminas/laminas-db/src/Adapter/Platform/Sql92.php new file mode 100644 index 00000000..0bafe993 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Platform/Sql92.php @@ -0,0 +1,32 @@ +setDriver($driver); + } + } + + /** + * @param \Laminas\Db\Adapter\Driver\Sqlsrv\Sqlsrv|\Laminas\Db\Adapter\Driver\Pdo\Pdo|resource|\PDO $driver + * @return self Provides a fluent interface + * @throws \Laminas\Db\Adapter\Exception\InvalidArgumentException + */ + public function setDriver($driver) + { + // handle Laminas\Db drivers + if (($driver instanceof Pdo\Pdo && in_array($driver->getDatabasePlatformName(), ['SqlServer', 'Dblib'])) + || ($driver instanceof \PDO && in_array($driver->getAttribute(\PDO::ATTR_DRIVER_NAME), ['sqlsrv', 'dblib'])) + ) { + $this->resource = $driver; + return $this; + } + + throw new Exception\InvalidArgumentException( + '$driver must be a Sqlsrv PDO Laminas\Db\Adapter\Driver or Sqlsrv PDO instance' + ); + } + + /** + * {@inheritDoc} + */ + public function getName() + { + return 'SQLServer'; + } + + /** + * {@inheritDoc} + */ + public function getQuoteIdentifierSymbol() + { + return $this->quoteIdentifier; + } + + /** + * {@inheritDoc} + */ + public function quoteIdentifierChain($identifierChain) + { + return '[' . implode('].[', (array) $identifierChain) . ']'; + } + + /** + * {@inheritDoc} + */ + public function quoteValue($value) + { + $resource = $this->resource; + + if ($resource instanceof DriverInterface) { + $resource = $resource->getConnection()->getResource(); + } + if ($resource instanceof \PDO) { + return $resource->quote($value); + } + trigger_error( + 'Attempting to quote a value in ' . __CLASS__ . ' without extension/driver support ' + . 'can introduce security vulnerabilities in a production environment.' + ); + + return '\'' . str_replace('\'', '\'\'', addcslashes($value, "\000\032")) . '\''; + } + + /** + * {@inheritDoc} + */ + public function quoteTrustedValue($value) + { + $resource = $this->resource; + + if ($resource instanceof DriverInterface) { + $resource = $resource->getConnection()->getResource(); + } + if ($resource instanceof \PDO) { + return $resource->quote($value); + } + + return '\'' . str_replace('\'', '\'\'', $value) . '\''; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Platform/Sqlite.php b/bundled-libs/laminas/laminas-db/src/Adapter/Platform/Sqlite.php new file mode 100644 index 00000000..d079bf04 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Platform/Sqlite.php @@ -0,0 +1,104 @@ +setDriver($driver); + } + } + + /** + * @param \Laminas\Db\Adapter\Driver\Pdo\Pdo|\PDO $driver + * @return self Provides a fluent interface + * @throws \Laminas\Db\Adapter\Exception\InvalidArgumentException + */ + public function setDriver($driver) + { + if (($driver instanceof \PDO && $driver->getAttribute(\PDO::ATTR_DRIVER_NAME) == 'sqlite') + || ($driver instanceof Pdo\Pdo && $driver->getDatabasePlatformName() == 'Sqlite') + ) { + $this->resource = $driver; + return $this; + } + + throw new Exception\InvalidArgumentException( + '$driver must be a Sqlite PDO Laminas\Db\Adapter\Driver, Sqlite PDO instance' + ); + } + + /** + * {@inheritDoc} + */ + public function getName() + { + return 'SQLite'; + } + + /** + * {@inheritDoc} + */ + public function quoteValue($value) + { + $resource = $this->resource; + + if ($resource instanceof DriverInterface) { + $resource = $resource->getConnection()->getResource(); + } + + if ($resource instanceof \PDO) { + return $resource->quote($value); + } + + return parent::quoteValue($value); + } + + /** + * {@inheritDoc} + */ + public function quoteTrustedValue($value) + { + $resource = $this->resource; + + if ($resource instanceof DriverInterface) { + $resource = $resource->getConnection()->getResource(); + } + + if ($resource instanceof \PDO) { + return $resource->quote($value); + } + + return parent::quoteTrustedValue($value); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Profiler/Profiler.php b/bundled-libs/laminas/laminas-db/src/Adapter/Profiler/Profiler.php new file mode 100644 index 00000000..6447be10 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Profiler/Profiler.php @@ -0,0 +1,88 @@ + '', + 'parameters' => null, + 'start' => microtime(true), + 'end' => null, + 'elapse' => null + ]; + if ($target instanceof StatementContainerInterface) { + $profileInformation['sql'] = $target->getSql(); + $profileInformation['parameters'] = clone $target->getParameterContainer(); + } elseif (is_string($target)) { + $profileInformation['sql'] = $target; + } else { + throw new Exception\InvalidArgumentException( + __FUNCTION__ . ' takes either a StatementContainer or a string' + ); + } + + $this->profiles[$this->currentIndex] = $profileInformation; + + return $this; + } + + /** + * @return self Provides a fluent interface + */ + public function profilerFinish() + { + if (! isset($this->profiles[$this->currentIndex])) { + throw new Exception\RuntimeException( + 'A profile must be started before ' . __FUNCTION__ . ' can be called.' + ); + } + $current = &$this->profiles[$this->currentIndex]; + $current['end'] = microtime(true); + $current['elapse'] = $current['end'] - $current['start']; + $this->currentIndex++; + return $this; + } + + /** + * @return array|null + */ + public function getLastProfile() + { + return end($this->profiles); + } + + /** + * @return array + */ + public function getProfiles() + { + return $this->profiles; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/Profiler/ProfilerAwareInterface.php b/bundled-libs/laminas/laminas-db/src/Adapter/Profiler/ProfilerAwareInterface.php new file mode 100644 index 00000000..ce202864 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/Profiler/ProfilerAwareInterface.php @@ -0,0 +1,17 @@ +setSql($sql); + } + $this->parameterContainer = ($parameterContainer) ?: new ParameterContainer; + } + + /** + * @param $sql + * @return self Provides a fluent interface + */ + public function setSql($sql) + { + $this->sql = $sql; + return $this; + } + + /** + * @return string + */ + public function getSql() + { + return $this->sql; + } + + /** + * @param ParameterContainer $parameterContainer + * @return self Provides a fluent interface + */ + public function setParameterContainer(ParameterContainer $parameterContainer) + { + $this->parameterContainer = $parameterContainer; + return $this; + } + + /** + * @return null|ParameterContainer + */ + public function getParameterContainer() + { + return $this->parameterContainer; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Adapter/StatementContainerInterface.php b/bundled-libs/laminas/laminas-db/src/Adapter/StatementContainerInterface.php new file mode 100644 index 00000000..b11c186a --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Adapter/StatementContainerInterface.php @@ -0,0 +1,42 @@ + $this->getDependencyConfig(), + ]; + } + + /** + * Retrieve laminas-db default dependency configuration. + * + * @return array + */ + public function getDependencyConfig() + { + return [ + 'abstract_factories' => [ + Adapter\AdapterAbstractServiceFactory::class, + ], + 'factories' => [ + Adapter\AdapterInterface::class => Adapter\AdapterServiceFactory::class, + ], + 'aliases' => [ + Adapter\Adapter::class => Adapter\AdapterInterface::class, + + // Legacy Zend Framework aliases + \Zend\Db\Adapter\AdapterInterface::class => Adapter\AdapterInterface::class, + \Zend\Db\Adapter\Adapter::class => Adapter\Adapter::class, + ], + ]; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Exception/ErrorException.php b/bundled-libs/laminas/laminas-db/src/Exception/ErrorException.php new file mode 100644 index 00000000..d8daa59d --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Exception/ErrorException.php @@ -0,0 +1,13 @@ +source = Source\Factory::createSourceFromAdapter($adapter); + } + + /** + * {@inheritdoc} + */ + public function getTables($schema = null, $includeViews = false) + { + return $this->source->getTables($schema, $includeViews); + } + + /** + * {@inheritdoc} + */ + public function getViews($schema = null) + { + return $this->source->getViews($schema); + } + + /** + * {@inheritdoc} + */ + public function getTriggers($schema = null) + { + return $this->source->getTriggers($schema); + } + + /** + * {@inheritdoc} + */ + public function getConstraints($table, $schema = null) + { + return $this->source->getConstraints($table, $schema); + } + + /** + * {@inheritdoc} + */ + public function getColumns($table, $schema = null) + { + return $this->source->getColumns($table, $schema); + } + + /** + * {@inheritdoc} + */ + public function getConstraintKeys($constraint, $table, $schema = null) + { + return $this->source->getConstraintKeys($constraint, $table, $schema); + } + + /** + * {@inheritdoc} + */ + public function getConstraint($constraintName, $table, $schema = null) + { + return $this->source->getConstraint($constraintName, $table, $schema); + } + + /** + * {@inheritdoc} + */ + public function getSchemas() + { + return $this->source->getSchemas(); + } + + /** + * {@inheritdoc} + */ + public function getTableNames($schema = null, $includeViews = false) + { + return $this->source->getTableNames($schema, $includeViews); + } + + /** + * {@inheritdoc} + */ + public function getTable($tableName, $schema = null) + { + return $this->source->getTable($tableName, $schema); + } + + /** + * {@inheritdoc} + */ + public function getViewNames($schema = null) + { + return $this->source->getViewNames($schema); + } + + /** + * {@inheritdoc} + */ + public function getView($viewName, $schema = null) + { + return $this->source->getView($viewName, $schema); + } + + /** + * {@inheritdoc} + */ + public function getTriggerNames($schema = null) + { + return $this->source->getTriggerNames($schema); + } + + /** + * {@inheritdoc} + */ + public function getTrigger($triggerName, $schema = null) + { + return $this->source->getTrigger($triggerName, $schema); + } + + /** + * {@inheritdoc} + */ + public function getColumnNames($table, $schema = null) + { + return $this->source->getColumnNames($table, $schema); + } + + /** + * {@inheritdoc} + */ + public function getColumn($columnName, $table, $schema = null) + { + return $this->source->getColumn($columnName, $table, $schema); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Metadata/MetadataInterface.php b/bundled-libs/laminas/laminas-db/src/Metadata/MetadataInterface.php new file mode 100644 index 00000000..f1a493ff --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Metadata/MetadataInterface.php @@ -0,0 +1,153 @@ +setName($name); + } + } + + /** + * Set columns + * + * @param array $columns + */ + public function setColumns(array $columns) + { + $this->columns = $columns; + } + + /** + * Get columns + * + * @return array + */ + public function getColumns() + { + return $this->columns; + } + + /** + * Set constraints + * + * @param array $constraints + */ + public function setConstraints($constraints) + { + $this->constraints = $constraints; + } + + /** + * Get constraints + * + * @return array + */ + public function getConstraints() + { + return $this->constraints; + } + + /** + * Set name + * + * @param string $name + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * Get name + * + * @return string + */ + public function getName() + { + return $this->name; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Metadata/Object/ColumnObject.php b/bundled-libs/laminas/laminas-db/src/Metadata/Object/ColumnObject.php new file mode 100644 index 00000000..be630809 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Metadata/Object/ColumnObject.php @@ -0,0 +1,387 @@ +setName($name); + $this->setTableName($tableName); + $this->setSchemaName($schemaName); + } + + /** + * Set name + * + * @param string $name + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * Get name + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Get table name + * + * @return string + */ + public function getTableName() + { + return $this->tableName; + } + + /** + * Set table name + * + * @param string $tableName + * @return self Provides a fluent interface + */ + public function setTableName($tableName) + { + $this->tableName = $tableName; + return $this; + } + + /** + * Set schema name + * + * @param string $schemaName + */ + public function setSchemaName($schemaName) + { + $this->schemaName = $schemaName; + } + + /** + * Get schema name + * + * @return string + */ + public function getSchemaName() + { + return $this->schemaName; + } + + /** + * @return int $ordinalPosition + */ + public function getOrdinalPosition() + { + return $this->ordinalPosition; + } + + /** + * @param int $ordinalPosition to set + * @return self Provides a fluent interface + */ + public function setOrdinalPosition($ordinalPosition) + { + $this->ordinalPosition = $ordinalPosition; + return $this; + } + + /** + * @return null|string the $columnDefault + */ + public function getColumnDefault() + { + return $this->columnDefault; + } + + /** + * @param mixed $columnDefault to set + * @return self Provides a fluent interface + */ + public function setColumnDefault($columnDefault) + { + $this->columnDefault = $columnDefault; + return $this; + } + + /** + * @return bool $isNullable + */ + public function getIsNullable() + { + return $this->isNullable; + } + + /** + * @param bool $isNullable to set + * @return self Provides a fluent interface + */ + public function setIsNullable($isNullable) + { + $this->isNullable = $isNullable; + return $this; + } + + /** + * @return bool $isNullable + */ + public function isNullable() + { + return $this->isNullable; + } + + /** + * @return null|string the $dataType + */ + public function getDataType() + { + return $this->dataType; + } + + /** + * @param string $dataType the $dataType to set + * @return self Provides a fluent interface + */ + public function setDataType($dataType) + { + $this->dataType = $dataType; + return $this; + } + + /** + * @return int|null the $characterMaximumLength + */ + public function getCharacterMaximumLength() + { + return $this->characterMaximumLength; + } + + /** + * @param int $characterMaximumLength the $characterMaximumLength to set + * @return self Provides a fluent interface + */ + public function setCharacterMaximumLength($characterMaximumLength) + { + $this->characterMaximumLength = $characterMaximumLength; + return $this; + } + + /** + * @return int|null the $characterOctetLength + */ + public function getCharacterOctetLength() + { + return $this->characterOctetLength; + } + + /** + * @param int $characterOctetLength the $characterOctetLength to set + * @return self Provides a fluent interface + */ + public function setCharacterOctetLength($characterOctetLength) + { + $this->characterOctetLength = $characterOctetLength; + return $this; + } + + /** + * @return int the $numericPrecision + */ + public function getNumericPrecision() + { + return $this->numericPrecision; + } + + /** + * @param int $numericPrecision the $numericPrevision to set + * @return self Provides a fluent interface + */ + public function setNumericPrecision($numericPrecision) + { + $this->numericPrecision = $numericPrecision; + return $this; + } + + /** + * @return int the $numericScale + */ + public function getNumericScale() + { + return $this->numericScale; + } + + /** + * @param int $numericScale the $numericScale to set + * @return self Provides a fluent interface + */ + public function setNumericScale($numericScale) + { + $this->numericScale = $numericScale; + return $this; + } + + /** + * @return bool + */ + public function getNumericUnsigned() + { + return $this->numericUnsigned; + } + + /** + * @param bool $numericUnsigned + * @return self Provides a fluent interface + */ + public function setNumericUnsigned($numericUnsigned) + { + $this->numericUnsigned = $numericUnsigned; + return $this; + } + + /** + * @return bool + */ + public function isNumericUnsigned() + { + return $this->numericUnsigned; + } + + /** + * @return array the $errata + */ + public function getErratas() + { + return $this->errata; + } + + /** + * @param array $erratas + * @return self Provides a fluent interface + */ + public function setErratas(array $erratas) + { + foreach ($erratas as $name => $value) { + $this->setErrata($name, $value); + } + return $this; + } + + /** + * @param string $errataName + * @return mixed + */ + public function getErrata($errataName) + { + if (array_key_exists($errataName, $this->errata)) { + return $this->errata[$errataName]; + } + return; + } + + /** + * @param string $errataName + * @param mixed $errataValue + * @return self Provides a fluent interface + */ + public function setErrata($errataName, $errataValue) + { + $this->errata[$errataName] = $errataValue; + return $this; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Metadata/Object/ConstraintKeyObject.php b/bundled-libs/laminas/laminas-db/src/Metadata/Object/ConstraintKeyObject.php new file mode 100644 index 00000000..f3767be8 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Metadata/Object/ConstraintKeyObject.php @@ -0,0 +1,248 @@ +setColumnName($column); + } + + /** + * Get column name + * + * @return string + */ + public function getColumnName() + { + return $this->columnName; + } + + /** + * Set column name + * + * @param string $columnName + * @return self Provides a fluent interface + */ + public function setColumnName($columnName) + { + $this->columnName = $columnName; + return $this; + } + + /** + * Get ordinal position + * + * @return int + */ + public function getOrdinalPosition() + { + return $this->ordinalPosition; + } + + /** + * Set ordinal position + * + * @param int $ordinalPosition + * @return self Provides a fluent interface + */ + public function setOrdinalPosition($ordinalPosition) + { + $this->ordinalPosition = $ordinalPosition; + return $this; + } + + /** + * Get position in unique constraint + * + * @return bool + */ + public function getPositionInUniqueConstraint() + { + return $this->positionInUniqueConstraint; + } + + /** + * Set position in unique constraint + * + * @param bool $positionInUniqueConstraint + * @return self Provides a fluent interface + */ + public function setPositionInUniqueConstraint($positionInUniqueConstraint) + { + $this->positionInUniqueConstraint = $positionInUniqueConstraint; + return $this; + } + + /** + * Get referencred table schema + * + * @return string + */ + public function getReferencedTableSchema() + { + return $this->referencedTableSchema; + } + + /** + * Set referenced table schema + * + * @param string $referencedTableSchema + * @return self Provides a fluent interface + */ + public function setReferencedTableSchema($referencedTableSchema) + { + $this->referencedTableSchema = $referencedTableSchema; + return $this; + } + + /** + * Get referenced table name + * + * @return string + */ + public function getReferencedTableName() + { + return $this->referencedTableName; + } + + /** + * Set Referenced table name + * + * @param string $referencedTableName + * @return self Provides a fluent interface + */ + public function setReferencedTableName($referencedTableName) + { + $this->referencedTableName = $referencedTableName; + return $this; + } + + /** + * Get referenced column name + * + * @return string + */ + public function getReferencedColumnName() + { + return $this->referencedColumnName; + } + + /** + * Set referenced column name + * + * @param string $referencedColumnName + * @return self Provides a fluent interface + */ + public function setReferencedColumnName($referencedColumnName) + { + $this->referencedColumnName = $referencedColumnName; + return $this; + } + + /** + * set foreign key update rule + * + * @param string $foreignKeyUpdateRule + */ + public function setForeignKeyUpdateRule($foreignKeyUpdateRule) + { + $this->foreignKeyUpdateRule = $foreignKeyUpdateRule; + } + + /** + * Get foreign key update rule + * + * @return string + */ + public function getForeignKeyUpdateRule() + { + return $this->foreignKeyUpdateRule; + } + + /** + * Set foreign key delete rule + * + * @param string $foreignKeyDeleteRule + */ + public function setForeignKeyDeleteRule($foreignKeyDeleteRule) + { + $this->foreignKeyDeleteRule = $foreignKeyDeleteRule; + } + + /** + * get foreign key delete rule + * + * @return string + */ + public function getForeignKeyDeleteRule() + { + return $this->foreignKeyDeleteRule; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Metadata/Object/ConstraintObject.php b/bundled-libs/laminas/laminas-db/src/Metadata/Object/ConstraintObject.php new file mode 100644 index 00000000..86a1e31f --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Metadata/Object/ConstraintObject.php @@ -0,0 +1,410 @@ +setName($name); + $this->setTableName($tableName); + $this->setSchemaName($schemaName); + } + + /** + * Set name + * + * @param string $name + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * Get name + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set schema name + * + * @param string $schemaName + */ + public function setSchemaName($schemaName) + { + $this->schemaName = $schemaName; + } + + /** + * Get schema name + * + * @return string + */ + public function getSchemaName() + { + return $this->schemaName; + } + + /** + * Get table name + * + * @return string + */ + public function getTableName() + { + return $this->tableName; + } + + /** + * Set table name + * + * @param string $tableName + * @return self Provides a fluent interface + */ + public function setTableName($tableName) + { + $this->tableName = $tableName; + return $this; + } + + /** + * Set type + * + * @param string $type + */ + public function setType($type) + { + $this->type = $type; + } + + /** + * Get type + * + * @return string + */ + public function getType() + { + return $this->type; + } + + public function hasColumns() + { + return (! empty($this->columns)); + } + + /** + * Get Columns. + * + * @return string[] + */ + public function getColumns() + { + return $this->columns; + } + + /** + * Set Columns. + * + * @param string[] $columns + * @return self Provides a fluent interface + */ + public function setColumns(array $columns) + { + $this->columns = $columns; + return $this; + } + + /** + * Get Referenced Table Schema. + * + * @return string + */ + public function getReferencedTableSchema() + { + return $this->referencedTableSchema; + } + + /** + * Set Referenced Table Schema. + * + * @param string $referencedTableSchema + * @return self Provides a fluent interface + */ + public function setReferencedTableSchema($referencedTableSchema) + { + $this->referencedTableSchema = $referencedTableSchema; + return $this; + } + + /** + * Get Referenced Table Name. + * + * @return string + */ + public function getReferencedTableName() + { + return $this->referencedTableName; + } + + /** + * Set Referenced Table Name. + * + * @param string $referencedTableName + * @return self Provides a fluent interface + */ + public function setReferencedTableName($referencedTableName) + { + $this->referencedTableName = $referencedTableName; + return $this; + } + + /** + * Get Referenced Columns. + * + * @return string[] + */ + public function getReferencedColumns() + { + return $this->referencedColumns; + } + + /** + * Set Referenced Columns. + * + * @param string[] $referencedColumns + * @return self Provides a fluent interface + */ + public function setReferencedColumns(array $referencedColumns) + { + $this->referencedColumns = $referencedColumns; + return $this; + } + + /** + * Get Match Option. + * + * @return string + */ + public function getMatchOption() + { + return $this->matchOption; + } + + /** + * Set Match Option. + * + * @param string $matchOption + * @return self Provides a fluent interface + */ + public function setMatchOption($matchOption) + { + $this->matchOption = $matchOption; + return $this; + } + + /** + * Get Update Rule. + * + * @return string + */ + public function getUpdateRule() + { + return $this->updateRule; + } + + /** + * Set Update Rule. + * + * @param string $updateRule + * @return self Provides a fluent interface + */ + public function setUpdateRule($updateRule) + { + $this->updateRule = $updateRule; + return $this; + } + + /** + * Get Delete Rule. + * + * @return string + */ + public function getDeleteRule() + { + return $this->deleteRule; + } + + /** + * Set Delete Rule. + * + * @param string $deleteRule + * @return self Provides a fluent interface + */ + public function setDeleteRule($deleteRule) + { + $this->deleteRule = $deleteRule; + return $this; + } + + /** + * Get Check Clause. + * + * @return string + */ + public function getCheckClause() + { + return $this->checkClause; + } + + /** + * Set Check Clause. + * + * @param string $checkClause + * @return self Provides a fluent interface + */ + public function setCheckClause($checkClause) + { + $this->checkClause = $checkClause; + return $this; + } + + /** + * Is primary key + * + * @return bool + */ + public function isPrimaryKey() + { + return ('PRIMARY KEY' == $this->type); + } + + /** + * Is unique key + * + * @return bool + */ + public function isUnique() + { + return ('UNIQUE' == $this->type); + } + + /** + * Is foreign key + * + * @return bool + */ + public function isForeignKey() + { + return ('FOREIGN KEY' == $this->type); + } + + /** + * Is foreign key + * + * @return bool + */ + public function isCheck() + { + return ('CHECK' == $this->type); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Metadata/Object/TableObject.php b/bundled-libs/laminas/laminas-db/src/Metadata/Object/TableObject.php new file mode 100644 index 00000000..a4175c6c --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Metadata/Object/TableObject.php @@ -0,0 +1,13 @@ +name; + } + + /** + * Set Name. + * + * @param string $name + * @return self Provides a fluent interface + */ + public function setName($name) + { + $this->name = $name; + return $this; + } + + /** + * Get Event Manipulation. + * + * @return string + */ + public function getEventManipulation() + { + return $this->eventManipulation; + } + + /** + * Set Event Manipulation. + * + * @param string $eventManipulation + * @return self Provides a fluent interface + */ + public function setEventManipulation($eventManipulation) + { + $this->eventManipulation = $eventManipulation; + return $this; + } + + /** + * Get Event Object Catalog. + * + * @return string + */ + public function getEventObjectCatalog() + { + return $this->eventObjectCatalog; + } + + /** + * Set Event Object Catalog. + * + * @param string $eventObjectCatalog + * @return self Provides a fluent interface + */ + public function setEventObjectCatalog($eventObjectCatalog) + { + $this->eventObjectCatalog = $eventObjectCatalog; + return $this; + } + + /** + * Get Event Object Schema. + * + * @return string + */ + public function getEventObjectSchema() + { + return $this->eventObjectSchema; + } + + /** + * Set Event Object Schema. + * + * @param string $eventObjectSchema + * @return self Provides a fluent interface + */ + public function setEventObjectSchema($eventObjectSchema) + { + $this->eventObjectSchema = $eventObjectSchema; + return $this; + } + + /** + * Get Event Object Table. + * + * @return string + */ + public function getEventObjectTable() + { + return $this->eventObjectTable; + } + + /** + * Set Event Object Table. + * + * @param string $eventObjectTable + * @return self Provides a fluent interface + */ + public function setEventObjectTable($eventObjectTable) + { + $this->eventObjectTable = $eventObjectTable; + return $this; + } + + /** + * Get Action Order. + * + * @return string + */ + public function getActionOrder() + { + return $this->actionOrder; + } + + /** + * Set Action Order. + * + * @param string $actionOrder + * @return self Provides a fluent interface + */ + public function setActionOrder($actionOrder) + { + $this->actionOrder = $actionOrder; + return $this; + } + + /** + * Get Action Condition. + * + * @return string + */ + public function getActionCondition() + { + return $this->actionCondition; + } + + /** + * Set Action Condition. + * + * @param string $actionCondition + * @return self Provides a fluent interface + */ + public function setActionCondition($actionCondition) + { + $this->actionCondition = $actionCondition; + return $this; + } + + /** + * Get Action Statement. + * + * @return string + */ + public function getActionStatement() + { + return $this->actionStatement; + } + + /** + * Set Action Statement. + * + * @param string $actionStatement + * @return self Provides a fluent interface + */ + public function setActionStatement($actionStatement) + { + $this->actionStatement = $actionStatement; + return $this; + } + + /** + * Get Action Orientation. + * + * @return string + */ + public function getActionOrientation() + { + return $this->actionOrientation; + } + + /** + * Set Action Orientation. + * + * @param string $actionOrientation + * @return self Provides a fluent interface + */ + public function setActionOrientation($actionOrientation) + { + $this->actionOrientation = $actionOrientation; + return $this; + } + + /** + * Get Action Timing. + * + * @return string + */ + public function getActionTiming() + { + return $this->actionTiming; + } + + /** + * Set Action Timing. + * + * @param string $actionTiming + * @return self Provides a fluent interface + */ + public function setActionTiming($actionTiming) + { + $this->actionTiming = $actionTiming; + return $this; + } + + /** + * Get Action Reference Old Table. + * + * @return string + */ + public function getActionReferenceOldTable() + { + return $this->actionReferenceOldTable; + } + + /** + * Set Action Reference Old Table. + * + * @param string $actionReferenceOldTable + * @return self Provides a fluent interface + */ + public function setActionReferenceOldTable($actionReferenceOldTable) + { + $this->actionReferenceOldTable = $actionReferenceOldTable; + return $this; + } + + /** + * Get Action Reference New Table. + * + * @return string + */ + public function getActionReferenceNewTable() + { + return $this->actionReferenceNewTable; + } + + /** + * Set Action Reference New Table. + * + * @param string $actionReferenceNewTable + * @return self Provides a fluent interface + */ + public function setActionReferenceNewTable($actionReferenceNewTable) + { + $this->actionReferenceNewTable = $actionReferenceNewTable; + return $this; + } + + /** + * Get Action Reference Old Row. + * + * @return string + */ + public function getActionReferenceOldRow() + { + return $this->actionReferenceOldRow; + } + + /** + * Set Action Reference Old Row. + * + * @param string $actionReferenceOldRow + * @return self Provides a fluent interface + */ + public function setActionReferenceOldRow($actionReferenceOldRow) + { + $this->actionReferenceOldRow = $actionReferenceOldRow; + return $this; + } + + /** + * Get Action Reference New Row. + * + * @return string + */ + public function getActionReferenceNewRow() + { + return $this->actionReferenceNewRow; + } + + /** + * Set Action Reference New Row. + * + * @param string $actionReferenceNewRow + * @return self Provides a fluent interface + */ + public function setActionReferenceNewRow($actionReferenceNewRow) + { + $this->actionReferenceNewRow = $actionReferenceNewRow; + return $this; + } + + /** + * Get Created. + * + * @return \DateTime + */ + public function getCreated() + { + return $this->created; + } + + /** + * Set Created. + * + * @param \DateTime $created + * @return self Provides a fluent interface + */ + public function setCreated($created) + { + $this->created = $created; + return $this; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Metadata/Object/ViewObject.php b/bundled-libs/laminas/laminas-db/src/Metadata/Object/ViewObject.php new file mode 100644 index 00000000..de5779cd --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Metadata/Object/ViewObject.php @@ -0,0 +1,75 @@ +viewDefinition; + } + + /** + * @param string $viewDefinition to set + * @return self Provides a fluent interface + */ + public function setViewDefinition($viewDefinition) + { + $this->viewDefinition = $viewDefinition; + return $this; + } + + /** + * @return string $checkOption + */ + public function getCheckOption() + { + return $this->checkOption; + } + + /** + * @param string $checkOption to set + * @return self Provides a fluent interface + */ + public function setCheckOption($checkOption) + { + $this->checkOption = $checkOption; + return $this; + } + + /** + * @return bool $isUpdatable + */ + public function getIsUpdatable() + { + return $this->isUpdatable; + } + + /** + * @param bool $isUpdatable to set + * @return self Provides a fluent interface + */ + public function setIsUpdatable($isUpdatable) + { + $this->isUpdatable = $isUpdatable; + return $this; + } + + public function isUpdatable() + { + return $this->isUpdatable; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Metadata/Source/AbstractSource.php b/bundled-libs/laminas/laminas-db/src/Metadata/Source/AbstractSource.php new file mode 100644 index 00000000..b0a26e49 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Metadata/Source/AbstractSource.php @@ -0,0 +1,548 @@ +adapter = $adapter; + $this->defaultSchema = ($adapter->getCurrentSchema()) ?: self::DEFAULT_SCHEMA; + } + + /** + * Get schemas + * + */ + public function getSchemas() + { + $this->loadSchemaData(); + + return $this->data['schemas']; + } + + /** + * {@inheritdoc} + */ + public function getTableNames($schema = null, $includeViews = false) + { + if ($schema === null) { + $schema = $this->defaultSchema; + } + + $this->loadTableNameData($schema); + + if ($includeViews) { + return array_keys($this->data['table_names'][$schema]); + } + + $tableNames = []; + foreach ($this->data['table_names'][$schema] as $tableName => $data) { + if ('BASE TABLE' == $data['table_type']) { + $tableNames[] = $tableName; + } + } + return $tableNames; + } + + /** + * {@inheritdoc} + */ + public function getTables($schema = null, $includeViews = false) + { + if ($schema === null) { + $schema = $this->defaultSchema; + } + + $tables = []; + foreach ($this->getTableNames($schema, $includeViews) as $tableName) { + $tables[] = $this->getTable($tableName, $schema); + } + return $tables; + } + + /** + * {@inheritdoc} + */ + public function getTable($tableName, $schema = null) + { + if ($schema === null) { + $schema = $this->defaultSchema; + } + + $this->loadTableNameData($schema); + + if (! isset($this->data['table_names'][$schema][$tableName])) { + throw new \Exception('Table "' . $tableName . '" does not exist'); + } + + $data = $this->data['table_names'][$schema][$tableName]; + switch ($data['table_type']) { + case 'BASE TABLE': + $table = new TableObject($tableName); + break; + case 'VIEW': + $table = new ViewObject($tableName); + $table->setViewDefinition($data['view_definition']); + $table->setCheckOption($data['check_option']); + $table->setIsUpdatable($data['is_updatable']); + break; + default: + throw new \Exception( + 'Table "' . $tableName . '" is of an unsupported type "' . $data['table_type'] . '"' + ); + } + $table->setColumns($this->getColumns($tableName, $schema)); + $table->setConstraints($this->getConstraints($tableName, $schema)); + return $table; + } + + /** + * {@inheritdoc} + */ + public function getViewNames($schema = null) + { + if ($schema === null) { + $schema = $this->defaultSchema; + } + + $this->loadTableNameData($schema); + + $viewNames = []; + foreach ($this->data['table_names'][$schema] as $tableName => $data) { + if ('VIEW' == $data['table_type']) { + $viewNames[] = $tableName; + } + } + return $viewNames; + } + + /** + * {@inheritdoc} + */ + public function getViews($schema = null) + { + if ($schema === null) { + $schema = $this->defaultSchema; + } + + $views = []; + foreach ($this->getViewNames($schema) as $tableName) { + $views[] = $this->getTable($tableName, $schema); + } + return $views; + } + + /** + * {@inheritdoc} + */ + public function getView($viewName, $schema = null) + { + if ($schema === null) { + $schema = $this->defaultSchema; + } + + $this->loadTableNameData($schema); + + $tableNames = $this->data['table_names'][$schema]; + if (isset($tableNames[$viewName]) && 'VIEW' == $tableNames[$viewName]['table_type']) { + return $this->getTable($viewName, $schema); + } + throw new \Exception('View "' . $viewName . '" does not exist'); + } + + /** + * {@inheritdoc} + */ + public function getColumnNames($table, $schema = null) + { + if ($schema === null) { + $schema = $this->defaultSchema; + } + + $this->loadColumnData($table, $schema); + + if (! isset($this->data['columns'][$schema][$table])) { + throw new \Exception('"' . $table . '" does not exist'); + } + + return array_keys($this->data['columns'][$schema][$table]); + } + + /** + * {@inheritdoc} + */ + public function getColumns($table, $schema = null) + { + if ($schema === null) { + $schema = $this->defaultSchema; + } + + $this->loadColumnData($table, $schema); + + $columns = []; + foreach ($this->getColumnNames($table, $schema) as $columnName) { + $columns[] = $this->getColumn($columnName, $table, $schema); + } + return $columns; + } + + /** + * {@inheritdoc} + */ + public function getColumn($columnName, $table, $schema = null) + { + if ($schema === null) { + $schema = $this->defaultSchema; + } + + $this->loadColumnData($table, $schema); + + if (! isset($this->data['columns'][$schema][$table][$columnName])) { + throw new \Exception('A column by that name was not found.'); + } + + $info = $this->data['columns'][$schema][$table][$columnName]; + + $column = new ColumnObject($columnName, $table, $schema); + $props = [ + 'ordinal_position', 'column_default', 'is_nullable', + 'data_type', 'character_maximum_length', 'character_octet_length', + 'numeric_precision', 'numeric_scale', 'numeric_unsigned', + 'erratas' + ]; + foreach ($props as $prop) { + if (isset($info[$prop])) { + $column->{'set' . str_replace('_', '', $prop)}($info[$prop]); + } + } + + $column->setOrdinalPosition($info['ordinal_position']); + $column->setColumnDefault($info['column_default']); + $column->setIsNullable($info['is_nullable']); + $column->setDataType($info['data_type']); + $column->setCharacterMaximumLength($info['character_maximum_length']); + $column->setCharacterOctetLength($info['character_octet_length']); + $column->setNumericPrecision($info['numeric_precision']); + $column->setNumericScale($info['numeric_scale']); + $column->setNumericUnsigned($info['numeric_unsigned']); + $column->setErratas($info['erratas']); + + return $column; + } + + /** + * {@inheritdoc} + */ + public function getConstraints($table, $schema = null) + { + if ($schema === null) { + $schema = $this->defaultSchema; + } + + $this->loadConstraintData($table, $schema); + + $constraints = []; + foreach (array_keys($this->data['constraints'][$schema][$table]) as $constraintName) { + $constraints[] = $this->getConstraint($constraintName, $table, $schema); + } + + return $constraints; + } + + /** + * {@inheritdoc} + */ + public function getConstraint($constraintName, $table, $schema = null) + { + if ($schema === null) { + $schema = $this->defaultSchema; + } + + $this->loadConstraintData($table, $schema); + + if (! isset($this->data['constraints'][$schema][$table][$constraintName])) { + throw new \Exception('Cannot find a constraint by that name in this table'); + } + + $info = $this->data['constraints'][$schema][$table][$constraintName]; + $constraint = new ConstraintObject($constraintName, $table, $schema); + + foreach ([ + 'constraint_type' => 'setType', + 'match_option' => 'setMatchOption', + 'update_rule' => 'setUpdateRule', + 'delete_rule' => 'setDeleteRule', + 'columns' => 'setColumns', + 'referenced_table_schema' => 'setReferencedTableSchema', + 'referenced_table_name' => 'setReferencedTableName', + 'referenced_columns' => 'setReferencedColumns', + 'check_clause' => 'setCheckClause', + ] as $key => $setMethod) { + if (isset($info[$key])) { + $constraint->{$setMethod}($info[$key]); + } + } + + return $constraint; + } + + /** + * {@inheritdoc} + */ + public function getConstraintKeys($constraint, $table, $schema = null) + { + if ($schema === null) { + $schema = $this->defaultSchema; + } + + $this->loadConstraintReferences($table, $schema); + + // organize references first + $references = []; + foreach ($this->data['constraint_references'][$schema] as $refKeyInfo) { + if ($refKeyInfo['constraint_name'] == $constraint) { + $references[$refKeyInfo['constraint_name']] = $refKeyInfo; + } + } + + $this->loadConstraintDataKeys($schema); + + $keys = []; + foreach ($this->data['constraint_keys'][$schema] as $constraintKeyInfo) { + if ($constraintKeyInfo['table_name'] == $table && $constraintKeyInfo['constraint_name'] === $constraint) { + $keys[] = $key = new ConstraintKeyObject($constraintKeyInfo['column_name']); + $key->setOrdinalPosition($constraintKeyInfo['ordinal_position']); + if (isset($references[$constraint])) { + //$key->setReferencedTableSchema($constraintKeyInfo['referenced_table_schema']); + $key->setForeignKeyUpdateRule($references[$constraint]['update_rule']); + $key->setForeignKeyDeleteRule($references[$constraint]['delete_rule']); + //$key->setReferencedTableSchema($references[$constraint]['referenced_table_schema']); + $key->setReferencedTableName($references[$constraint]['referenced_table_name']); + $key->setReferencedColumnName($references[$constraint]['referenced_column_name']); + } + } + } + + return $keys; + } + + /** + * {@inheritdoc} + */ + public function getTriggerNames($schema = null) + { + if ($schema === null) { + $schema = $this->defaultSchema; + } + + $this->loadTriggerData($schema); + + return array_keys($this->data['triggers'][$schema]); + } + + /** + * {@inheritdoc} + */ + public function getTriggers($schema = null) + { + if ($schema === null) { + $schema = $this->defaultSchema; + } + + $triggers = []; + foreach ($this->getTriggerNames($schema) as $triggerName) { + $triggers[] = $this->getTrigger($triggerName, $schema); + } + return $triggers; + } + + /** + * {@inheritdoc} + */ + public function getTrigger($triggerName, $schema = null) + { + if ($schema === null) { + $schema = $this->defaultSchema; + } + + $this->loadTriggerData($schema); + + if (! isset($this->data['triggers'][$schema][$triggerName])) { + throw new \Exception('Trigger "' . $triggerName . '" does not exist'); + } + + $info = $this->data['triggers'][$schema][$triggerName]; + + $trigger = new TriggerObject(); + + $trigger->setName($triggerName); + $trigger->setEventManipulation($info['event_manipulation']); + $trigger->setEventObjectCatalog($info['event_object_catalog']); + $trigger->setEventObjectSchema($info['event_object_schema']); + $trigger->setEventObjectTable($info['event_object_table']); + $trigger->setActionOrder($info['action_order']); + $trigger->setActionCondition($info['action_condition']); + $trigger->setActionStatement($info['action_statement']); + $trigger->setActionOrientation($info['action_orientation']); + $trigger->setActionTiming($info['action_timing']); + $trigger->setActionReferenceOldTable($info['action_reference_old_table']); + $trigger->setActionReferenceNewTable($info['action_reference_new_table']); + $trigger->setActionReferenceOldRow($info['action_reference_old_row']); + $trigger->setActionReferenceNewRow($info['action_reference_new_row']); + $trigger->setCreated($info['created']); + + return $trigger; + } + + /** + * Prepare data hierarchy + * + * @param string $type + * @param string $key ... + */ + protected function prepareDataHierarchy($type) + { + $data = &$this->data; + foreach (func_get_args() as $key) { + if (! isset($data[$key])) { + $data[$key] = []; + } + $data = &$data[$key]; + } + } + + /** + * Load schema data + */ + protected function loadSchemaData() + { + } + + /** + * Load table name data + * + * @param string $schema + */ + protected function loadTableNameData($schema) + { + if (isset($this->data['table_names'][$schema])) { + return; + } + + $this->prepareDataHierarchy('table_names', $schema); + } + + /** + * Load column data + * + * @param string $table + * @param string $schema + */ + protected function loadColumnData($table, $schema) + { + if (isset($this->data['columns'][$schema][$table])) { + return; + } + + $this->prepareDataHierarchy('columns', $schema, $table); + } + + /** + * Load constraint data + * + * @param string $table + * @param string $schema + */ + protected function loadConstraintData($table, $schema) + { + if (isset($this->data['constraints'][$schema])) { + return; + } + + $this->prepareDataHierarchy('constraints', $schema); + } + + /** + * Load constraint data keys + * + * @param string $schema + */ + protected function loadConstraintDataKeys($schema) + { + if (isset($this->data['constraint_keys'][$schema])) { + return; + } + + $this->prepareDataHierarchy('constraint_keys', $schema); + } + + /** + * Load constraint references + * + * @param string $table + * @param string $schema + */ + protected function loadConstraintReferences($table, $schema) + { + if (isset($this->data['constraint_references'][$schema])) { + return; + } + + $this->prepareDataHierarchy('constraint_references', $schema); + } + + /** + * Load trigger data + * + * @param string $schema + */ + protected function loadTriggerData($schema) + { + if (isset($this->data['triggers'][$schema])) { + return; + } + + $this->prepareDataHierarchy('triggers', $schema); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Metadata/Source/Factory.php b/bundled-libs/laminas/laminas-db/src/Metadata/Source/Factory.php new file mode 100644 index 00000000..eea545fa --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Metadata/Source/Factory.php @@ -0,0 +1,46 @@ +getPlatform()->getName(); + + switch ($platformName) { + case 'MySQL': + return new MysqlMetadata($adapter); + case 'SQLServer': + return new SqlServerMetadata($adapter); + case 'SQLite': + return new SqliteMetadata($adapter); + case 'PostgreSQL': + return new PostgresqlMetadata($adapter); + case 'Oracle': + return new OracleMetadata($adapter); + default: + throw new InvalidArgumentException("Unknown adapter platform '{$platformName}'"); + } + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Metadata/Source/MysqlMetadata.php b/bundled-libs/laminas/laminas-db/src/Metadata/Source/MysqlMetadata.php new file mode 100644 index 00000000..fc462e82 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Metadata/Source/MysqlMetadata.php @@ -0,0 +1,502 @@ +data['schemas'])) { + return; + } + $this->prepareDataHierarchy('schemas'); + + $p = $this->adapter->getPlatform(); + + $sql = 'SELECT ' . $p->quoteIdentifier('SCHEMA_NAME') + . ' FROM ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'SCHEMATA']) + . ' WHERE ' . $p->quoteIdentifier('SCHEMA_NAME') + . ' != \'INFORMATION_SCHEMA\''; + + $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); + + $schemas = []; + foreach ($results->toArray() as $row) { + $schemas[] = $row['SCHEMA_NAME']; + } + + $this->data['schemas'] = $schemas; + } + + protected function loadTableNameData($schema) + { + if (isset($this->data['table_names'][$schema])) { + return; + } + $this->prepareDataHierarchy('table_names', $schema); + + $p = $this->adapter->getPlatform(); + + $isColumns = [ + ['T', 'TABLE_NAME'], + ['T', 'TABLE_TYPE'], + ['V', 'VIEW_DEFINITION'], + ['V', 'CHECK_OPTION'], + ['V', 'IS_UPDATABLE'], + ]; + + array_walk($isColumns, function (&$c) use ($p) { + $c = $p->quoteIdentifierChain($c); + }); + + $sql = 'SELECT ' . implode(', ', $isColumns) + . ' FROM ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TABLES']) . 'T' + + . ' LEFT JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'VIEWS']) . ' V' + . ' ON ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' = ' . $p->quoteIdentifierChain(['V', 'TABLE_SCHEMA']) + . ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_NAME']) + . ' = ' . $p->quoteIdentifierChain(['V', 'TABLE_NAME']) + + . ' WHERE ' . $p->quoteIdentifierChain(['T', 'TABLE_TYPE']) + . ' IN (\'BASE TABLE\', \'VIEW\')'; + + if ($schema != self::DEFAULT_SCHEMA) { + $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' = ' . $p->quoteTrustedValue($schema); + } else { + $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' != \'INFORMATION_SCHEMA\''; + } + + $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); + + $tables = []; + foreach ($results->toArray() as $row) { + $tables[$row['TABLE_NAME']] = [ + 'table_type' => $row['TABLE_TYPE'], + 'view_definition' => $row['VIEW_DEFINITION'], + 'check_option' => $row['CHECK_OPTION'], + 'is_updatable' => ('YES' == $row['IS_UPDATABLE']), + ]; + } + + $this->data['table_names'][$schema] = $tables; + } + + protected function loadColumnData($table, $schema) + { + if (isset($this->data['columns'][$schema][$table])) { + return; + } + $this->prepareDataHierarchy('columns', $schema, $table); + $p = $this->adapter->getPlatform(); + + $isColumns = [ + ['C', 'ORDINAL_POSITION'], + ['C', 'COLUMN_DEFAULT'], + ['C', 'IS_NULLABLE'], + ['C', 'DATA_TYPE'], + ['C', 'CHARACTER_MAXIMUM_LENGTH'], + ['C', 'CHARACTER_OCTET_LENGTH'], + ['C', 'NUMERIC_PRECISION'], + ['C', 'NUMERIC_SCALE'], + ['C', 'COLUMN_NAME'], + ['C', 'COLUMN_TYPE'], + ]; + + array_walk($isColumns, function (&$c) use ($p) { + $c = $p->quoteIdentifierChain($c); + }); + + $sql = 'SELECT ' . implode(', ', $isColumns) + . ' FROM ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TABLES']) . 'T' + . ' INNER JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'COLUMNS']) . 'C' + . ' ON ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' = ' . $p->quoteIdentifierChain(['C', 'TABLE_SCHEMA']) + . ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_NAME']) + . ' = ' . $p->quoteIdentifierChain(['C', 'TABLE_NAME']) + . ' WHERE ' . $p->quoteIdentifierChain(['T', 'TABLE_TYPE']) + . ' IN (\'BASE TABLE\', \'VIEW\')' + . ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_NAME']) + . ' = ' . $p->quoteTrustedValue($table); + + if ($schema != self::DEFAULT_SCHEMA) { + $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' = ' . $p->quoteTrustedValue($schema); + } else { + $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' != \'INFORMATION_SCHEMA\''; + } + + $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); + $columns = []; + foreach ($results->toArray() as $row) { + $erratas = []; + $matches = []; + if (preg_match('/^(?:enum|set)\((.+)\)$/i', $row['COLUMN_TYPE'], $matches)) { + $permittedValues = $matches[1]; + if (preg_match_all( + "/\\s*'((?:[^']++|'')*+)'\\s*(?:,|\$)/", + $permittedValues, + $matches, + PREG_PATTERN_ORDER + ) + ) { + $permittedValues = str_replace("''", "'", $matches[1]); + } else { + $permittedValues = [$permittedValues]; + } + $erratas['permitted_values'] = $permittedValues; + } + $columns[$row['COLUMN_NAME']] = [ + 'ordinal_position' => $row['ORDINAL_POSITION'], + 'column_default' => $row['COLUMN_DEFAULT'], + 'is_nullable' => ('YES' == $row['IS_NULLABLE']), + 'data_type' => $row['DATA_TYPE'], + 'character_maximum_length' => $row['CHARACTER_MAXIMUM_LENGTH'], + 'character_octet_length' => $row['CHARACTER_OCTET_LENGTH'], + 'numeric_precision' => $row['NUMERIC_PRECISION'], + 'numeric_scale' => $row['NUMERIC_SCALE'], + 'numeric_unsigned' => (false !== strpos($row['COLUMN_TYPE'], 'unsigned')), + 'erratas' => $erratas, + ]; + } + + $this->data['columns'][$schema][$table] = $columns; + } + + protected function loadConstraintData($table, $schema) + { + if (isset($this->data['constraints'][$schema][$table])) { + return; + } + + $this->prepareDataHierarchy('constraints', $schema, $table); + + $isColumns = [ + ['T', 'TABLE_NAME'], + ['TC', 'CONSTRAINT_NAME'], + ['TC', 'CONSTRAINT_TYPE'], + ['KCU', 'COLUMN_NAME'], + ['RC', 'MATCH_OPTION'], + ['RC', 'UPDATE_RULE'], + ['RC', 'DELETE_RULE'], + ['KCU', 'REFERENCED_TABLE_SCHEMA'], + ['KCU', 'REFERENCED_TABLE_NAME'], + ['KCU', 'REFERENCED_COLUMN_NAME'], + ]; + + $p = $this->adapter->getPlatform(); + + array_walk($isColumns, function (&$c) use ($p) { + $c = $p->quoteIdentifierChain($c); + }); + + $sql = 'SELECT ' . implode(', ', $isColumns) + . ' FROM ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TABLES']) . ' T' + + . ' INNER JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TABLE_CONSTRAINTS']) . ' TC' + . ' ON ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' = ' . $p->quoteIdentifierChain(['TC', 'TABLE_SCHEMA']) + . ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_NAME']) + . ' = ' . $p->quoteIdentifierChain(['TC', 'TABLE_NAME']) + + . ' LEFT JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'KEY_COLUMN_USAGE']) . ' KCU' + . ' ON ' . $p->quoteIdentifierChain(['TC', 'TABLE_SCHEMA']) + . ' = ' . $p->quoteIdentifierChain(['KCU', 'TABLE_SCHEMA']) + . ' AND ' . $p->quoteIdentifierChain(['TC', 'TABLE_NAME']) + . ' = ' . $p->quoteIdentifierChain(['KCU', 'TABLE_NAME']) + . ' AND ' . $p->quoteIdentifierChain(['TC', 'CONSTRAINT_NAME']) + . ' = ' . $p->quoteIdentifierChain(['KCU', 'CONSTRAINT_NAME']) + + . ' LEFT JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'REFERENTIAL_CONSTRAINTS']) . ' RC' + . ' ON ' . $p->quoteIdentifierChain(['TC', 'CONSTRAINT_SCHEMA']) + . ' = ' . $p->quoteIdentifierChain(['RC', 'CONSTRAINT_SCHEMA']) + . ' AND ' . $p->quoteIdentifierChain(['TC', 'CONSTRAINT_NAME']) + . ' = ' . $p->quoteIdentifierChain(['RC', 'CONSTRAINT_NAME']) + + . ' WHERE ' . $p->quoteIdentifierChain(['T', 'TABLE_NAME']) + . ' = ' . $p->quoteTrustedValue($table) + . ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_TYPE']) + . ' IN (\'BASE TABLE\', \'VIEW\')'; + + if ($schema != self::DEFAULT_SCHEMA) { + $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' = ' . $p->quoteTrustedValue($schema); + } else { + $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' != \'INFORMATION_SCHEMA\''; + } + + $sql .= ' ORDER BY CASE ' . $p->quoteIdentifierChain(['TC', 'CONSTRAINT_TYPE']) + . " WHEN 'PRIMARY KEY' THEN 1" + . " WHEN 'UNIQUE' THEN 2" + . " WHEN 'FOREIGN KEY' THEN 3" + . " ELSE 4 END" + + . ', ' . $p->quoteIdentifierChain(['TC', 'CONSTRAINT_NAME']) + . ', ' . $p->quoteIdentifierChain(['KCU', 'ORDINAL_POSITION']); + + $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); + + $realName = null; + $constraints = []; + foreach ($results->toArray() as $row) { + if ($row['CONSTRAINT_NAME'] !== $realName) { + $realName = $row['CONSTRAINT_NAME']; + $isFK = ('FOREIGN KEY' == $row['CONSTRAINT_TYPE']); + if ($isFK) { + $name = $realName; + } else { + $name = '_laminas_' . $row['TABLE_NAME'] . '_' . $realName; + } + $constraints[$name] = [ + 'constraint_name' => $name, + 'constraint_type' => $row['CONSTRAINT_TYPE'], + 'table_name' => $row['TABLE_NAME'], + 'columns' => [], + ]; + if ($isFK) { + $constraints[$name]['referenced_table_schema'] = $row['REFERENCED_TABLE_SCHEMA']; + $constraints[$name]['referenced_table_name'] = $row['REFERENCED_TABLE_NAME']; + $constraints[$name]['referenced_columns'] = []; + $constraints[$name]['match_option'] = $row['MATCH_OPTION']; + $constraints[$name]['update_rule'] = $row['UPDATE_RULE']; + $constraints[$name]['delete_rule'] = $row['DELETE_RULE']; + } + } + $constraints[$name]['columns'][] = $row['COLUMN_NAME']; + if ($isFK) { + $constraints[$name]['referenced_columns'][] = $row['REFERENCED_COLUMN_NAME']; + } + } + + $this->data['constraints'][$schema][$table] = $constraints; + } + + protected function loadConstraintDataNames($schema) + { + if (isset($this->data['constraint_names'][$schema])) { + return; + } + + $this->prepareDataHierarchy('constraint_names', $schema); + + $p = $this->adapter->getPlatform(); + + $isColumns = [ + ['TC', 'TABLE_NAME'], + ['TC', 'CONSTRAINT_NAME'], + ['TC', 'CONSTRAINT_TYPE'], + ]; + + array_walk($isColumns, function (&$c) use ($p) { + $c = $p->quoteIdentifierChain($c); + }); + + $sql = 'SELECT ' . implode(', ', $isColumns) + . ' FROM ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TABLES']) . 'T' + . ' INNER JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TABLE_CONSTRAINTS']) . 'TC' + . ' ON ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' = ' . $p->quoteIdentifierChain(['TC', 'TABLE_SCHEMA']) + . ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_NAME']) + . ' = ' . $p->quoteIdentifierChain(['TC', 'TABLE_NAME']) + . ' WHERE ' . $p->quoteIdentifierChain(['T', 'TABLE_TYPE']) + . ' IN (\'BASE TABLE\', \'VIEW\')'; + + if ($schema != self::DEFAULT_SCHEMA) { + $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' = ' . $p->quoteTrustedValue($schema); + } else { + $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' != \'INFORMATION_SCHEMA\''; + } + + $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); + + $data = []; + foreach ($results->toArray() as $row) { + $data[] = array_change_key_case($row, CASE_LOWER); + } + + $this->data['constraint_names'][$schema] = $data; + } + + protected function loadConstraintDataKeys($schema) + { + if (isset($this->data['constraint_keys'][$schema])) { + return; + } + + $this->prepareDataHierarchy('constraint_keys', $schema); + + $p = $this->adapter->getPlatform(); + + $isColumns = [ + ['T', 'TABLE_NAME'], + ['KCU', 'CONSTRAINT_NAME'], + ['KCU', 'COLUMN_NAME'], + ['KCU', 'ORDINAL_POSITION'], + ]; + + array_walk($isColumns, function (&$c) use ($p) { + $c = $p->quoteIdentifierChain($c); + }); + + $sql = 'SELECT ' . implode(', ', $isColumns) + . ' FROM ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TABLES']) . 'T' + + . ' INNER JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'KEY_COLUMN_USAGE']) . 'KCU' + . ' ON ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' = ' . $p->quoteIdentifierChain(['KCU', 'TABLE_SCHEMA']) + . ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_NAME']) + . ' = ' . $p->quoteIdentifierChain(['KCU', 'TABLE_NAME']) + + . ' WHERE ' . $p->quoteIdentifierChain(['T', 'TABLE_TYPE']) + . ' IN (\'BASE TABLE\', \'VIEW\')'; + + if ($schema != self::DEFAULT_SCHEMA) { + $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' = ' . $p->quoteTrustedValue($schema); + } else { + $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' != \'INFORMATION_SCHEMA\''; + } + + $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); + + $data = []; + foreach ($results->toArray() as $row) { + $data[] = array_change_key_case($row, CASE_LOWER); + } + + $this->data['constraint_keys'][$schema] = $data; + } + + protected function loadConstraintReferences($table, $schema) + { + parent::loadConstraintReferences($table, $schema); + + $p = $this->adapter->getPlatform(); + + $isColumns = [ + ['RC', 'TABLE_NAME'], + ['RC', 'CONSTRAINT_NAME'], + ['RC', 'UPDATE_RULE'], + ['RC', 'DELETE_RULE'], + ['KCU', 'REFERENCED_TABLE_SCHEMA'], + ['KCU', 'REFERENCED_TABLE_NAME'], + ['KCU', 'REFERENCED_COLUMN_NAME'], + ]; + + array_walk($isColumns, function (&$c) use ($p) { + $c = $p->quoteIdentifierChain($c); + }); + + $sql = 'SELECT ' . implode(', ', $isColumns) + . 'FROM ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TABLES']) . 'T' + + . ' INNER JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'REFERENTIAL_CONSTRAINTS']) . 'RC' + . ' ON ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' = ' . $p->quoteIdentifierChain(['RC', 'CONSTRAINT_SCHEMA']) + . ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_NAME']) + . ' = ' . $p->quoteIdentifierChain(['RC', 'TABLE_NAME']) + + . ' INNER JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'KEY_COLUMN_USAGE']) . 'KCU' + . ' ON ' . $p->quoteIdentifierChain(['RC', 'CONSTRAINT_SCHEMA']) + . ' = ' . $p->quoteIdentifierChain(['KCU', 'TABLE_SCHEMA']) + . ' AND ' . $p->quoteIdentifierChain(['RC', 'TABLE_NAME']) + . ' = ' . $p->quoteIdentifierChain(['KCU', 'TABLE_NAME']) + . ' AND ' . $p->quoteIdentifierChain(['RC', 'CONSTRAINT_NAME']) + . ' = ' . $p->quoteIdentifierChain(['KCU', 'CONSTRAINT_NAME']) + + . 'WHERE ' . $p->quoteIdentifierChain(['T', 'TABLE_TYPE']) + . ' IN (\'BASE TABLE\', \'VIEW\')'; + + if ($schema != self::DEFAULT_SCHEMA) { + $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' = ' . $p->quoteTrustedValue($schema); + } else { + $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' != \'INFORMATION_SCHEMA\''; + } + + $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); + + $data = []; + foreach ($results->toArray() as $row) { + $data[] = array_change_key_case($row, CASE_LOWER); + } + + $this->data['constraint_references'][$schema] = $data; + } + + protected function loadTriggerData($schema) + { + if (isset($this->data['triggers'][$schema])) { + return; + } + + $this->prepareDataHierarchy('triggers', $schema); + + $p = $this->adapter->getPlatform(); + + $isColumns = [ +// 'TRIGGER_CATALOG', +// 'TRIGGER_SCHEMA', + 'TRIGGER_NAME', + 'EVENT_MANIPULATION', + 'EVENT_OBJECT_CATALOG', + 'EVENT_OBJECT_SCHEMA', + 'EVENT_OBJECT_TABLE', + 'ACTION_ORDER', + 'ACTION_CONDITION', + 'ACTION_STATEMENT', + 'ACTION_ORIENTATION', + 'ACTION_TIMING', + 'ACTION_REFERENCE_OLD_TABLE', + 'ACTION_REFERENCE_NEW_TABLE', + 'ACTION_REFERENCE_OLD_ROW', + 'ACTION_REFERENCE_NEW_ROW', + 'CREATED', + ]; + + array_walk($isColumns, function (&$c) use ($p) { + $c = $p->quoteIdentifier($c); + }); + + $sql = 'SELECT ' . implode(', ', $isColumns) + . ' FROM ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TRIGGERS']) + . ' WHERE '; + + if ($schema != self::DEFAULT_SCHEMA) { + $sql .= $p->quoteIdentifier('TRIGGER_SCHEMA') + . ' = ' . $p->quoteTrustedValue($schema); + } else { + $sql .= $p->quoteIdentifier('TRIGGER_SCHEMA') + . ' != \'INFORMATION_SCHEMA\''; + } + + $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); + + $data = []; + foreach ($results->toArray() as $row) { + $row = array_change_key_case($row, CASE_LOWER); + if (null !== $row['created']) { + $row['created'] = new \DateTime($row['created']); + } + $data[$row['trigger_name']] = $row; + } + + $this->data['triggers'][$schema] = $data; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Metadata/Source/OracleMetadata.php b/bundled-libs/laminas/laminas-db/src/Metadata/Source/OracleMetadata.php new file mode 100644 index 00000000..b44cfe28 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Metadata/Source/OracleMetadata.php @@ -0,0 +1,257 @@ + 'CHECK', + 'P' => 'PRIMARY KEY', + 'R' => 'FOREIGN_KEY' + ]; + + /** + * {@inheritdoc} + * @see \Laminas\Db\Metadata\Source\AbstractSource::loadColumnData() + */ + protected function loadColumnData($table, $schema) + { + if (isset($this->data['columns'][$schema][$table])) { + return; + } + + $isColumns = [ + 'COLUMN_ID', + 'COLUMN_NAME', + 'DATA_DEFAULT', + 'NULLABLE', + 'DATA_TYPE', + 'DATA_LENGTH', + 'DATA_PRECISION', + 'DATA_SCALE' + ]; + + $this->prepareDataHierarchy('columns', $schema, $table); + $parameters = [ + ':ownername' => $schema, + ':tablename' => $table + ]; + + $sql = 'SELECT ' . implode(', ', $isColumns) + . ' FROM all_tab_columns' + . ' WHERE owner = :ownername AND table_name = :tablename'; + + $result = $this->adapter->query($sql)->execute($parameters); + $columns = []; + + foreach ($result as $row) { + $columns[$row['COLUMN_NAME']] = [ + 'ordinal_position' => $row['COLUMN_ID'], + 'column_default' => $row['DATA_DEFAULT'], + 'is_nullable' => ('Y' == $row['NULLABLE']), + 'data_type' => $row['DATA_TYPE'], + 'character_maximum_length' => $row['DATA_LENGTH'], + 'character_octet_length' => null, + 'numeric_precision' => $row['DATA_PRECISION'], + 'numeric_scale' => $row['DATA_SCALE'], + 'numeric_unsigned' => false, + 'erratas' => [], + ]; + } + + $this->data['columns'][$schema][$table] = $columns; + return $this; + } + + /** + * Constraint type + * + * @param string $type + * @return string + */ + protected function getConstraintType($type) + { + if (isset($this->constraintTypeMap[$type])) { + return $this->constraintTypeMap[$type]; + } + + return $type; + } + + /** + * {@inheritdoc} + * @see \Laminas\Db\Metadata\Source\AbstractSource::loadConstraintData() + */ + protected function loadConstraintData($table, $schema) + { + if (isset($this->data['constraints'][$schema][$table])) { + return; + } + + $this->prepareDataHierarchy('constraints', $schema, $table); + $sql = ' + SELECT + ac.owner, + ac.constraint_name, + ac.constraint_type, + ac.search_condition check_clause, + ac.table_name, + ac.delete_rule, + cc1.column_name, + cc2.table_name as ref_table, + cc2.column_name as ref_column, + cc2.owner as ref_owner + FROM all_constraints ac + INNER JOIN all_cons_columns cc1 + ON cc1.constraint_name = ac.constraint_name + LEFT JOIN all_cons_columns cc2 + ON cc2.constraint_name = ac.r_constraint_name + AND cc2.position = cc1.position + + WHERE + ac.owner = :ownername AND ac.table_name = :tablename + + ORDER BY ac.constraint_name + '; + + $parameters = [ + ':ownername' => $schema, + ':tablename' => $table + ]; + + $results = $this->adapter->query($sql)->execute($parameters); + $isFK = false; + $name = null; + $constraints = []; + + foreach ($results as $row) { + if ($row['CONSTRAINT_NAME'] !== $name) { + $name = $row['CONSTRAINT_NAME']; + $constraints[$name] = [ + 'constraint_name' => $name, + 'constraint_type' => $this->getConstraintType($row['CONSTRAINT_TYPE']), + 'table_name' => $row['TABLE_NAME'], + ]; + + if ('C' == $row['CONSTRAINT_TYPE']) { + $constraints[$name]['CHECK_CLAUSE'] = $row['CHECK_CLAUSE']; + continue; + } + + $constraints[$name]['columns'] = []; + + $isFK = ('R' == $row['CONSTRAINT_TYPE']); + if ($isFK) { + $constraints[$name]['referenced_table_schema'] = $row['REF_OWNER']; + $constraints[$name]['referenced_table_name'] = $row['REF_TABLE']; + $constraints[$name]['referenced_columns'] = []; + $constraints[$name]['match_option'] = 'NONE'; + $constraints[$name]['update_rule'] = null; + $constraints[$name]['delete_rule'] = $row['DELETE_RULE']; + } + } + + $constraints[$name]['columns'][] = $row['COLUMN_NAME']; + if ($isFK) { + $constraints[$name]['referenced_columns'][] = $row['REF_COLUMN']; + } + } + + $this->data['constraints'][$schema][$table] = $constraints; + + return $this; + } + + /** + * {@inheritdoc} + * @see \Laminas\Db\Metadata\Source\AbstractSource::loadSchemaData() + */ + protected function loadSchemaData() + { + if (isset($this->data['schemas'])) { + return; + } + + $this->prepareDataHierarchy('schemas'); + $sql = 'SELECT USERNAME FROM ALL_USERS'; + $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); + + $schemas = []; + foreach ($results->toArray() as $row) { + $schemas[] = $row['USERNAME']; + } + + $this->data['schemas'] = $schemas; + } + + /** + * {@inheritdoc} + * @see \Laminas\Db\Metadata\Source\AbstractSource::loadTableNameData() + */ + protected function loadTableNameData($schema) + { + if (isset($this->data['table_names'][$schema])) { + return $this; + } + + $this->prepareDataHierarchy('table_names', $schema); + $tables = []; + + // Tables + $bind = [':OWNER' => strtoupper($schema)]; + $result = $this->adapter->query('SELECT TABLE_NAME FROM ALL_TABLES WHERE OWNER=:OWNER')->execute($bind); + + foreach ($result as $row) { + $tables[$row['TABLE_NAME']] = [ + 'table_type' => 'BASE TABLE', + 'view_definition' => null, + 'check_option' => null, + 'is_updatable' => false, + ]; + } + + // Views + $result = $this->adapter->query('SELECT VIEW_NAME, TEXT FROM ALL_VIEWS WHERE OWNER=:OWNER', $bind); + foreach ($result as $row) { + $tables[$row['VIEW_NAME']] = [ + 'table_type' => 'VIEW', + 'view_definition' => null, + 'check_option' => 'NONE', + 'is_updatable' => false, + ]; + } + + $this->data['table_names'][$schema] = $tables; + return $this; + } + + /** + * FIXME: load trigger data + * + * {@inheritdoc} + * + * @see \Laminas\Db\Metadata\Source\AbstractSource::loadTriggerData() + */ + protected function loadTriggerData($schema) + { + if (isset($this->data['triggers'][$schema])) { + return; + } + + $this->prepareDataHierarchy('triggers', $schema); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Metadata/Source/PostgresqlMetadata.php b/bundled-libs/laminas/laminas-db/src/Metadata/Source/PostgresqlMetadata.php new file mode 100644 index 00000000..b50394d4 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Metadata/Source/PostgresqlMetadata.php @@ -0,0 +1,348 @@ +data['schemas'])) { + return; + } + $this->prepareDataHierarchy('schemas'); + + $p = $this->adapter->getPlatform(); + + $sql = 'SELECT ' . $p->quoteIdentifier('schema_name') + . ' FROM ' . $p->quoteIdentifierChain(['information_schema', 'schemata']) + . ' WHERE ' . $p->quoteIdentifier('schema_name') + . ' != \'information_schema\'' + . ' AND ' . $p->quoteIdentifier('schema_name') . " NOT LIKE 'pg_%'"; + + $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); + + $schemas = []; + foreach ($results->toArray() as $row) { + $schemas[] = $row['schema_name']; + } + + $this->data['schemas'] = $schemas; + } + + protected function loadTableNameData($schema) + { + if (isset($this->data['table_names'][$schema])) { + return; + } + $this->prepareDataHierarchy('table_names', $schema); + + $p = $this->adapter->getPlatform(); + + $isColumns = [ + ['t', 'table_name'], + ['t', 'table_type'], + ['v', 'view_definition'], + ['v', 'check_option'], + ['v', 'is_updatable'], + ]; + + array_walk($isColumns, function (&$c) use ($p) { + $c = $p->quoteIdentifierChain($c); + }); + + $sql = 'SELECT ' . implode(', ', $isColumns) + . ' FROM ' . $p->quoteIdentifierChain(['information_schema', 'tables']) . ' t' + + . ' LEFT JOIN ' . $p->quoteIdentifierChain(['information_schema', 'views']) . ' v' + . ' ON ' . $p->quoteIdentifierChain(['t', 'table_schema']) + . ' = ' . $p->quoteIdentifierChain(['v', 'table_schema']) + . ' AND ' . $p->quoteIdentifierChain(['t', 'table_name']) + . ' = ' . $p->quoteIdentifierChain(['v', 'table_name']) + + . ' WHERE ' . $p->quoteIdentifierChain(['t', 'table_type']) + . ' IN (\'BASE TABLE\', \'VIEW\')'; + + if ($schema != self::DEFAULT_SCHEMA) { + $sql .= ' AND ' . $p->quoteIdentifierChain(['t', 'table_schema']) + . ' = ' . $p->quoteTrustedValue($schema); + } else { + $sql .= ' AND ' . $p->quoteIdentifierChain(['t', 'table_schema']) + . ' != \'information_schema\''; + } + + $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); + + $tables = []; + foreach ($results->toArray() as $row) { + $tables[$row['table_name']] = [ + 'table_type' => $row['table_type'], + 'view_definition' => $row['view_definition'], + 'check_option' => $row['check_option'], + 'is_updatable' => ('YES' == $row['is_updatable']), + ]; + } + + $this->data['table_names'][$schema] = $tables; + } + + protected function loadColumnData($table, $schema) + { + if (isset($this->data['columns'][$schema][$table])) { + return; + } + + $this->prepareDataHierarchy('columns', $schema, $table); + + $platform = $this->adapter->getPlatform(); + + $isColumns = [ + 'table_name', + 'column_name', + 'ordinal_position', + 'column_default', + 'is_nullable', + 'data_type', + 'character_maximum_length', + 'character_octet_length', + 'numeric_precision', + 'numeric_scale', + ]; + + array_walk($isColumns, function (&$c) use ($platform) { + $c = $platform->quoteIdentifier($c); + }); + + $sql = 'SELECT ' . implode(', ', $isColumns) + . ' FROM ' . $platform->quoteIdentifier('information_schema') + . $platform->getIdentifierSeparator() . $platform->quoteIdentifier('columns') + . ' WHERE ' . $platform->quoteIdentifier('table_schema') + . ' != \'information\'' + . ' AND ' . $platform->quoteIdentifier('table_name') + . ' = ' . $platform->quoteTrustedValue($table); + + if ($schema != '__DEFAULT_SCHEMA__') { + $sql .= ' AND ' . $platform->quoteIdentifier('table_schema') + . ' = ' . $platform->quoteTrustedValue($schema); + } + + $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); + $columns = []; + foreach ($results->toArray() as $row) { + $columns[$row['column_name']] = [ + 'ordinal_position' => $row['ordinal_position'], + 'column_default' => $row['column_default'], + 'is_nullable' => ('YES' == $row['is_nullable']), + 'data_type' => $row['data_type'], + 'character_maximum_length' => $row['character_maximum_length'], + 'character_octet_length' => $row['character_octet_length'], + 'numeric_precision' => $row['numeric_precision'], + 'numeric_scale' => $row['numeric_scale'], + 'numeric_unsigned' => null, + 'erratas' => [], + ]; + } + + $this->data['columns'][$schema][$table] = $columns; + } + + protected function loadConstraintData($table, $schema) + { + if (isset($this->data['constraints'][$schema][$table])) { + return; + } + + $this->prepareDataHierarchy('constraints', $schema, $table); + + $isColumns = [ + ['t', 'table_name'], + ['tc', 'constraint_name'], + ['tc', 'constraint_type'], + ['kcu', 'column_name'], + ['cc', 'check_clause'], + ['rc', 'match_option'], + ['rc', 'update_rule'], + ['rc', 'delete_rule'], + ['referenced_table_schema' => 'kcu2', 'table_schema'], + ['referenced_table_name' => 'kcu2', 'table_name'], + ['referenced_column_name' => 'kcu2', 'column_name'], + ]; + + $p = $this->adapter->getPlatform(); + + array_walk($isColumns, function (&$c) use ($p) { + $alias = key($c); + $c = $p->quoteIdentifierChain($c); + if (is_string($alias)) { + $c .= ' ' . $p->quoteIdentifier($alias); + } + }); + + $sql = 'SELECT ' . implode(', ', $isColumns) + . ' FROM ' . $p->quoteIdentifierChain(['information_schema', 'tables']) . ' t' + + . ' INNER JOIN ' . $p->quoteIdentifierChain(['information_schema', 'table_constraints']) . ' tc' + . ' ON ' . $p->quoteIdentifierChain(['t', 'table_schema']) + . ' = ' . $p->quoteIdentifierChain(['tc', 'table_schema']) + . ' AND ' . $p->quoteIdentifierChain(['t', 'table_name']) + . ' = ' . $p->quoteIdentifierChain(['tc', 'table_name']) + + . ' LEFT JOIN ' . $p->quoteIdentifierChain(['information_schema', 'key_column_usage']) . ' kcu' + . ' ON ' . $p->quoteIdentifierChain(['tc', 'table_schema']) + . ' = ' . $p->quoteIdentifierChain(['kcu', 'table_schema']) + . ' AND ' . $p->quoteIdentifierChain(['tc', 'table_name']) + . ' = ' . $p->quoteIdentifierChain(['kcu', 'table_name']) + . ' AND ' . $p->quoteIdentifierChain(['tc', 'constraint_name']) + . ' = ' . $p->quoteIdentifierChain(['kcu', 'constraint_name']) + + . ' LEFT JOIN ' . $p->quoteIdentifierChain(['information_schema', 'check_constraints']) . ' cc' + . ' ON ' . $p->quoteIdentifierChain(['tc', 'constraint_schema']) + . ' = ' . $p->quoteIdentifierChain(['cc', 'constraint_schema']) + . ' AND ' . $p->quoteIdentifierChain(['tc', 'constraint_name']) + . ' = ' . $p->quoteIdentifierChain(['cc', 'constraint_name']) + + . ' LEFT JOIN ' . $p->quoteIdentifierChain(['information_schema', 'referential_constraints']) . ' rc' + . ' ON ' . $p->quoteIdentifierChain(['tc', 'constraint_schema']) + . ' = ' . $p->quoteIdentifierChain(['rc', 'constraint_schema']) + . ' AND ' . $p->quoteIdentifierChain(['tc', 'constraint_name']) + . ' = ' . $p->quoteIdentifierChain(['rc', 'constraint_name']) + + . ' LEFT JOIN ' . $p->quoteIdentifierChain(['information_schema', 'key_column_usage']) . ' kcu2' + . ' ON ' . $p->quoteIdentifierChain(['rc', 'unique_constraint_schema']) + . ' = ' . $p->quoteIdentifierChain(['kcu2', 'constraint_schema']) + . ' AND ' . $p->quoteIdentifierChain(['rc', 'unique_constraint_name']) + . ' = ' . $p->quoteIdentifierChain(['kcu2', 'constraint_name']) + . ' AND ' . $p->quoteIdentifierChain(['kcu', 'position_in_unique_constraint']) + . ' = ' . $p->quoteIdentifierChain(['kcu2', 'ordinal_position']) + + . ' WHERE ' . $p->quoteIdentifierChain(['t', 'table_name']) + . ' = ' . $p->quoteTrustedValue($table) + . ' AND ' . $p->quoteIdentifierChain(['t', 'table_type']) + . ' IN (\'BASE TABLE\', \'VIEW\')'; + + if ($schema != self::DEFAULT_SCHEMA) { + $sql .= ' AND ' . $p->quoteIdentifierChain(['t', 'table_schema']) + . ' = ' . $p->quoteTrustedValue($schema); + } else { + $sql .= ' AND ' . $p->quoteIdentifierChain(['t', 'table_schema']) + . ' != \'information_schema\''; + } + + $sql .= ' ORDER BY CASE ' . $p->quoteIdentifierChain(['tc', 'constraint_type']) + . " WHEN 'PRIMARY KEY' THEN 1" + . " WHEN 'UNIQUE' THEN 2" + . " WHEN 'FOREIGN KEY' THEN 3" + . " WHEN 'CHECK' THEN 4" + . " ELSE 5 END" + . ', ' . $p->quoteIdentifierChain(['tc', 'constraint_name']) + . ', ' . $p->quoteIdentifierChain(['kcu', 'ordinal_position']); + + $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); + + $name = null; + $constraints = []; + foreach ($results->toArray() as $row) { + if ($row['constraint_name'] !== $name) { + $name = $row['constraint_name']; + $constraints[$name] = [ + 'constraint_name' => $name, + 'constraint_type' => $row['constraint_type'], + 'table_name' => $row['table_name'], + ]; + if ('CHECK' == $row['constraint_type']) { + $constraints[$name]['check_clause'] = $row['check_clause']; + continue; + } + $constraints[$name]['columns'] = []; + $isFK = ('FOREIGN KEY' == $row['constraint_type']); + if ($isFK) { + $constraints[$name]['referenced_table_schema'] = $row['referenced_table_schema']; + $constraints[$name]['referenced_table_name'] = $row['referenced_table_name']; + $constraints[$name]['referenced_columns'] = []; + $constraints[$name]['match_option'] = $row['match_option']; + $constraints[$name]['update_rule'] = $row['update_rule']; + $constraints[$name]['delete_rule'] = $row['delete_rule']; + } + } + $constraints[$name]['columns'][] = $row['column_name']; + if ($isFK) { + $constraints[$name]['referenced_columns'][] = $row['referenced_column_name']; + } + } + + $this->data['constraints'][$schema][$table] = $constraints; + } + + protected function loadTriggerData($schema) + { + if (isset($this->data['triggers'][$schema])) { + return; + } + + $this->prepareDataHierarchy('triggers', $schema); + + $p = $this->adapter->getPlatform(); + + $isColumns = [ + 'trigger_name', + 'event_manipulation', + 'event_object_catalog', + 'event_object_schema', + 'event_object_table', + 'action_order', + 'action_condition', + 'action_statement', + 'action_orientation', + ['action_timing' => 'condition_timing'], + ['action_reference_old_table' => 'condition_reference_old_table'], + ['action_reference_new_table' => 'condition_reference_new_table'], + 'created', + ]; + + array_walk($isColumns, function (&$c) use ($p) { + if (is_array($c)) { + $alias = key($c); + $c = $p->quoteIdentifierChain($c); + if (is_string($alias)) { + $c .= ' ' . $p->quoteIdentifier($alias); + } + } else { + $c = $p->quoteIdentifier($c); + } + }); + + $sql = 'SELECT ' . implode(', ', $isColumns) + . ' FROM ' . $p->quoteIdentifierChain(['information_schema', 'triggers']) + . ' WHERE '; + + if ($schema != self::DEFAULT_SCHEMA) { + $sql .= $p->quoteIdentifier('trigger_schema') + . ' = ' . $p->quoteTrustedValue($schema); + } else { + $sql .= $p->quoteIdentifier('trigger_schema') + . ' != \'information_schema\''; + } + + $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); + + $data = []; + foreach ($results->toArray() as $row) { + $row = array_change_key_case($row, CASE_LOWER); + $row['action_reference_old_row'] = 'OLD'; + $row['action_reference_new_row'] = 'NEW'; + if (null !== $row['created']) { + $row['created'] = new \DateTime($row['created']); + } + $data[$row['trigger_name']] = $row; + } + + $this->data['triggers'][$schema] = $data; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Metadata/Source/SqlServerMetadata.php b/bundled-libs/laminas/laminas-db/src/Metadata/Source/SqlServerMetadata.php new file mode 100644 index 00000000..f78d3b7a --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Metadata/Source/SqlServerMetadata.php @@ -0,0 +1,344 @@ +data['schemas'])) { + return; + } + $this->prepareDataHierarchy('schemas'); + + $p = $this->adapter->getPlatform(); + + $sql = 'SELECT ' . $p->quoteIdentifier('SCHEMA_NAME') + . ' FROM ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'SCHEMATA']) + . ' WHERE ' . $p->quoteIdentifier('SCHEMA_NAME') + . ' != \'INFORMATION_SCHEMA\''; + + $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); + + $schemas = []; + foreach ($results->toArray() as $row) { + $schemas[] = $row['SCHEMA_NAME']; + } + + $this->data['schemas'] = $schemas; + } + + protected function loadTableNameData($schema) + { + if (isset($this->data['table_names'][$schema])) { + return; + } + $this->prepareDataHierarchy('table_names', $schema); + + $p = $this->adapter->getPlatform(); + + $isColumns = [ + ['T', 'TABLE_NAME'], + ['T', 'TABLE_TYPE'], + ['V', 'VIEW_DEFINITION'], + ['V', 'CHECK_OPTION'], + ['V', 'IS_UPDATABLE'], + ]; + + array_walk($isColumns, function (&$c) use ($p) { + $c = $p->quoteIdentifierChain($c); + }); + + $sql = 'SELECT ' . implode(', ', $isColumns) + . ' FROM ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TABLES']) . ' t' + + . ' LEFT JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'VIEWS']) . ' v' + . ' ON ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' = ' . $p->quoteIdentifierChain(['V', 'TABLE_SCHEMA']) + . ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_NAME']) + . ' = ' . $p->quoteIdentifierChain(['V', 'TABLE_NAME']) + + . ' WHERE ' . $p->quoteIdentifierChain(['T', 'TABLE_TYPE']) + . ' IN (\'BASE TABLE\', \'VIEW\')'; + + if ($schema != self::DEFAULT_SCHEMA) { + $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' = ' . $p->quoteTrustedValue($schema); + } else { + $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' != \'INFORMATION_SCHEMA\''; + } + + $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); + + $tables = []; + foreach ($results->toArray() as $row) { + $tables[$row['TABLE_NAME']] = [ + 'table_type' => $row['TABLE_TYPE'], + 'view_definition' => $row['VIEW_DEFINITION'], + 'check_option' => $row['CHECK_OPTION'], + 'is_updatable' => ('YES' == $row['IS_UPDATABLE']), + ]; + } + + $this->data['table_names'][$schema] = $tables; + } + + protected function loadColumnData($table, $schema) + { + if (isset($this->data['columns'][$schema][$table])) { + return; + } + $this->prepareDataHierarchy('columns', $schema, $table); + $p = $this->adapter->getPlatform(); + + $isColumns = [ + ['C', 'ORDINAL_POSITION'], + ['C', 'COLUMN_DEFAULT'], + ['C', 'IS_NULLABLE'], + ['C', 'DATA_TYPE'], + ['C', 'CHARACTER_MAXIMUM_LENGTH'], + ['C', 'CHARACTER_OCTET_LENGTH'], + ['C', 'NUMERIC_PRECISION'], + ['C', 'NUMERIC_SCALE'], + ['C', 'COLUMN_NAME'], + ]; + + array_walk($isColumns, function (&$c) use ($p) { + $c = $p->quoteIdentifierChain($c); + }); + + $sql = 'SELECT ' . implode(', ', $isColumns) + . ' FROM ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TABLES']) . 'T' + . ' INNER JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'COLUMNS']) . 'C' + . ' ON ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' = ' . $p->quoteIdentifierChain(['C', 'TABLE_SCHEMA']) + . ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_NAME']) + . ' = ' . $p->quoteIdentifierChain(['C', 'TABLE_NAME']) + . ' WHERE ' . $p->quoteIdentifierChain(['T', 'TABLE_TYPE']) + . ' IN (\'BASE TABLE\', \'VIEW\')' + . ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_NAME']) + . ' = ' . $p->quoteTrustedValue($table); + + if ($schema != self::DEFAULT_SCHEMA) { + $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' = ' . $p->quoteTrustedValue($schema); + } else { + $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' != \'INFORMATION_SCHEMA\''; + } + + $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); + $columns = []; + foreach ($results->toArray() as $row) { + $columns[$row['COLUMN_NAME']] = [ + 'ordinal_position' => $row['ORDINAL_POSITION'], + 'column_default' => $row['COLUMN_DEFAULT'], + 'is_nullable' => ('YES' == $row['IS_NULLABLE']), + 'data_type' => $row['DATA_TYPE'], + 'character_maximum_length' => $row['CHARACTER_MAXIMUM_LENGTH'], + 'character_octet_length' => $row['CHARACTER_OCTET_LENGTH'], + 'numeric_precision' => $row['NUMERIC_PRECISION'], + 'numeric_scale' => $row['NUMERIC_SCALE'], + 'numeric_unsigned' => null, + 'erratas' => [], + ]; + } + + $this->data['columns'][$schema][$table] = $columns; + } + + protected function loadConstraintData($table, $schema) + { + if (isset($this->data['constraints'][$schema][$table])) { + return; + } + + $this->prepareDataHierarchy('constraints', $schema, $table); + + $isColumns = [ + ['T', 'TABLE_NAME'], + ['TC', 'CONSTRAINT_NAME'], + ['TC', 'CONSTRAINT_TYPE'], + ['KCU', 'COLUMN_NAME'], + ['CC', 'CHECK_CLAUSE'], + ['RC', 'MATCH_OPTION'], + ['RC', 'UPDATE_RULE'], + ['RC', 'DELETE_RULE'], + ['REFERENCED_TABLE_SCHEMA' => 'KCU2', 'TABLE_SCHEMA'], + ['REFERENCED_TABLE_NAME' => 'KCU2', 'TABLE_NAME'], + ['REFERENCED_COLUMN_NAME' => 'KCU2', 'COLUMN_NAME'], + ]; + + $p = $this->adapter->getPlatform(); + + array_walk($isColumns, function (&$c) use ($p) { + $alias = key($c); + $c = $p->quoteIdentifierChain($c); + if (is_string($alias)) { + $c .= ' ' . $p->quoteIdentifier($alias); + } + }); + + $sql = 'SELECT ' . implode(', ', $isColumns) + . ' FROM ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TABLES']) . ' T' + + . ' INNER JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TABLE_CONSTRAINTS']) . ' TC' + . ' ON ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' = ' . $p->quoteIdentifierChain(['TC', 'TABLE_SCHEMA']) + . ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_NAME']) + . ' = ' . $p->quoteIdentifierChain(['TC', 'TABLE_NAME']) + + . ' LEFT JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'KEY_COLUMN_USAGE']) . ' KCU' + . ' ON ' . $p->quoteIdentifierChain(['TC', 'TABLE_SCHEMA']) + . ' = ' . $p->quoteIdentifierChain(['KCU', 'TABLE_SCHEMA']) + . ' AND ' . $p->quoteIdentifierChain(['TC', 'TABLE_NAME']) + . ' = ' . $p->quoteIdentifierChain(['KCU', 'TABLE_NAME']) + . ' AND ' . $p->quoteIdentifierChain(['TC', 'CONSTRAINT_NAME']) + . ' = ' . $p->quoteIdentifierChain(['KCU', 'CONSTRAINT_NAME']) + + . ' LEFT JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'CHECK_CONSTRAINTS']) . ' CC' + . ' ON ' . $p->quoteIdentifierChain(['TC', 'CONSTRAINT_SCHEMA']) + . ' = ' . $p->quoteIdentifierChain(['CC', 'CONSTRAINT_SCHEMA']) + . ' AND ' . $p->quoteIdentifierChain(['TC', 'CONSTRAINT_NAME']) + . ' = ' . $p->quoteIdentifierChain(['CC', 'CONSTRAINT_NAME']) + + . ' LEFT JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'REFERENTIAL_CONSTRAINTS']) . ' RC' + . ' ON ' . $p->quoteIdentifierChain(['TC', 'CONSTRAINT_SCHEMA']) + . ' = ' . $p->quoteIdentifierChain(['RC', 'CONSTRAINT_SCHEMA']) + . ' AND ' . $p->quoteIdentifierChain(['TC', 'CONSTRAINT_NAME']) + . ' = ' . $p->quoteIdentifierChain(['RC', 'CONSTRAINT_NAME']) + + . ' LEFT JOIN ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'KEY_COLUMN_USAGE']) . ' KCU2' + . ' ON ' . $p->quoteIdentifierChain(['RC', 'UNIQUE_CONSTRAINT_SCHEMA']) + . ' = ' . $p->quoteIdentifierChain(['KCU2', 'CONSTRAINT_SCHEMA']) + . ' AND ' . $p->quoteIdentifierChain(['RC', 'UNIQUE_CONSTRAINT_NAME']) + . ' = ' . $p->quoteIdentifierChain(['KCU2', 'CONSTRAINT_NAME']) + . ' AND ' . $p->quoteIdentifierChain(['KCU', 'ORDINAL_POSITION']) + . ' = ' . $p->quoteIdentifierChain(['KCU2', 'ORDINAL_POSITION']) + + . ' WHERE ' . $p->quoteIdentifierChain(['T', 'TABLE_NAME']) + . ' = ' . $p->quoteTrustedValue($table) + . ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_TYPE']) + . ' IN (\'BASE TABLE\', \'VIEW\')'; + + if ($schema != self::DEFAULT_SCHEMA) { + $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' = ' . $p->quoteTrustedValue($schema); + } else { + $sql .= ' AND ' . $p->quoteIdentifierChain(['T', 'TABLE_SCHEMA']) + . ' != \'INFORMATION_SCHEMA\''; + } + + $sql .= ' ORDER BY CASE ' . $p->quoteIdentifierChain(['TC', 'CONSTRAINT_TYPE']) + . " WHEN 'PRIMARY KEY' THEN 1" + . " WHEN 'UNIQUE' THEN 2" + . " WHEN 'FOREIGN KEY' THEN 3" + . " WHEN 'CHECK' THEN 4" + . " ELSE 5 END" + . ', ' . $p->quoteIdentifierChain(['TC', 'CONSTRAINT_NAME']) + . ', ' . $p->quoteIdentifierChain(['KCU', 'ORDINAL_POSITION']); + + $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); + + $name = null; + $constraints = []; + $isFK = false; + foreach ($results->toArray() as $row) { + if ($row['CONSTRAINT_NAME'] !== $name) { + $name = $row['CONSTRAINT_NAME']; + $constraints[$name] = [ + 'constraint_name' => $name, + 'constraint_type' => $row['CONSTRAINT_TYPE'], + 'table_name' => $row['TABLE_NAME'], + ]; + if ('CHECK' == $row['CONSTRAINT_TYPE']) { + $constraints[$name]['check_clause'] = $row['CHECK_CLAUSE']; + continue; + } + $constraints[$name]['columns'] = []; + $isFK = ('FOREIGN KEY' == $row['CONSTRAINT_TYPE']); + if ($isFK) { + $constraints[$name]['referenced_table_schema'] = $row['REFERENCED_TABLE_SCHEMA']; + $constraints[$name]['referenced_table_name'] = $row['REFERENCED_TABLE_NAME']; + $constraints[$name]['referenced_columns'] = []; + $constraints[$name]['match_option'] = $row['MATCH_OPTION']; + $constraints[$name]['update_rule'] = $row['UPDATE_RULE']; + $constraints[$name]['delete_rule'] = $row['DELETE_RULE']; + } + } + $constraints[$name]['columns'][] = $row['COLUMN_NAME']; + if ($isFK) { + $constraints[$name]['referenced_columns'][] = $row['REFERENCED_COLUMN_NAME']; + } + } + + $this->data['constraints'][$schema][$table] = $constraints; + } + + protected function loadTriggerData($schema) + { + if (isset($this->data['triggers'][$schema])) { + return; + } + + $this->prepareDataHierarchy('triggers', $schema); + + $p = $this->adapter->getPlatform(); + + $isColumns = [ + 'TRIGGER_NAME', + 'EVENT_MANIPULATION', + 'EVENT_OBJECT_CATALOG', + 'EVENT_OBJECT_SCHEMA', + 'EVENT_OBJECT_TABLE', + 'ACTION_ORDER', + 'ACTION_CONDITION', + 'ACTION_STATEMENT', + 'ACTION_ORIENTATION', + 'ACTION_TIMING', + 'ACTION_REFERENCE_OLD_TABLE', + 'ACTION_REFERENCE_NEW_TABLE', + 'ACTION_REFERENCE_OLD_ROW', + 'ACTION_REFERENCE_NEW_ROW', + 'CREATED', + ]; + + array_walk($isColumns, function (&$c) use ($p) { + $c = $p->quoteIdentifier($c); + }); + + $sql = 'SELECT ' . implode(', ', $isColumns) + . ' FROM ' . $p->quoteIdentifierChain(['INFORMATION_SCHEMA', 'TRIGGERS']) + . ' WHERE '; + + if ($schema != self::DEFAULT_SCHEMA) { + $sql .= $p->quoteIdentifier('TRIGGER_SCHEMA') + . ' = ' . $p->quoteTrustedValue($schema); + } else { + $sql .= $p->quoteIdentifier('TRIGGER_SCHEMA') + . ' != \'INFORMATION_SCHEMA\''; + } + + $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); + + $data = []; + foreach ($results->toArray() as $row) { + $row = array_change_key_case($row, CASE_LOWER); + if (null !== $row['created']) { + $row['created'] = new \DateTime($row['created']); + } + $data[$row['trigger_name']] = $row; + } + + $this->data['triggers'][$schema] = $data; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Metadata/Source/SqliteMetadata.php b/bundled-libs/laminas/laminas-db/src/Metadata/Source/SqliteMetadata.php new file mode 100644 index 00000000..f29a2a71 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Metadata/Source/SqliteMetadata.php @@ -0,0 +1,386 @@ +data['schemas'])) { + return; + } + $this->prepareDataHierarchy('schemas'); + + $results = $this->fetchPragma('database_list'); + foreach ($results as $row) { + $schemas[] = $row['name']; + } + $this->data['schemas'] = $schemas; + } + + protected function loadTableNameData($schema) + { + if (isset($this->data['table_names'][$schema])) { + return; + } + $this->prepareDataHierarchy('table_names', $schema); + + // FEATURE: Filename? + + $p = $this->adapter->getPlatform(); + + $sql = 'SELECT "name", "type", "sql" FROM ' . $p->quoteIdentifierChain([$schema, 'sqlite_master']) + . ' WHERE "type" IN (\'table\',\'view\') AND "name" NOT LIKE \'sqlite_%\''; + + $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); + $tables = []; + foreach ($results->toArray() as $row) { + if ('table' == $row['type']) { + $table = [ + 'table_type' => 'BASE TABLE', + 'view_definition' => null, // VIEW only + 'check_option' => null, // VIEW only + 'is_updatable' => null, // VIEW only + ]; + } else { + $table = [ + 'table_type' => 'VIEW', + 'view_definition' => null, + 'check_option' => 'NONE', + 'is_updatable' => false, + ]; + + // Parse out extra data + if (null !== ($data = $this->parseView($row['sql']))) { + $table = array_merge($table, $data); + } + } + $tables[$row['name']] = $table; + } + $this->data['table_names'][$schema] = $tables; + } + + protected function loadColumnData($table, $schema) + { + if (isset($this->data['columns'][$schema][$table])) { + return; + } + $this->prepareDataHierarchy('columns', $schema, $table); + $this->prepareDataHierarchy('sqlite_columns', $schema, $table); + + $results = $this->fetchPragma('table_info', $table, $schema); + + $columns = []; + + foreach ($results as $row) { + $columns[$row['name']] = [ + // cid appears to be zero-based, ordinal position needs to be one-based + 'ordinal_position' => $row['cid'] + 1, + 'column_default' => $row['dflt_value'], + 'is_nullable' => ! ((bool) $row['notnull']), + 'data_type' => $row['type'], + 'character_maximum_length' => null, + 'character_octet_length' => null, + 'numeric_precision' => null, + 'numeric_scale' => null, + 'numeric_unsigned' => null, + 'erratas' => [], + ]; + // TODO: populate character_ and numeric_values with correct info + } + + $this->data['columns'][$schema][$table] = $columns; + $this->data['sqlite_columns'][$schema][$table] = $results; + } + + protected function loadConstraintData($table, $schema) + { + if (isset($this->data['constraints'][$schema][$table])) { + return; + } + + $this->prepareDataHierarchy('constraints', $schema, $table); + + $this->loadColumnData($table, $schema); + $primaryKey = []; + + foreach ($this->data['sqlite_columns'][$schema][$table] as $col) { + if ((bool) $col['pk']) { + $primaryKey[] = $col['name']; + } + } + + if (empty($primaryKey)) { + $primaryKey = null; + } + $constraints = []; + $indexes = $this->fetchPragma('index_list', $table, $schema); + foreach ($indexes as $index) { + if (! ((bool) $index['unique'])) { + continue; + } + $constraint = [ + 'constraint_name' => $index['name'], + 'constraint_type' => 'UNIQUE', + 'table_name' => $table, + 'columns' => [], + ]; + + $info = $this->fetchPragma('index_info', $index['name'], $schema); + + foreach ($info as $column) { + $constraint['columns'][] = $column['name']; + } + if ($primaryKey === $constraint['columns']) { + $constraint['constraint_type'] = 'PRIMARY KEY'; + $primaryKey = null; + } + $constraints[$constraint['constraint_name']] = $constraint; + } + + if (null !== $primaryKey) { + $constraintName = '_laminas_' . $table . '_PRIMARY'; + $constraints[$constraintName] = [ + 'constraint_name' => $constraintName, + 'constraint_type' => 'PRIMARY KEY', + 'table_name' => $table, + 'columns' => $primaryKey, + ]; + } + + $foreignKeys = $this->fetchPragma('foreign_key_list', $table, $schema); + + $id = $name = null; + foreach ($foreignKeys as $fk) { + if ($id !== $fk['id']) { + $id = $fk['id']; + $name = '_laminas_' . $table . '_FOREIGN_KEY_' . ($id + 1); + $constraints[$name] = [ + 'constraint_name' => $name, + 'constraint_type' => 'FOREIGN KEY', + 'table_name' => $table, + 'columns' => [], + 'referenced_table_schema' => $schema, + 'referenced_table_name' => $fk['table'], + 'referenced_columns' => [], + // TODO: Verify match, on_update, and on_delete values conform to SQL Standard + 'match_option' => strtoupper($fk['match']), + 'update_rule' => strtoupper($fk['on_update']), + 'delete_rule' => strtoupper($fk['on_delete']), + ]; + } + $constraints[$name]['columns'][] = $fk['from']; + $constraints[$name]['referenced_columns'][] = $fk['to']; + } + + $this->data['constraints'][$schema][$table] = $constraints; + } + + protected function loadTriggerData($schema) + { + if (isset($this->data['triggers'][$schema])) { + return; + } + + $this->prepareDataHierarchy('triggers', $schema); + + $p = $this->adapter->getPlatform(); + + $sql = 'SELECT "name", "tbl_name", "sql" FROM ' + . $p->quoteIdentifierChain([$schema, 'sqlite_master']) + . ' WHERE "type" = \'trigger\''; + + $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); + $triggers = []; + foreach ($results->toArray() as $row) { + $trigger = [ + 'trigger_name' => $row['name'], + 'event_manipulation' => null, // in $row['sql'] + 'event_object_catalog' => null, + 'event_object_schema' => $schema, + 'event_object_table' => $row['tbl_name'], + 'action_order' => 0, + 'action_condition' => null, // in $row['sql'] + 'action_statement' => null, // in $row['sql'] + 'action_orientation' => 'ROW', + 'action_timing' => null, // in $row['sql'] + 'action_reference_old_table' => null, + 'action_reference_new_table' => null, + 'action_reference_old_row' => 'OLD', + 'action_reference_new_row' => 'NEW', + 'created' => null, + ]; + + // Parse out extra data + if (null !== ($data = $this->parseTrigger($row['sql']))) { + $trigger = array_merge($trigger, $data); + } + $triggers[$trigger['trigger_name']] = $trigger; + } + + $this->data['triggers'][$schema] = $triggers; + } + + protected function fetchPragma($name, $value = null, $schema = null) + { + $p = $this->adapter->getPlatform(); + + $sql = 'PRAGMA '; + + if (null !== $schema) { + $sql .= $p->quoteIdentifier($schema) . '.'; + } + $sql .= $name; + + if (null !== $value) { + $sql .= '(' . $p->quoteTrustedValue($value) . ')'; + } + + $results = $this->adapter->query($sql, Adapter::QUERY_MODE_EXECUTE); + if ($results instanceof ResultSetInterface) { + return $results->toArray(); + } + return []; + } + + protected function parseView($sql) + { + static $re = null; + if (null === $re) { + $identifierChain = $this->getIdentifierChainRegularExpression(); + $re = $this->buildRegularExpression([ + 'CREATE', + ['TEMP|TEMPORARY'], + 'VIEW', + ['IF', 'NOT', 'EXISTS'], + $identifierChain, + 'AS', + '(?.+)', + [';'], + ]); + } + + if (! preg_match($re, $sql, $matches)) { + return; + } + return [ + 'view_definition' => $matches['view_definition'], + ]; + } + + protected function parseTrigger($sql) + { + static $re = null; + if (null === $re) { + $identifier = $this->getIdentifierRegularExpression(); + $identifierList = $this->getIdentifierListRegularExpression(); + $identifierChain = $this->getIdentifierChainRegularExpression(); + $re = $this->buildRegularExpression([ + 'CREATE', + ['TEMP|TEMPORARY'], + 'TRIGGER', + ['IF', 'NOT', 'EXISTS'], + $identifierChain, + ['(?BEFORE|AFTER|INSTEAD\\s+OF)', ], + '(?DELETE|INSERT|UPDATE)', + ['OF', '(?' . $identifierList . ')'], + 'ON', + '(?' . $identifier . ')', + ['FOR', 'EACH', 'ROW'], + ['WHEN', '(?.+)'], + '(?BEGIN', + '.+', + 'END)', + [';'], + ]); + } + + if (! preg_match($re, $sql, $matches)) { + return; + } + $data = []; + + foreach ($matches as $key => $value) { + if (is_string($key)) { + $data[$key] = $value; + } + } + + // Normalize data and populate defaults, if necessary + + $data['event_manipulation'] = strtoupper($data['event_manipulation']); + if (empty($data['action_condition'])) { + $data['action_condition'] = null; + } + if (! empty($data['action_timing'])) { + $data['action_timing'] = strtoupper($data['action_timing']); + if ('I' == $data['action_timing'][0]) { + // normalize the white-space between the two words + $data['action_timing'] = 'INSTEAD OF'; + } + } else { + $data['action_timing'] = 'AFTER'; + } + unset($data['column_usage']); + + return $data; + } + + protected function buildRegularExpression(array $re) + { + foreach ($re as &$value) { + if (is_array($value)) { + $value = '(?:' . implode('\\s*+', $value) . '\\s*+)?'; + } else { + $value .= '\\s*+'; + } + } + unset($value); + $re = '/^' . implode('\\s*+', $re) . '$/'; + return $re; + } + + protected function getIdentifierRegularExpression() + { + static $re = null; + if (null === $re) { + $re = '(?:' . implode('|', [ + '"(?:[^"\\\\]++|\\\\.)*+"', + '`(?:[^`]++|``)*+`', + '\\[[^\\]]+\\]', + '[^\\s\\.]+', + ]) . ')'; + } + + return $re; + } + + protected function getIdentifierChainRegularExpression() + { + static $re = null; + if (null === $re) { + $identifier = $this->getIdentifierRegularExpression(); + $re = $identifier . '(?:\\s*\\.\\s*' . $identifier . ')*+'; + } + return $re; + } + + protected function getIdentifierListRegularExpression() + { + static $re = null; + if (null === $re) { + $identifier = $this->getIdentifierRegularExpression(); + $re = $identifier . '(?:\\s*,\\s*' . $identifier . ')*+'; + } + return $re; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Module.php b/bundled-libs/laminas/laminas-db/src/Module.php new file mode 100644 index 00000000..1bd7b84c --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Module.php @@ -0,0 +1,25 @@ + $provider->getDependencyConfig(), + ]; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/ResultSet/AbstractResultSet.php b/bundled-libs/laminas/laminas-db/src/ResultSet/AbstractResultSet.php new file mode 100644 index 00000000..f8401e4d --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/ResultSet/AbstractResultSet.php @@ -0,0 +1,290 @@ +buffer)) { + $this->buffer = []; + } + + if ($dataSource instanceof ResultInterface) { + $this->fieldCount = $dataSource->getFieldCount(); + $this->dataSource = $dataSource; + if ($dataSource->isBuffered()) { + $this->buffer = -1; + } + if (is_array($this->buffer)) { + $this->dataSource->rewind(); + } + return $this; + } + + if (is_array($dataSource)) { + // its safe to get numbers from an array + $first = current($dataSource); + reset($dataSource); + $this->fieldCount = $first === false ? 0 : count($first); + $this->dataSource = new ArrayIterator($dataSource); + $this->buffer = -1; // array's are a natural buffer + } elseif ($dataSource instanceof IteratorAggregate) { + $this->dataSource = $dataSource->getIterator(); + } elseif ($dataSource instanceof Iterator) { + $this->dataSource = $dataSource; + } else { + throw new Exception\InvalidArgumentException( + 'DataSource provided is not an array, nor does it implement Iterator or IteratorAggregate' + ); + } + + return $this; + } + + /** + * @return self Provides a fluent interface + * @throws Exception\RuntimeException + */ + public function buffer() + { + if ($this->buffer === -2) { + throw new Exception\RuntimeException('Buffering must be enabled before iteration is started'); + } elseif ($this->buffer === null) { + $this->buffer = []; + if ($this->dataSource instanceof ResultInterface) { + $this->dataSource->rewind(); + } + } + return $this; + } + + public function isBuffered() + { + if ($this->buffer === -1 || is_array($this->buffer)) { + return true; + } + return false; + } + + /** + * Get the data source used to create the result set + * + * @return null|Iterator + */ + public function getDataSource() + { + return $this->dataSource; + } + + /** + * Retrieve count of fields in individual rows of the result set + * + * @return int + */ + public function getFieldCount() + { + if (null !== $this->fieldCount) { + return $this->fieldCount; + } + + $dataSource = $this->getDataSource(); + if (null === $dataSource) { + return 0; + } + + $dataSource->rewind(); + if (! $dataSource->valid()) { + $this->fieldCount = 0; + return 0; + } + + $row = $dataSource->current(); + if (is_object($row) && $row instanceof Countable) { + $this->fieldCount = $row->count(); + return $this->fieldCount; + } + + $row = (array) $row; + $this->fieldCount = count($row); + return $this->fieldCount; + } + + /** + * Iterator: move pointer to next item + * + * @return void + */ + public function next() + { + if ($this->buffer === null) { + $this->buffer = -2; // implicitly disable buffering from here on + } + if (! is_array($this->buffer) || $this->position == $this->dataSource->key()) { + $this->dataSource->next(); + } + $this->position++; + } + + /** + * Iterator: retrieve current key + * + * @return mixed + */ + public function key() + { + return $this->position; + } + + /** + * Iterator: get current item + * + * @return array|null + */ + public function current() + { + if (-1 === $this->buffer) { + // datasource was an array when the resultset was initialized + return $this->dataSource->current(); + } + + if ($this->buffer === null) { + $this->buffer = -2; // implicitly disable buffering from here on + } elseif (is_array($this->buffer) && isset($this->buffer[$this->position])) { + return $this->buffer[$this->position]; + } + $data = $this->dataSource->current(); + if (is_array($this->buffer)) { + $this->buffer[$this->position] = $data; + } + return is_array($data) ? $data : null; + } + + /** + * Iterator: is pointer valid? + * + * @return bool + */ + public function valid() + { + if (is_array($this->buffer) && isset($this->buffer[$this->position])) { + return true; + } + if ($this->dataSource instanceof Iterator) { + return $this->dataSource->valid(); + } else { + $key = key($this->dataSource); + return ($key !== null); + } + } + + /** + * Iterator: rewind + * + * @return void + */ + public function rewind() + { + if (! is_array($this->buffer)) { + if ($this->dataSource instanceof Iterator) { + $this->dataSource->rewind(); + } else { + reset($this->dataSource); + } + } + $this->position = 0; + } + + /** + * Countable: return count of rows + * + * @return int + */ + public function count() + { + if ($this->count !== null) { + return $this->count; + } + + if ($this->dataSource instanceof Countable) { + $this->count = count($this->dataSource); + } + + return $this->count; + } + + /** + * Cast result set to array of arrays + * + * @return array + * @throws Exception\RuntimeException if any row is not castable to an array + */ + public function toArray() + { + $return = []; + foreach ($this as $row) { + if (is_array($row)) { + $return[] = $row; + } elseif (method_exists($row, 'toArray')) { + $return[] = $row->toArray(); + } elseif (method_exists($row, 'getArrayCopy')) { + $return[] = $row->getArrayCopy(); + } else { + throw new Exception\RuntimeException( + 'Rows as part of this DataSource, with type ' . gettype($row) . ' cannot be cast to an array' + ); + } + } + return $return; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/ResultSet/Exception/ExceptionInterface.php b/bundled-libs/laminas/laminas-db/src/ResultSet/Exception/ExceptionInterface.php new file mode 100644 index 00000000..1fab2061 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/ResultSet/Exception/ExceptionInterface.php @@ -0,0 +1,15 @@ +setHydrator($hydrator ?: new $defaultHydratorClass()); + $this->setObjectPrototype(($objectPrototype) ?: new ArrayObject); + } + + /** + * Set the row object prototype + * + * @param object $objectPrototype + * @return self Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function setObjectPrototype($objectPrototype) + { + if (! is_object($objectPrototype)) { + throw new Exception\InvalidArgumentException( + 'An object must be set as the object prototype, a ' . gettype($objectPrototype) . ' was provided.' + ); + } + $this->objectPrototype = $objectPrototype; + return $this; + } + + /** + * Get the row object prototype + * + * @return object + */ + public function getObjectPrototype() + { + return $this->objectPrototype; + } + + /** + * Set the hydrator to use for each row object + * + * @param HydratorInterface $hydrator + * @return self Provides a fluent interface + */ + public function setHydrator(HydratorInterface $hydrator) + { + $this->hydrator = $hydrator; + return $this; + } + + /** + * Get the hydrator to use for each row object + * + * @return HydratorInterface + */ + public function getHydrator() + { + return $this->hydrator; + } + + /** + * Iterator: get current item + * + * @return object|null + */ + public function current() + { + if ($this->buffer === null) { + $this->buffer = -2; // implicitly disable buffering from here on + } elseif (is_array($this->buffer) && isset($this->buffer[$this->position])) { + return $this->buffer[$this->position]; + } + $data = $this->dataSource->current(); + $current = is_array($data) ? $this->hydrator->hydrate($data, clone $this->objectPrototype) : null; + + if (is_array($this->buffer)) { + $this->buffer[$this->position] = $current; + } + + return $current; + } + + /** + * Cast result set to array of arrays + * + * @return array + * @throws Exception\RuntimeException if any row is not castable to an array + */ + public function toArray() + { + $return = []; + foreach ($this as $row) { + $return[] = $this->hydrator->extract($row); + } + return $return; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/ResultSet/ResultSet.php b/bundled-libs/laminas/laminas-db/src/ResultSet/ResultSet.php new file mode 100644 index 00000000..b55a9492 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/ResultSet/ResultSet.php @@ -0,0 +1,119 @@ +allowedReturnTypes, true)) { + $this->returnType = $returnType; + } else { + $this->returnType = self::TYPE_ARRAYOBJECT; + } + if ($this->returnType === self::TYPE_ARRAYOBJECT) { + $this->setArrayObjectPrototype(($arrayObjectPrototype) ?: new ArrayObject([], ArrayObject::ARRAY_AS_PROPS)); + } + } + + /** + * Set the row object prototype + * + * @param ArrayObject $arrayObjectPrototype + * @return self Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function setArrayObjectPrototype($arrayObjectPrototype) + { + if (! is_object($arrayObjectPrototype) + || ( + ! $arrayObjectPrototype instanceof ArrayObject + && ! method_exists($arrayObjectPrototype, 'exchangeArray') + ) + ) { + throw new Exception\InvalidArgumentException( + 'Object must be of type ArrayObject, or at least implement exchangeArray' + ); + } + $this->arrayObjectPrototype = $arrayObjectPrototype; + return $this; + } + + /** + * Get the row object prototype + * + * @return ArrayObject + */ + public function getArrayObjectPrototype() + { + return $this->arrayObjectPrototype; + } + + /** + * Get the return type to use when returning objects from the set + * + * @return string + */ + public function getReturnType() + { + return $this->returnType; + } + + /** + * @return array|\ArrayObject|null + */ + public function current() + { + $data = parent::current(); + + if ($this->returnType === self::TYPE_ARRAYOBJECT && is_array($data)) { + /** @var $ao ArrayObject */ + $ao = clone $this->arrayObjectPrototype; + if ($ao instanceof ArrayObject || method_exists($ao, 'exchangeArray')) { + $ao->exchangeArray($data); + } + return $ao; + } + + return $data; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/ResultSet/ResultSetInterface.php b/bundled-libs/laminas/laminas-db/src/ResultSet/ResultSetInterface.php new file mode 100644 index 00000000..bf19808b --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/ResultSet/ResultSetInterface.php @@ -0,0 +1,32 @@ +isInitialized) { + return; + } + + if (! $this->featureSet instanceof Feature\FeatureSet) { + $this->featureSet = new Feature\FeatureSet; + } + + $this->featureSet->setRowGateway($this); + $this->featureSet->apply('preInitialize', []); + + if (! is_string($this->table) && ! $this->table instanceof TableIdentifier) { + throw new Exception\RuntimeException('This row object does not have a valid table set.'); + } + + if ($this->primaryKeyColumn === null) { + throw new Exception\RuntimeException('This row object does not have a primary key column set.'); + } elseif (is_string($this->primaryKeyColumn)) { + $this->primaryKeyColumn = (array) $this->primaryKeyColumn; + } + + if (! $this->sql instanceof Sql) { + throw new Exception\RuntimeException('This row object does not have a Sql object set.'); + } + + $this->featureSet->apply('postInitialize', []); + + $this->isInitialized = true; + } + + /** + * Populate Data + * + * @param array $rowData + * @param bool $rowExistsInDatabase + * @return self Provides a fluent interface + */ + public function populate(array $rowData, $rowExistsInDatabase = false) + { + $this->initialize(); + + $this->data = $rowData; + if ($rowExistsInDatabase == true) { + $this->processPrimaryKeyData(); + } else { + $this->primaryKeyData = null; + } + + return $this; + } + + /** + * @param mixed $array + * @return AbstractRowGateway + */ + public function exchangeArray($array) + { + return $this->populate($array, true); + } + + /** + * Save + * + * @return int + */ + public function save() + { + $this->initialize(); + + if ($this->rowExistsInDatabase()) { + // UPDATE + + $data = $this->data; + $where = []; + $isPkModified = false; + + // primary key is always an array even if its a single column + foreach ($this->primaryKeyColumn as $pkColumn) { + $where[$pkColumn] = $this->primaryKeyData[$pkColumn]; + if ($data[$pkColumn] == $this->primaryKeyData[$pkColumn]) { + unset($data[$pkColumn]); + } else { + $isPkModified = true; + } + } + + $statement = $this->sql->prepareStatementForSqlObject($this->sql->update()->set($data)->where($where)); + $result = $statement->execute(); + $rowsAffected = $result->getAffectedRows(); + unset($statement, $result); // cleanup + + // If one or more primary keys are modified, we update the where clause + if ($isPkModified) { + foreach ($this->primaryKeyColumn as $pkColumn) { + if ($data[$pkColumn] != $this->primaryKeyData[$pkColumn]) { + $where[$pkColumn] = $data[$pkColumn]; + } + } + } + } else { + // INSERT + $insert = $this->sql->insert(); + $insert->values($this->data); + + $statement = $this->sql->prepareStatementForSqlObject($insert); + + $result = $statement->execute(); + if (($primaryKeyValue = $result->getGeneratedValue()) && count($this->primaryKeyColumn) == 1) { + $this->primaryKeyData = [$this->primaryKeyColumn[0] => $primaryKeyValue]; + } else { + // make primary key data available so that $where can be complete + $this->processPrimaryKeyData(); + } + $rowsAffected = $result->getAffectedRows(); + unset($statement, $result); // cleanup + + $where = []; + // primary key is always an array even if its a single column + foreach ($this->primaryKeyColumn as $pkColumn) { + $where[$pkColumn] = $this->primaryKeyData[$pkColumn]; + } + } + + // refresh data + $statement = $this->sql->prepareStatementForSqlObject($this->sql->select()->where($where)); + $result = $statement->execute(); + $rowData = $result->current(); + unset($statement, $result); // cleanup + + // make sure data and original data are in sync after save + $this->populate($rowData, true); + + // return rows affected + return $rowsAffected; + } + + /** + * Delete + * + * @return int + */ + public function delete() + { + $this->initialize(); + + $where = []; + // primary key is always an array even if its a single column + foreach ($this->primaryKeyColumn as $pkColumn) { + $where[$pkColumn] = isset($this->primaryKeyData[$pkColumn]) + ? $this->primaryKeyData[$pkColumn] + : null; + } + + // @todo determine if we need to do a select to ensure 1 row will be affected + + $statement = $this->sql->prepareStatementForSqlObject($this->sql->delete()->where($where)); + $result = $statement->execute(); + + $affectedRows = $result->getAffectedRows(); + if ($affectedRows == 1) { + // detach from database + $this->primaryKeyData = null; + } + + return $affectedRows; + } + + /** + * Offset Exists + * + * @param string $offset + * @return bool + */ + public function offsetExists($offset) + { + return array_key_exists($offset, $this->data); + } + + /** + * Offset get + * + * @param string $offset + * @return mixed + */ + public function offsetGet($offset) + { + return $this->data[$offset]; + } + + /** + * Offset set + * + * @param string $offset + * @param mixed $value + * @return self Provides a fluent interface + */ + public function offsetSet($offset, $value) + { + $this->data[$offset] = $value; + return $this; + } + + /** + * Offset unset + * + * @param string $offset + * @return self Provides a fluent interface + */ + public function offsetUnset($offset) + { + $this->data[$offset] = null; + return $this; + } + + /** + * @return int + */ + public function count() + { + return count($this->data); + } + + /** + * To array + * + * @return array + */ + public function toArray() + { + return $this->data; + } + + /** + * __get + * + * @param string $name + * @throws Exception\InvalidArgumentException + * @return mixed + */ + public function __get($name) + { + if (array_key_exists($name, $this->data)) { + return $this->data[$name]; + } else { + throw new Exception\InvalidArgumentException('Not a valid column in this row: ' . $name); + } + } + + /** + * __set + * + * @param string $name + * @param mixed $value + * @return void + */ + public function __set($name, $value) + { + $this->offsetSet($name, $value); + } + + /** + * __isset + * + * @param string $name + * @return bool + */ + public function __isset($name) + { + return $this->offsetExists($name); + } + + /** + * __unset + * + * @param string $name + * @return void + */ + public function __unset($name) + { + $this->offsetUnset($name); + } + + /** + * @return bool + */ + public function rowExistsInDatabase() + { + return ($this->primaryKeyData !== null); + } + + /** + * @throws Exception\RuntimeException + */ + protected function processPrimaryKeyData() + { + $this->primaryKeyData = []; + foreach ($this->primaryKeyColumn as $column) { + if (! isset($this->data[$column])) { + throw new Exception\RuntimeException( + 'While processing primary key data, a known key ' . $column . ' was not found in the data array' + ); + } + $this->primaryKeyData[$column] = $this->data[$column]; + } + } +} diff --git a/bundled-libs/laminas/laminas-db/src/RowGateway/Exception/ExceptionInterface.php b/bundled-libs/laminas/laminas-db/src/RowGateway/Exception/ExceptionInterface.php new file mode 100644 index 00000000..a3b2a7d9 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/RowGateway/Exception/ExceptionInterface.php @@ -0,0 +1,15 @@ +rowGateway = $rowGateway; + } + + /** + * @throws \Laminas\Db\RowGateway\Exception\RuntimeException + */ + public function initialize() + { + throw new Exception\RuntimeException('This method is not intended to be called on this object.'); + } + + /** + * @return array + */ + public function getMagicMethodSpecifications() + { + return []; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/RowGateway/Feature/FeatureSet.php b/bundled-libs/laminas/laminas-db/src/RowGateway/Feature/FeatureSet.php new file mode 100644 index 00000000..cd180895 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/RowGateway/Feature/FeatureSet.php @@ -0,0 +1,160 @@ +addFeatures($features); + } + } + + /** + * @param AbstractRowGateway $rowGateway + * @return self Provides a fluent interface + */ + public function setRowGateway(AbstractRowGateway $rowGateway) + { + $this->rowGateway = $rowGateway; + foreach ($this->features as $feature) { + $feature->setRowGateway($this->rowGateway); + } + return $this; + } + + public function getFeatureByClassName($featureClassName) + { + $feature = false; + foreach ($this->features as $potentialFeature) { + if ($potentialFeature instanceof $featureClassName) { + $feature = $potentialFeature; + break; + } + } + return $feature; + } + + /** + * @param array $features + * @return self Provides a fluent interface + */ + public function addFeatures(array $features) + { + foreach ($features as $feature) { + $this->addFeature($feature); + } + return $this; + } + + /** + * @param AbstractFeature $feature + * @return self Provides a fluent interface + */ + public function addFeature(AbstractFeature $feature) + { + $this->features[] = $feature; + $feature->setRowGateway($feature); + return $this; + } + + public function apply($method, $args) + { + foreach ($this->features as $feature) { + if (method_exists($feature, $method)) { + $return = call_user_func_array([$feature, $method], $args); + if ($return === self::APPLY_HALT) { + break; + } + } + } + } + + /** + * @param string $property + * @return bool + */ + public function canCallMagicGet($property) + { + return false; + } + + /** + * @param string $property + * @return mixed + */ + public function callMagicGet($property) + { + $return = null; + return $return; + } + + /** + * @param string $property + * @return bool + */ + public function canCallMagicSet($property) + { + return false; + } + + /** + * @param $property + * @param $value + * @return mixed + */ + public function callMagicSet($property, $value) + { + $return = null; + return $return; + } + + /** + * @param string $method + * @return bool + */ + public function canCallMagicCall($method) + { + return false; + } + + /** + * @param string $method + * @param array $arguments + * @return mixed + */ + public function callMagicCall($method, $arguments) + { + $return = null; + return $return; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/RowGateway/RowGateway.php b/bundled-libs/laminas/laminas-db/src/RowGateway/RowGateway.php new file mode 100644 index 00000000..5eddef75 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/RowGateway/RowGateway.php @@ -0,0 +1,49 @@ +primaryKeyColumn = empty($primaryKeyColumn) ? null : (array) $primaryKeyColumn; + + // set table + $this->table = $table; + + // set Sql object + if ($adapterOrSql instanceof Sql) { + $this->sql = $adapterOrSql; + } elseif ($adapterOrSql instanceof AdapterInterface) { + $this->sql = new Sql($adapterOrSql, $this->table); + } else { + throw new Exception\InvalidArgumentException('A valid Sql object was not provided.'); + } + + if ($this->sql->getTable() !== $this->table) { + throw new Exception\InvalidArgumentException( + 'The Sql object provided does not have a table that matches this row object' + ); + } + + $this->initialize(); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/RowGateway/RowGatewayInterface.php b/bundled-libs/laminas/laminas-db/src/RowGateway/RowGatewayInterface.php new file mode 100644 index 00000000..8c5f6768 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/RowGateway/RowGatewayInterface.php @@ -0,0 +1,15 @@ +buildNormalizedArgument($argument, self::TYPE_VALUE); + } + + if (is_scalar($argument) || $argument === null) { + return $this->buildNormalizedArgument($argument, $defaultType); + } + + if (is_array($argument)) { + $value = current($argument); + + if ($value instanceof ExpressionInterface || $value instanceof SqlInterface) { + return $this->buildNormalizedArgument($value, self::TYPE_VALUE); + } + + $key = key($argument); + + if (is_integer($key) && ! in_array($value, $this->allowedTypes)) { + return $this->buildNormalizedArgument($value, $defaultType); + } + + return $this->buildNormalizedArgument($key, $value); + } + + throw new Exception\InvalidArgumentException(sprintf( + '$argument should be %s or %s or %s or %s or %s, "%s" given', + 'null', + 'scalar', + 'array', + 'Laminas\Db\Sql\ExpressionInterface', + 'Laminas\Db\Sql\SqlInterface', + is_object($argument) ? get_class($argument) : gettype($argument) + )); + } + + /** + * @param mixed $argument + * @param string $argumentType + * + * @return array + * + * @throws Exception\InvalidArgumentException + */ + private function buildNormalizedArgument($argument, $argumentType) + { + if (! in_array($argumentType, $this->allowedTypes)) { + throw new Exception\InvalidArgumentException(sprintf( + 'Argument type should be in array(%s)', + implode(',', $this->allowedTypes) + )); + } + + return [ + $argument, + $argumentType, + ]; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/AbstractPreparableSql.php b/bundled-libs/laminas/laminas-db/src/Sql/AbstractPreparableSql.php new file mode 100644 index 00000000..46700cb0 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/AbstractPreparableSql.php @@ -0,0 +1,38 @@ +getParameterContainer(); + + if (! $parameterContainer instanceof ParameterContainer) { + $parameterContainer = new ParameterContainer(); + + $statementContainer->setParameterContainer($parameterContainer); + } + + $statementContainer->setSql( + $this->buildSqlString($adapter->getPlatform(), $adapter->getDriver(), $parameterContainer) + ); + + return $statementContainer; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/AbstractSql.php b/bundled-libs/laminas/laminas-db/src/Sql/AbstractSql.php new file mode 100644 index 00000000..f1f88268 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/AbstractSql.php @@ -0,0 +1,478 @@ + '', 'subselectCount' => 0]; + + /** + * @var array + */ + protected $instanceParameterIndex = []; + + /** + * {@inheritDoc} + */ + public function getSqlString(PlatformInterface $adapterPlatform = null) + { + $adapterPlatform = ($adapterPlatform) ?: new DefaultAdapterPlatform; + return $this->buildSqlString($adapterPlatform); + } + + /** + * @param PlatformInterface $platform + * @param null|DriverInterface $driver + * @param null|ParameterContainer $parameterContainer + * @return string + */ + protected function buildSqlString( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + $this->localizeVariables(); + + $sqls = []; + $parameters = []; + + foreach ($this->specifications as $name => $specification) { + $parameters[$name] = $this->{'process' . $name}( + $platform, + $driver, + $parameterContainer, + $sqls, + $parameters + ); + + if ($specification && is_array($parameters[$name])) { + $sqls[$name] = $this->createSqlFromSpecificationAndParameters($specification, $parameters[$name]); + + continue; + } + + if (is_string($parameters[$name])) { + $sqls[$name] = $parameters[$name]; + } + } + + return rtrim(implode(' ', $sqls), "\n ,"); + } + + /** + * Render table with alias in from/join parts + * + * @todo move TableIdentifier concatenation here + * @param string $table + * @param string $alias + * @return string + */ + protected function renderTable($table, $alias = null) + { + return $table . ($alias ? ' AS ' . $alias : ''); + } + + /** + * @staticvar int $runtimeExpressionPrefix + * @param ExpressionInterface $expression + * @param PlatformInterface $platform + * @param null|DriverInterface $driver + * @param null|ParameterContainer $parameterContainer + * @param null|string $namedParameterPrefix + * @return string + * @throws Exception\RuntimeException + */ + protected function processExpression( + ExpressionInterface $expression, + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null, + $namedParameterPrefix = null + ) { + $namedParameterPrefix = ! $namedParameterPrefix + ? $namedParameterPrefix + : $this->processInfo['paramPrefix'] . $namedParameterPrefix; + // static counter for the number of times this method was invoked across the PHP runtime + static $runtimeExpressionPrefix = 0; + + if ($parameterContainer && ((! is_string($namedParameterPrefix) || $namedParameterPrefix == ''))) { + $namedParameterPrefix = sprintf('expr%04dParam', ++$runtimeExpressionPrefix); + } else { + $namedParameterPrefix = preg_replace('/\s/', '__', $namedParameterPrefix); + } + + $sql = ''; + + // initialize variables + $parts = $expression->getExpressionData(); + + if (! isset($this->instanceParameterIndex[$namedParameterPrefix])) { + $this->instanceParameterIndex[$namedParameterPrefix] = 1; + } + + $expressionParamIndex = &$this->instanceParameterIndex[$namedParameterPrefix]; + + foreach ($parts as $part) { + // #7407: use $expression->getExpression() to get the unescaped + // version of the expression + if (is_string($part) && $expression instanceof Expression) { + $sql .= $expression->getExpression(); + continue; + } + + // If it is a string, simply tack it onto the return sql + // "specification" string + if (is_string($part)) { + $sql .= $part; + continue; + } + + if (! is_array($part)) { + throw new Exception\RuntimeException( + 'Elements returned from getExpressionData() array must be a string or array.' + ); + } + + // Process values and types (the middle and last position of the + // expression data) + $values = $part[1]; + $types = isset($part[2]) ? $part[2] : []; + foreach ($values as $vIndex => $value) { + if (! isset($types[$vIndex])) { + continue; + } + $type = $types[$vIndex]; + if ($value instanceof Select) { + // process sub-select + $values[$vIndex] = '(' + . $this->processSubSelect($value, $platform, $driver, $parameterContainer) + . ')'; + } elseif ($value instanceof ExpressionInterface) { + // recursive call to satisfy nested expressions + $values[$vIndex] = $this->processExpression( + $value, + $platform, + $driver, + $parameterContainer, + $namedParameterPrefix . $vIndex . 'subpart' + ); + } elseif ($type == ExpressionInterface::TYPE_IDENTIFIER) { + $values[$vIndex] = $platform->quoteIdentifierInFragment($value); + } elseif ($type == ExpressionInterface::TYPE_VALUE) { + // if prepareType is set, it means that this particular value must be + // passed back to the statement in a way it can be used as a placeholder value + if ($parameterContainer) { + $name = $namedParameterPrefix . $expressionParamIndex++; + $parameterContainer->offsetSet($name, $value); + $values[$vIndex] = $driver->formatParameterName($name); + continue; + } + + // if not a preparable statement, simply quote the value and move on + $values[$vIndex] = $platform->quoteValue($value); + } elseif ($type == ExpressionInterface::TYPE_LITERAL) { + $values[$vIndex] = $value; + } + } + + // After looping the values, interpolate them into the sql string + // (they might be placeholder names, or values) + $sql .= vsprintf($part[0], $values); + } + + return $sql; + } + + /** + * @param string|array $specifications + * @param array $parameters + * + * @return string + * + * @throws Exception\RuntimeException + */ + protected function createSqlFromSpecificationAndParameters($specifications, $parameters) + { + if (is_string($specifications)) { + return vsprintf($specifications, $parameters); + } + + $parametersCount = count($parameters); + + foreach ($specifications as $specificationString => $paramSpecs) { + if ($parametersCount == count($paramSpecs)) { + break; + } + + unset($specificationString, $paramSpecs); + } + + if (! isset($specificationString)) { + throw new Exception\RuntimeException( + 'A number of parameters was found that is not supported by this specification' + ); + } + + $topParameters = []; + foreach ($parameters as $position => $paramsForPosition) { + if (isset($paramSpecs[$position]['combinedby'])) { + $multiParamValues = []; + foreach ($paramsForPosition as $multiParamsForPosition) { + if (is_array($multiParamsForPosition)) { + $ppCount = count($multiParamsForPosition); + } else { + $ppCount = 1; + } + + if (! isset($paramSpecs[$position][$ppCount])) { + throw new Exception\RuntimeException(sprintf( + 'A number of parameters (%d) was found that is not supported by this specification', + $ppCount + )); + } + $multiParamValues[] = vsprintf($paramSpecs[$position][$ppCount], $multiParamsForPosition); + } + $topParameters[] = implode($paramSpecs[$position]['combinedby'], $multiParamValues); + } elseif ($paramSpecs[$position] !== null) { + $ppCount = count($paramsForPosition); + if (! isset($paramSpecs[$position][$ppCount])) { + throw new Exception\RuntimeException(sprintf( + 'A number of parameters (%d) was found that is not supported by this specification', + $ppCount + )); + } + $topParameters[] = vsprintf($paramSpecs[$position][$ppCount], $paramsForPosition); + } else { + $topParameters[] = $paramsForPosition; + } + } + return vsprintf($specificationString, $topParameters); + } + + /** + * @param Select $subselect + * @param PlatformInterface $platform + * @param null|DriverInterface $driver + * @param null|ParameterContainer $parameterContainer + * @return string + */ + protected function processSubSelect( + Select $subselect, + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + if ($this instanceof PlatformDecoratorInterface) { + $decorator = clone $this; + $decorator->setSubject($subselect); + } else { + $decorator = $subselect; + } + + if ($parameterContainer) { + // Track subselect prefix and count for parameters + $processInfoContext = ($decorator instanceof PlatformDecoratorInterface) ? $subselect : $decorator; + $this->processInfo['subselectCount']++; + $processInfoContext->processInfo['subselectCount'] = $this->processInfo['subselectCount']; + $processInfoContext->processInfo['paramPrefix'] = 'subselect' + . $processInfoContext->processInfo['subselectCount']; + + $sql = $decorator->buildSqlString($platform, $driver, $parameterContainer); + + // copy count + $this->processInfo['subselectCount'] = $decorator->processInfo['subselectCount']; + return $sql; + } + + return $decorator->buildSqlString($platform, $driver, $parameterContainer); + } + + /** + * @param Join[] $joins + * @param PlatformInterface $platform + * @param null|DriverInterface $driver + * @param null|ParameterContainer $parameterContainer + * @return null|string[] Null if no joins present, array of JOIN statements + * otherwise + * @throws Exception\InvalidArgumentException for invalid JOIN table names. + */ + protected function processJoin( + Join $joins, + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + if (! $joins->count()) { + return; + } + + // process joins + $joinSpecArgArray = []; + foreach ($joins->getJoins() as $j => $join) { + $joinName = null; + $joinAs = null; + + // table name + if (is_array($join['name'])) { + $joinName = current($join['name']); + $joinAs = $platform->quoteIdentifier(key($join['name'])); + } else { + $joinName = $join['name']; + } + + if ($joinName instanceof Expression) { + $joinName = $joinName->getExpression(); + } elseif ($joinName instanceof TableIdentifier) { + $joinName = $joinName->getTableAndSchema(); + $joinName = ($joinName[1] + ? $platform->quoteIdentifier($joinName[1]) . $platform->getIdentifierSeparator() + : '') . $platform->quoteIdentifier($joinName[0]); + } elseif ($joinName instanceof Select) { + $joinName = '(' . $this->processSubSelect($joinName, $platform, $driver, $parameterContainer) . ')'; + } elseif (is_string($joinName) || (is_object($joinName) && is_callable([$joinName, '__toString']))) { + $joinName = $platform->quoteIdentifier($joinName); + } else { + throw new Exception\InvalidArgumentException(sprintf( + 'Join name expected to be Expression|TableIdentifier|Select|string, "%s" given', + gettype($joinName) + )); + } + + $joinSpecArgArray[$j] = [ + strtoupper($join['type']), + $this->renderTable($joinName, $joinAs), + ]; + + // on expression + // note: for Expression objects, pass them to processExpression with a prefix specific to each join + // (used for named parameters) + if (($join['on'] instanceof ExpressionInterface)) { + $joinSpecArgArray[$j][] = $this->processExpression( + $join['on'], + $platform, + $driver, + $parameterContainer, + 'join' . ($j + 1) . 'part' + ); + } else { + // on + $joinSpecArgArray[$j][] = $platform->quoteIdentifierInFragment( + $join['on'], + ['=', 'AND', 'OR', '(', ')', 'BETWEEN', '<', '>'] + ); + } + } + + return [$joinSpecArgArray]; + } + + /** + * @param null|array|ExpressionInterface|Select $column + * @param PlatformInterface $platform + * @param null|DriverInterface $driver + * @param null|string $namedParameterPrefix + * @param null|ParameterContainer $parameterContainer + * @return string + */ + protected function resolveColumnValue( + $column, + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null, + $namedParameterPrefix = null + ) { + $namedParameterPrefix = ! $namedParameterPrefix + ? $namedParameterPrefix + : $this->processInfo['paramPrefix'] . $namedParameterPrefix; + $isIdentifier = false; + $fromTable = ''; + if (is_array($column)) { + if (isset($column['isIdentifier'])) { + $isIdentifier = (bool) $column['isIdentifier']; + } + if (isset($column['fromTable']) && $column['fromTable'] !== null) { + $fromTable = $column['fromTable']; + } + $column = $column['column']; + } + + if ($column instanceof ExpressionInterface) { + return $this->processExpression($column, $platform, $driver, $parameterContainer, $namedParameterPrefix); + } + if ($column instanceof Select) { + return '(' . $this->processSubSelect($column, $platform, $driver, $parameterContainer) . ')'; + } + if ($column === null) { + return 'NULL'; + } + return $isIdentifier + ? $fromTable . $platform->quoteIdentifierInFragment($column) + : $platform->quoteValue($column); + } + + /** + * @param string|TableIdentifier|Select $table + * @param PlatformInterface $platform + * @param DriverInterface $driver + * @param ParameterContainer $parameterContainer + * @return string + */ + protected function resolveTable( + $table, + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + $schema = null; + if ($table instanceof TableIdentifier) { + list($table, $schema) = $table->getTableAndSchema(); + } + + if ($table instanceof Select) { + $table = '(' . $this->processSubselect($table, $platform, $driver, $parameterContainer) . ')'; + } elseif ($table) { + $table = $platform->quoteIdentifier($table); + } + + if ($schema && $table) { + $table = $platform->quoteIdentifier($schema) . $platform->getIdentifierSeparator() . $table; + } + return $table; + } + + /** + * Copy variables from the subject into the local properties + */ + protected function localizeVariables() + { + if (! $this instanceof PlatformDecoratorInterface) { + return; + } + + foreach (get_object_vars($this->subject) as $name => $value) { + $this->{$name} = $value; + } + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Combine.php b/bundled-libs/laminas/laminas-db/src/Sql/Combine.php new file mode 100644 index 00000000..39f06040 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Combine.php @@ -0,0 +1,211 @@ + '%1$s (%2$s) ', + ]; + + /** + * @var Select[][] + */ + private $combine = []; + + /** + * @param Select|array|null $select + * @param string $type + * @param string $modifier + */ + public function __construct($select = null, $type = self::COMBINE_UNION, $modifier = '') + { + if ($select) { + $this->combine($select, $type, $modifier); + } + } + + /** + * Create combine clause + * + * @param Select|array $select + * @param string $type + * @param string $modifier + * + * @return self Provides a fluent interface + * + * @throws Exception\InvalidArgumentException + */ + public function combine($select, $type = self::COMBINE_UNION, $modifier = '') + { + if (is_array($select)) { + foreach ($select as $combine) { + if ($combine instanceof Select) { + $combine = [$combine]; + } + + $this->combine( + $combine[0], + isset($combine[1]) ? $combine[1] : $type, + isset($combine[2]) ? $combine[2] : $modifier + ); + } + return $this; + } + + if (! $select instanceof Select) { + throw new Exception\InvalidArgumentException(sprintf( + '$select must be a array or instance of Select, "%s" given', + is_object($select) ? get_class($select) : gettype($select) + )); + } + + $this->combine[] = [ + 'select' => $select, + 'type' => $type, + 'modifier' => $modifier + ]; + return $this; + } + + /** + * Create union clause + * + * @param Select|array $select + * @param string $modifier + * + * @return self + */ + public function union($select, $modifier = '') + { + return $this->combine($select, self::COMBINE_UNION, $modifier); + } + + /** + * Create except clause + * + * @param Select|array $select + * @param string $modifier + * + * @return self + */ + public function except($select, $modifier = '') + { + return $this->combine($select, self::COMBINE_EXCEPT, $modifier); + } + + /** + * Create intersect clause + * + * @param Select|array $select + * @param string $modifier + * @return self + */ + public function intersect($select, $modifier = '') + { + return $this->combine($select, self::COMBINE_INTERSECT, $modifier); + } + + /** + * Build sql string + * + * @param PlatformInterface $platform + * @param DriverInterface $driver + * @param ParameterContainer $parameterContainer + * + * @return string + */ + protected function buildSqlString( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + if (! $this->combine) { + return; + } + + $sql = ''; + foreach ($this->combine as $i => $combine) { + $type = $i == 0 + ? '' + : strtoupper($combine['type'] . ($combine['modifier'] ? ' ' . $combine['modifier'] : '')); + $select = $this->processSubSelect($combine['select'], $platform, $driver, $parameterContainer); + $sql .= sprintf( + $this->specifications[self::COMBINE], + $type, + $select + ); + } + return trim($sql, ' '); + } + + /** + * @return self Provides a fluent interface + */ + public function alignColumns() + { + if (! $this->combine) { + return $this; + } + + $allColumns = []; + foreach ($this->combine as $combine) { + $allColumns = array_merge( + $allColumns, + $combine['select']->getRawState(self::COLUMNS) + ); + } + + foreach ($this->combine as $combine) { + $combineColumns = $combine['select']->getRawState(self::COLUMNS); + $aligned = []; + foreach ($allColumns as $alias => $column) { + $aligned[$alias] = isset($combineColumns[$alias]) + ? $combineColumns[$alias] + : new Predicate\Expression('NULL'); + } + $combine['select']->columns($aligned, false); + } + return $this; + } + + /** + * Get raw state + * + * @param string $key + * + * @return array + */ + public function getRawState($key = null) + { + $rawState = [ + self::COMBINE => $this->combine, + self::COLUMNS => $this->combine + ? $this->combine[0]['select']->getRawState(self::COLUMNS) + : [], + ]; + return (isset($key) && array_key_exists($key, $rawState)) ? $rawState[$key] : $rawState; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Ddl/AlterTable.php b/bundled-libs/laminas/laminas-db/src/Sql/Ddl/AlterTable.php new file mode 100644 index 00000000..c66f3354 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Ddl/AlterTable.php @@ -0,0 +1,237 @@ + "ALTER TABLE %1\$s\n", + self::ADD_COLUMNS => [ + "%1\$s" => [ + [1 => "ADD COLUMN %1\$s,\n", 'combinedby' => ""] + ] + ], + self::CHANGE_COLUMNS => [ + "%1\$s" => [ + [2 => "CHANGE COLUMN %1\$s %2\$s,\n", 'combinedby' => ""], + ] + ], + self::DROP_COLUMNS => [ + "%1\$s" => [ + [1 => "DROP COLUMN %1\$s,\n", 'combinedby' => ""], + ] + ], + self::ADD_CONSTRAINTS => [ + "%1\$s" => [ + [1 => "ADD %1\$s,\n", 'combinedby' => ""], + ] + ], + self::DROP_CONSTRAINTS => [ + "%1\$s" => [ + [1 => "DROP CONSTRAINT %1\$s,\n", 'combinedby' => ""], + ] + ] + ]; + + /** + * @var string + */ + protected $table = ''; + + /** + * @param string|TableIdentifier $table + */ + public function __construct($table = '') + { + ($table) ? $this->setTable($table) : null; + } + + /** + * @param string $name + * @return self Provides a fluent interface + */ + public function setTable($name) + { + $this->table = $name; + + return $this; + } + + /** + * @param Column\ColumnInterface $column + * @return self Provides a fluent interface + */ + public function addColumn(Column\ColumnInterface $column) + { + $this->addColumns[] = $column; + + return $this; + } + + /** + * @param string $name + * @param Column\ColumnInterface $column + * @return self Provides a fluent interface + */ + public function changeColumn($name, Column\ColumnInterface $column) + { + $this->changeColumns[$name] = $column; + + return $this; + } + + /** + * @param string $name + * @return self Provides a fluent interface + */ + public function dropColumn($name) + { + $this->dropColumns[] = $name; + + return $this; + } + + /** + * @param string $name + * @return self Provides a fluent interface + */ + public function dropConstraint($name) + { + $this->dropConstraints[] = $name; + + return $this; + } + + /** + * @param Constraint\ConstraintInterface $constraint + * @return self Provides a fluent interface + */ + public function addConstraint(Constraint\ConstraintInterface $constraint) + { + $this->addConstraints[] = $constraint; + + return $this; + } + + /** + * @param string|null $key + * @return array + */ + public function getRawState($key = null) + { + $rawState = [ + self::TABLE => $this->table, + self::ADD_COLUMNS => $this->addColumns, + self::DROP_COLUMNS => $this->dropColumns, + self::CHANGE_COLUMNS => $this->changeColumns, + self::ADD_CONSTRAINTS => $this->addConstraints, + self::DROP_CONSTRAINTS => $this->dropConstraints, + ]; + + return (isset($key) && array_key_exists($key, $rawState)) ? $rawState[$key] : $rawState; + } + + protected function processTable(PlatformInterface $adapterPlatform = null) + { + return [$this->resolveTable($this->table, $adapterPlatform)]; + } + + protected function processAddColumns(PlatformInterface $adapterPlatform = null) + { + $sqls = []; + foreach ($this->addColumns as $column) { + $sqls[] = $this->processExpression($column, $adapterPlatform); + } + + return [$sqls]; + } + + protected function processChangeColumns(PlatformInterface $adapterPlatform = null) + { + $sqls = []; + foreach ($this->changeColumns as $name => $column) { + $sqls[] = [ + $adapterPlatform->quoteIdentifier($name), + $this->processExpression($column, $adapterPlatform) + ]; + } + + return [$sqls]; + } + + protected function processDropColumns(PlatformInterface $adapterPlatform = null) + { + $sqls = []; + foreach ($this->dropColumns as $column) { + $sqls[] = $adapterPlatform->quoteIdentifier($column); + } + + return [$sqls]; + } + + protected function processAddConstraints(PlatformInterface $adapterPlatform = null) + { + $sqls = []; + foreach ($this->addConstraints as $constraint) { + $sqls[] = $this->processExpression($constraint, $adapterPlatform); + } + + return [$sqls]; + } + + protected function processDropConstraints(PlatformInterface $adapterPlatform = null) + { + $sqls = []; + foreach ($this->dropConstraints as $constraint) { + $sqls[] = $adapterPlatform->quoteIdentifier($constraint); + } + + return [$sqls]; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Column/AbstractLengthColumn.php b/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Column/AbstractLengthColumn.php new file mode 100644 index 00000000..89e0f329 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Column/AbstractLengthColumn.php @@ -0,0 +1,70 @@ +setLength($length); + + parent::__construct($name, $nullable, $default, $options); + } + + /** + * @param int $length + * @return self Provides a fluent interface + */ + public function setLength($length) + { + $this->length = (int) $length; + + return $this; + } + + /** + * @return int + */ + public function getLength() + { + return $this->length; + } + + /** + * @return string + */ + protected function getLengthExpression() + { + return (string) $this->length; + } + + /** + * @return array + */ + public function getExpressionData() + { + $data = parent::getExpressionData(); + + if ($this->getLengthExpression()) { + $data[0][1][1] .= '(' . $this->getLengthExpression() . ')'; + } + + return $data; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Column/AbstractPrecisionColumn.php b/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Column/AbstractPrecisionColumn.php new file mode 100644 index 00000000..7d215668 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Column/AbstractPrecisionColumn.php @@ -0,0 +1,85 @@ +setDecimal($decimal); + + parent::__construct($name, $digits, $nullable, $default, $options); + } + + /** + * @param int $digits + * + * @return self + */ + public function setDigits($digits) + { + return $this->setLength($digits); + } + + /** + * @return int + */ + public function getDigits() + { + return $this->getLength(); + } + + /** + * @param int|null $decimal + * @return self Provides a fluent interface + */ + public function setDecimal($decimal) + { + $this->decimal = null === $decimal ? null : (int) $decimal; + + return $this; + } + + /** + * @return int|null + */ + public function getDecimal() + { + return $this->decimal; + } + + /** + * {@inheritDoc} + */ + protected function getLengthExpression() + { + if ($this->decimal !== null) { + return $this->length . ',' . $this->decimal; + } + + return $this->length; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Column/AbstractTimestampColumn.php b/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Column/AbstractTimestampColumn.php new file mode 100644 index 00000000..51341970 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Column/AbstractTimestampColumn.php @@ -0,0 +1,62 @@ +specification; + + $params = []; + $params[] = $this->name; + $params[] = $this->type; + + $types = [self::TYPE_IDENTIFIER, self::TYPE_LITERAL]; + + if (! $this->isNullable) { + $spec .= ' NOT NULL'; + } + + if ($this->default !== null) { + $spec .= ' DEFAULT %s'; + $params[] = $this->default; + $types[] = self::TYPE_VALUE; + } + + $options = $this->getOptions(); + + if (isset($options['on_update'])) { + $spec .= ' %s'; + $params[] = 'ON UPDATE CURRENT_TIMESTAMP'; + $types[] = self::TYPE_LITERAL; + } + + $data = [[ + $spec, + $params, + $types, + ]]; + + foreach ($this->constraints as $constraint) { + $data[] = ' '; + $data = array_merge($data, $constraint->getExpressionData()); + } + + return $data; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Column/BigInteger.php b/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Column/BigInteger.php new file mode 100644 index 00000000..849e96b0 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Column/BigInteger.php @@ -0,0 +1,17 @@ +setName($name); + $this->setNullable($nullable); + $this->setDefault($default); + $this->setOptions($options); + } + + /** + * @param string $name + * @return self Provides a fluent interface + */ + public function setName($name) + { + $this->name = (string) $name; + return $this; + } + + /** + * @return null|string + */ + public function getName() + { + return $this->name; + } + + /** + * @param bool $nullable + * @return self Provides a fluent interface + */ + public function setNullable($nullable) + { + $this->isNullable = (bool) $nullable; + return $this; + } + + /** + * @return bool + */ + public function isNullable() + { + return $this->isNullable; + } + + /** + * @param null|string|int $default + * @return self Provides a fluent interface + */ + public function setDefault($default) + { + $this->default = $default; + return $this; + } + + /** + * @return null|string|int + */ + public function getDefault() + { + return $this->default; + } + + /** + * @param array $options + * @return self Provides a fluent interface + */ + public function setOptions(array $options) + { + $this->options = $options; + return $this; + } + + /** + * @param string $name + * @param string $value + * @return self Provides a fluent interface + */ + public function setOption($name, $value) + { + $this->options[$name] = $value; + return $this; + } + + /** + * @return array + */ + public function getOptions() + { + return $this->options; + } + + /** + * @param ConstraintInterface $constraint + * + * @return self Provides a fluent interface + */ + public function addConstraint(ConstraintInterface $constraint) + { + $this->constraints[] = $constraint; + + return $this; + } + + /** + * @return array + */ + public function getExpressionData() + { + $spec = $this->specification; + + $params = []; + $params[] = $this->name; + $params[] = $this->type; + + $types = [self::TYPE_IDENTIFIER, self::TYPE_LITERAL]; + + if (! $this->isNullable) { + $spec .= ' NOT NULL'; + } + + if ($this->default !== null) { + $spec .= ' DEFAULT %s'; + $params[] = $this->default; + $types[] = self::TYPE_VALUE; + } + + $data = [[ + $spec, + $params, + $types, + ]]; + + foreach ($this->constraints as $constraint) { + $data[] = ' '; + $data = array_merge($data, $constraint->getExpressionData()); + } + + return $data; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Column/ColumnInterface.php b/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Column/ColumnInterface.php new file mode 100644 index 00000000..b7f6d525 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Column/ColumnInterface.php @@ -0,0 +1,39 @@ +getOptions(); + + if (isset($options['length'])) { + $data[0][1][1] .= '(' . $options['length'] . ')'; + } + + return $data; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Column/Text.php b/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Column/Text.php new file mode 100644 index 00000000..4d205712 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Column/Text.php @@ -0,0 +1,17 @@ +setColumns($columns); + } + + $this->setName($name); + } + + /** + * @param string $name + * @return self Provides a fluent interface + */ + public function setName($name) + { + $this->name = (string) $name; + return $this; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param null|string|array $columns + * @return self Provides a fluent interface + */ + public function setColumns($columns) + { + $this->columns = (array) $columns; + + return $this; + } + + /** + * @param string $column + * @return self Provides a fluent interface + */ + public function addColumn($column) + { + $this->columns[] = $column; + return $this; + } + + /** + * {@inheritDoc} + */ + public function getColumns() + { + return $this->columns; + } + + /** + * {@inheritDoc} + */ + public function getExpressionData() + { + $colCount = count($this->columns); + $newSpecTypes = []; + $values = []; + $newSpec = ''; + + if ($this->name) { + $newSpec .= $this->namedSpecification; + $values[] = $this->name; + $newSpecTypes[] = self::TYPE_IDENTIFIER; + } + + $newSpec .= $this->specification; + + if ($colCount) { + $values = array_merge($values, $this->columns); + $newSpecParts = array_fill(0, $colCount, '%s'); + $newSpecTypes = array_merge($newSpecTypes, array_fill(0, $colCount, self::TYPE_IDENTIFIER)); + $newSpec .= sprintf($this->columnSpecification, implode(', ', $newSpecParts)); + } + + return [[ + $newSpec, + $values, + $newSpecTypes, + ]]; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Constraint/Check.php b/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Constraint/Check.php new file mode 100644 index 00000000..68e234ed --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Constraint/Check.php @@ -0,0 +1,55 @@ +expression = $expression; + $this->name = $name; + } + + /** + * {@inheritDoc} + */ + public function getExpressionData() + { + $newSpecTypes = [self::TYPE_LITERAL]; + $values = [$this->expression]; + $newSpec = ''; + + if ($this->name) { + $newSpec .= $this->namedSpecification; + + array_unshift($values, $this->name); + array_unshift($newSpecTypes, self::TYPE_IDENTIFIER); + } + + return [[ + $newSpec . $this->specification, + $values, + $newSpecTypes, + ]]; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Constraint/ConstraintInterface.php b/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Constraint/ConstraintInterface.php new file mode 100644 index 00000000..8be1e3c0 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Constraint/ConstraintInterface.php @@ -0,0 +1,16 @@ +setName($name); + $this->setColumns($columns); + $this->setReferenceTable($referenceTable); + $this->setReferenceColumn($referenceColumn); + + if ($onDeleteRule) { + $this->setOnDeleteRule($onDeleteRule); + } + + if ($onUpdateRule) { + $this->setOnUpdateRule($onUpdateRule); + } + } + + /** + * @param string $referenceTable + * @return self Provides a fluent interface + */ + public function setReferenceTable($referenceTable) + { + $this->referenceTable = (string) $referenceTable; + return $this; + } + + /** + * @return string + */ + public function getReferenceTable() + { + return $this->referenceTable; + } + + /** + * @param null|string|array $referenceColumn + * @return self Provides a fluent interface + */ + public function setReferenceColumn($referenceColumn) + { + $this->referenceColumn = (array) $referenceColumn; + + return $this; + } + + /** + * @return array + */ + public function getReferenceColumn() + { + return $this->referenceColumn; + } + + /** + * @param string $onDeleteRule + * @return self Provides a fluent interface + */ + public function setOnDeleteRule($onDeleteRule) + { + $this->onDeleteRule = (string) $onDeleteRule; + + return $this; + } + + /** + * @return string + */ + public function getOnDeleteRule() + { + return $this->onDeleteRule; + } + + /** + * @param string $onUpdateRule + * @return self Provides a fluent interface + */ + public function setOnUpdateRule($onUpdateRule) + { + $this->onUpdateRule = (string) $onUpdateRule; + + return $this; + } + + /** + * @return string + */ + public function getOnUpdateRule() + { + return $this->onUpdateRule; + } + + /** + * @return array + */ + public function getExpressionData() + { + $data = parent::getExpressionData(); + $colCount = count($this->referenceColumn); + $newSpecTypes = [self::TYPE_IDENTIFIER]; + $values = [$this->referenceTable]; + + $data[0][0] .= $this->referenceSpecification[0]; + + if ($colCount) { + $values = array_merge($values, $this->referenceColumn); + $newSpecParts = array_fill(0, $colCount, '%s'); + $newSpecTypes = array_merge($newSpecTypes, array_fill(0, $colCount, self::TYPE_IDENTIFIER)); + + $data[0][0] .= sprintf('(%s) ', implode(', ', $newSpecParts)); + } + + $data[0][0] .= $this->referenceSpecification[1]; + + $values[] = $this->onDeleteRule; + $values[] = $this->onUpdateRule; + $newSpecTypes[] = self::TYPE_LITERAL; + $newSpecTypes[] = self::TYPE_LITERAL; + + $data[0][1] = array_merge($data[0][1], $values); + $data[0][2] = array_merge($data[0][2], $newSpecTypes); + + return $data; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Constraint/PrimaryKey.php b/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Constraint/PrimaryKey.php new file mode 100644 index 00000000..791c2f64 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Constraint/PrimaryKey.php @@ -0,0 +1,17 @@ + 'CREATE %1$sTABLE %2$s (', + self::COLUMNS => [ + "\n %1\$s" => [ + [1 => '%1$s', 'combinedby' => ",\n "] + ] + ], + 'combinedBy' => ",", + self::CONSTRAINTS => [ + "\n %1\$s" => [ + [1 => '%1$s', 'combinedby' => ",\n "] + ] + ], + 'statementEnd' => '%1$s', + ]; + + /** + * @var string + */ + protected $table = ''; + + /** + * @param string|TableIdentifier $table + * @param bool $isTemporary + */ + public function __construct($table = '', $isTemporary = false) + { + $this->table = $table; + $this->setTemporary($isTemporary); + } + + /** + * @param bool $temporary + * @return self Provides a fluent interface + */ + public function setTemporary($temporary) + { + $this->isTemporary = (bool) $temporary; + return $this; + } + + /** + * @return bool + */ + public function isTemporary() + { + return $this->isTemporary; + } + + /** + * @param string $name + * @return self Provides a fluent interface + */ + public function setTable($name) + { + $this->table = $name; + return $this; + } + + /** + * @param Column\ColumnInterface $column + * @return self Provides a fluent interface + */ + public function addColumn(Column\ColumnInterface $column) + { + $this->columns[] = $column; + return $this; + } + + /** + * @param Constraint\ConstraintInterface $constraint + * @return self Provides a fluent interface + */ + public function addConstraint(Constraint\ConstraintInterface $constraint) + { + $this->constraints[] = $constraint; + return $this; + } + + /** + * @param string|null $key + * @return array + */ + public function getRawState($key = null) + { + $rawState = [ + self::COLUMNS => $this->columns, + self::CONSTRAINTS => $this->constraints, + self::TABLE => $this->table, + ]; + + return (isset($key) && array_key_exists($key, $rawState)) ? $rawState[$key] : $rawState; + } + + /** + * @param PlatformInterface $adapterPlatform + * + * @return string[] + */ + protected function processTable(PlatformInterface $adapterPlatform = null) + { + return [ + $this->isTemporary ? 'TEMPORARY ' : '', + $this->resolveTable($this->table, $adapterPlatform), + ]; + } + + /** + * @param PlatformInterface $adapterPlatform + * + * @return string[][]|null + */ + protected function processColumns(PlatformInterface $adapterPlatform = null) + { + if (! $this->columns) { + return; + } + + $sqls = []; + + foreach ($this->columns as $column) { + $sqls[] = $this->processExpression($column, $adapterPlatform); + } + + return [$sqls]; + } + + /** + * @param PlatformInterface $adapterPlatform + * + * @return array|string + */ + protected function processCombinedby(PlatformInterface $adapterPlatform = null) + { + if ($this->constraints && $this->columns) { + return $this->specifications['combinedBy']; + } + } + + /** + * @param PlatformInterface $adapterPlatform + * + * @return string[][]|null + */ + protected function processConstraints(PlatformInterface $adapterPlatform = null) + { + if (! $this->constraints) { + return; + } + + $sqls = []; + + foreach ($this->constraints as $constraint) { + $sqls[] = $this->processExpression($constraint, $adapterPlatform); + } + + return [$sqls]; + } + + /** + * @param PlatformInterface $adapterPlatform + * + * @return string[] + */ + protected function processStatementEnd(PlatformInterface $adapterPlatform = null) + { + return ["\n)"]; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Ddl/DropTable.php b/bundled-libs/laminas/laminas-db/src/Sql/Ddl/DropTable.php new file mode 100644 index 00000000..cff15aa6 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Ddl/DropTable.php @@ -0,0 +1,43 @@ + 'DROP TABLE %1$s' + ]; + + /** + * @var string + */ + protected $table = ''; + + /** + * @param string|TableIdentifier $table + */ + public function __construct($table = '') + { + $this->table = $table; + } + + protected function processTable(PlatformInterface $adapterPlatform = null) + { + return [$this->resolveTable($this->table, $adapterPlatform)]; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Index/AbstractIndex.php b/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Index/AbstractIndex.php new file mode 100644 index 00000000..22e08aed --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Ddl/Index/AbstractIndex.php @@ -0,0 +1,15 @@ +setColumns($columns); + + $this->name = null === $name ? null : (string) $name; + $this->lengths = $lengths; + } + + /** + * + * @return array of array|string should return an array in the format: + * + * array ( + * // a sprintf formatted string + * string $specification, + * + * // the values for the above sprintf formatted string + * array $values, + * + * // an array of equal length of the $values array, with either TYPE_IDENTIFIER or TYPE_VALUE for each value + * array $types, + * ) + * + */ + public function getExpressionData() + { + $colCount = count($this->columns); + $values = []; + $values[] = $this->name ?: ''; + $newSpecTypes = [self::TYPE_IDENTIFIER]; + $newSpecParts = []; + + for ($i = 0; $i < $colCount; $i++) { + $specPart = '%s'; + + if (isset($this->lengths[$i])) { + $specPart .= "({$this->lengths[$i]})"; + } + + $newSpecParts[] = $specPart; + $newSpecTypes[] = self::TYPE_IDENTIFIER; + } + + $newSpec = str_replace('...', implode(', ', $newSpecParts), $this->specification); + + return [[ + $newSpec, + array_merge($values, $this->columns), + $newSpecTypes, + ]]; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Ddl/SqlInterface.php b/bundled-libs/laminas/laminas-db/src/Sql/Ddl/SqlInterface.php new file mode 100644 index 00000000..2f24be5a --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Ddl/SqlInterface.php @@ -0,0 +1,15 @@ + 'DELETE FROM %1$s', + self::SPECIFICATION_WHERE => 'WHERE %1$s' + ]; + + /** + * @var string|TableIdentifier + */ + protected $table = ''; + + /** + * @var bool + */ + protected $emptyWhereProtection = true; + + /** + * @var array + */ + protected $set = []; + + /** + * @var null|string|Where + */ + protected $where = null; + + /** + * Constructor + * + * @param null|string|TableIdentifier $table + */ + public function __construct($table = null) + { + if ($table) { + $this->from($table); + } + $this->where = new Where(); + } + + /** + * Create from statement + * + * @param string|TableIdentifier $table + * @return self Provides a fluent interface + */ + public function from($table) + { + $this->table = $table; + return $this; + } + + /** + * @param null $key + * + * @return mixed + */ + public function getRawState($key = null) + { + $rawState = [ + 'emptyWhereProtection' => $this->emptyWhereProtection, + 'table' => $this->table, + 'set' => $this->set, + 'where' => $this->where + ]; + return (isset($key) && array_key_exists($key, $rawState)) ? $rawState[$key] : $rawState; + } + + /** + * Create where clause + * + * @param Where|\Closure|string|array $predicate + * @param string $combination One of the OP_* constants from Predicate\PredicateSet + * + * @return self Provides a fluent interface + */ + public function where($predicate, $combination = Predicate\PredicateSet::OP_AND) + { + if ($predicate instanceof Where) { + $this->where = $predicate; + } else { + $this->where->addPredicates($predicate, $combination); + } + return $this; + } + + /** + * @param PlatformInterface $platform + * @param DriverInterface|null $driver + * @param ParameterContainer|null $parameterContainer + * + * @return string + */ + protected function processDelete( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + return sprintf( + $this->specifications[static::SPECIFICATION_DELETE], + $this->resolveTable($this->table, $platform, $driver, $parameterContainer) + ); + } + + /** + * @param PlatformInterface $platform + * @param DriverInterface|null $driver + * @param ParameterContainer|null $parameterContainer + * + * @return null|string + */ + protected function processWhere( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + if ($this->where->count() == 0) { + return; + } + + return sprintf( + $this->specifications[static::SPECIFICATION_WHERE], + $this->processExpression($this->where, $platform, $driver, $parameterContainer, 'where') + ); + } + + /** + * Property overloading + * + * Overloads "where" only. + * + * @param string $name + * + * @return Where|null + */ + public function __get($name) + { + switch (strtolower($name)) { + case 'where': + return $this->where; + } + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Exception/ExceptionInterface.php b/bundled-libs/laminas/laminas-db/src/Sql/Exception/ExceptionInterface.php new file mode 100644 index 00000000..ac4d462a --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Exception/ExceptionInterface.php @@ -0,0 +1,15 @@ +setExpression($expression); + } + + if ($types) { // should be deprecated and removed version 3.0.0 + if (is_array($parameters)) { + foreach ($parameters as $i => $parameter) { + $parameters[$i] = [ + $parameter => isset($types[$i]) ? $types[$i] : self::TYPE_VALUE, + ]; + } + } elseif (is_scalar($parameters)) { + $parameters = [ + $parameters => $types[0], + ]; + } + } + + if ($parameters !== null) { + $this->setParameters($parameters); + } + } + + /** + * @param $expression + * @return self Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function setExpression($expression) + { + if (! is_string($expression) || $expression == '') { + throw new Exception\InvalidArgumentException('Supplied expression must be a string.'); + } + $this->expression = $expression; + return $this; + } + + /** + * @return string + */ + public function getExpression() + { + return $this->expression; + } + + /** + * @param $parameters + * @return self Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function setParameters($parameters) + { + if (! is_scalar($parameters) && ! is_array($parameters)) { + throw new Exception\InvalidArgumentException('Expression parameters must be a scalar or array.'); + } + $this->parameters = $parameters; + return $this; + } + + /** + * @return array + */ + public function getParameters() + { + return $this->parameters; + } + + /** + * @deprecated + * @param array $types + * @return self Provides a fluent interface + */ + public function setTypes(array $types) + { + $this->types = $types; + return $this; + } + + /** + * @deprecated + * @return array + */ + public function getTypes() + { + return $this->types; + } + + /** + * @return array + * @throws Exception\RuntimeException + */ + public function getExpressionData() + { + $parameters = (is_scalar($this->parameters)) ? [$this->parameters] : $this->parameters; + $parametersCount = count($parameters); + $expression = str_replace('%', '%%', $this->expression); + + if ($parametersCount === 0) { + return [ + str_ireplace(self::PLACEHOLDER, '', $expression) + ]; + } + + // assign locally, escaping % signs + $expression = str_replace(self::PLACEHOLDER, '%s', $expression, $count); + + // test number of replacements without considering same variable begin used many times first, which is + // faster, if the test fails then resort to regex which are slow and used rarely + if ($count !== $parametersCount) { + preg_match_all('/\:\w*/', $expression, $matches); + if ($parametersCount !== count(array_unique($matches[0]))) { + throw new Exception\RuntimeException( + 'The number of replacements in the expression does not match the number of parameters' + ); + } + } + + foreach ($parameters as $parameter) { + list($values[], $types[]) = $this->normalizeArgument($parameter, self::TYPE_VALUE); + } + return [[ + $expression, + $values, + $types + ]]; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/ExpressionInterface.php b/bundled-libs/laminas/laminas-db/src/Sql/ExpressionInterface.php new file mode 100644 index 00000000..c2120e0c --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/ExpressionInterface.php @@ -0,0 +1,36 @@ + 'INSERT INTO %1$s (%2$s) VALUES (%3$s)', + self::SPECIFICATION_SELECT => 'INSERT INTO %1$s %2$s %3$s', + ]; + + /** + * @var string|TableIdentifier + */ + protected $table = null; + protected $columns = []; + + /** + * @var array|Select + */ + protected $select = null; + + /** + * Constructor + * + * @param null|string|TableIdentifier $table + */ + public function __construct($table = null) + { + if ($table) { + $this->into($table); + } + } + + /** + * Create INTO clause + * + * @param string|TableIdentifier $table + * @return self Provides a fluent interface + */ + public function into($table) + { + $this->table = $table; + return $this; + } + + /** + * Specify columns + * + * @param array $columns + * @return self Provides a fluent interface + */ + public function columns(array $columns) + { + $this->columns = array_flip($columns); + return $this; + } + + /** + * Specify values to insert + * + * @param array|Select $values + * @param string $flag one of VALUES_MERGE or VALUES_SET; defaults to VALUES_SET + * @return self Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function values($values, $flag = self::VALUES_SET) + { + if ($values instanceof Select) { + if ($flag == self::VALUES_MERGE) { + throw new Exception\InvalidArgumentException( + 'A Laminas\Db\Sql\Select instance cannot be provided with the merge flag' + ); + } + $this->select = $values; + return $this; + } + + if (! is_array($values)) { + throw new Exception\InvalidArgumentException( + 'values() expects an array of values or Laminas\Db\Sql\Select instance' + ); + } + + if ($this->select && $flag == self::VALUES_MERGE) { + throw new Exception\InvalidArgumentException( + 'An array of values cannot be provided with the merge flag when a Laminas\Db\Sql\Select' + . ' instance already exists as the value source' + ); + } + + if ($flag == self::VALUES_SET) { + $this->columns = $this->isAssocativeArray($values) + ? $values + : array_combine(array_keys($this->columns), array_values($values)); + } else { + foreach ($values as $column => $value) { + $this->columns[$column] = $value; + } + } + return $this; + } + + + /** + * Simple test for an associative array + * + * @link http://stackoverflow.com/questions/173400/how-to-check-if-php-array-is-associative-or-sequential + * @param array $array + * @return bool + */ + private function isAssocativeArray(array $array) + { + return array_keys($array) !== range(0, count($array) - 1); + } + + /** + * Create INTO SELECT clause + * + * @param Select $select + * @return self + */ + public function select(Select $select) + { + return $this->values($select); + } + + /** + * Get raw state + * + * @param string $key + * @return mixed + */ + public function getRawState($key = null) + { + $rawState = [ + 'table' => $this->table, + 'columns' => array_keys($this->columns), + 'values' => array_values($this->columns) + ]; + return (isset($key) && array_key_exists($key, $rawState)) ? $rawState[$key] : $rawState; + } + + protected function processInsert( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + if ($this->select) { + return; + } + if (! $this->columns) { + throw new Exception\InvalidArgumentException('values or select should be present'); + } + + $columns = []; + $values = []; + $i = 0; + + foreach ($this->columns as $column => $value) { + $columns[] = $platform->quoteIdentifier($column); + if (is_scalar($value) && $parameterContainer) { + // use incremental value instead of column name for PDO + // @see https://github.com/zendframework/zend-db/issues/35 + if ($driver instanceof Pdo) { + $column = 'c_' . $i++; + } + $values[] = $driver->formatParameterName($column); + $parameterContainer->offsetSet($column, $value); + } else { + $values[] = $this->resolveColumnValue( + $value, + $platform, + $driver, + $parameterContainer + ); + } + } + return sprintf( + $this->specifications[static::SPECIFICATION_INSERT], + $this->resolveTable($this->table, $platform, $driver, $parameterContainer), + implode(', ', $columns), + implode(', ', $values) + ); + } + + protected function processSelect( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + if (! $this->select) { + return; + } + $selectSql = $this->processSubSelect($this->select, $platform, $driver, $parameterContainer); + + $columns = array_map([$platform, 'quoteIdentifier'], array_keys($this->columns)); + $columns = implode(', ', $columns); + + return sprintf( + $this->specifications[static::SPECIFICATION_SELECT], + $this->resolveTable($this->table, $platform, $driver, $parameterContainer), + $columns ? "($columns)" : "", + $selectSql + ); + } + + /** + * Overloading: variable setting + * + * Proxies to values, using VALUES_MERGE strategy + * + * @param string $name + * @param mixed $value + * @return self Provides a fluent interface + */ + public function __set($name, $value) + { + $this->columns[$name] = $value; + return $this; + } + + /** + * Overloading: variable unset + * + * Proxies to values and columns + * + * @param string $name + * @throws Exception\InvalidArgumentException + * @return void + */ + public function __unset($name) + { + if (! array_key_exists($name, $this->columns)) { + throw new Exception\InvalidArgumentException( + 'The key ' . $name . ' was not found in this objects column list' + ); + } + + unset($this->columns[$name]); + } + + /** + * Overloading: variable isset + * + * Proxies to columns; does a column of that name exist? + * + * @param string $name + * @return bool + */ + public function __isset($name) + { + return array_key_exists($name, $this->columns); + } + + /** + * Overloading: variable retrieval + * + * Retrieves value by column name + * + * @param string $name + * @throws Exception\InvalidArgumentException + * @return mixed + */ + public function __get($name) + { + if (! array_key_exists($name, $this->columns)) { + throw new Exception\InvalidArgumentException( + 'The key ' . $name . ' was not found in this objects column list' + ); + } + return $this->columns[$name]; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/InsertIgnore.php b/bundled-libs/laminas/laminas-db/src/Sql/InsertIgnore.php new file mode 100644 index 00000000..50f1cc02 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/InsertIgnore.php @@ -0,0 +1,20 @@ + 'INSERT IGNORE INTO %1$s (%2$s) VALUES (%3$s)', + self::SPECIFICATION_SELECT => 'INSERT IGNORE INTO %1$s %2$s %3$s', + ]; +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Join.php b/bundled-libs/laminas/laminas-db/src/Sql/Join.php new file mode 100644 index 00000000..455ec0c3 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Join.php @@ -0,0 +1,164 @@ +position = 0; + } + + /** + * Rewind iterator. + */ + public function rewind() + { + $this->position = 0; + } + + /** + * Return current join specification. + * + * @return array + */ + public function current() + { + return $this->joins[$this->position]; + } + + /** + * Return the current iterator index. + * + * @return int + */ + public function key() + { + return $this->position; + } + + /** + * Advance to the next JOIN specification. + */ + public function next() + { + ++$this->position; + } + + /** + * Is the iterator at a valid position? + * + * @return bool + */ + public function valid() + { + return isset($this->joins[$this->position]); + } + + /** + * @return array + */ + public function getJoins() + { + return $this->joins; + } + + /** + * @param string|array|TableIdentifier $name A table name on which to join, or a single + * element associative array, of the form alias => table, or TableIdentifier instance + * @param string|Predicate\Expression $on A specification describing the fields to join on. + * @param string|string[]|int|int[] $columns A single column name, an array + * of column names, or (a) specification(s) such as SQL_STAR representing + * the columns to join. + * @param string $type The JOIN type to use; see the JOIN_* constants. + * @return self Provides a fluent interface + * @throws Exception\InvalidArgumentException for invalid $name values. + */ + public function join($name, $on, $columns = [Select::SQL_STAR], $type = Join::JOIN_INNER) + { + if (is_array($name) && (! is_string(key($name)) || count($name) !== 1)) { + throw new Exception\InvalidArgumentException( + sprintf("join() expects '%s' as a single element associative array", array_shift($name)) + ); + } + + if (! is_array($columns)) { + $columns = [$columns]; + } + + $this->joins[] = [ + 'name' => $name, + 'on' => $on, + 'columns' => $columns, + 'type' => $type ? $type : Join::JOIN_INNER + ]; + + return $this; + } + + /** + * Reset to an empty list of JOIN specifications. + * + * @return self Provides a fluent interface + */ + public function reset() + { + $this->joins = []; + return $this; + } + + /** + * Get count of attached predicates + * + * @return int + */ + public function count() + { + return count($this->joins); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Literal.php b/bundled-libs/laminas/laminas-db/src/Sql/Literal.php new file mode 100644 index 00000000..aec00dc7 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Literal.php @@ -0,0 +1,55 @@ +literal = $literal; + } + + /** + * @param string $literal + * @return self Provides a fluent interface + */ + public function setLiteral($literal) + { + $this->literal = $literal; + return $this; + } + + /** + * @return string + */ + public function getLiteral() + { + return $this->literal; + } + + /** + * @return array + */ + public function getExpressionData() + { + return [[ + str_replace('%', '%%', $this->literal), + [], + [] + ]]; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Platform/AbstractPlatform.php b/bundled-libs/laminas/laminas-db/src/Sql/Platform/AbstractPlatform.php new file mode 100644 index 00000000..98fb4c5e --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Platform/AbstractPlatform.php @@ -0,0 +1,111 @@ +subject = $subject; + + return $this; + } + + /** + * @param string $type + * @param PlatformDecoratorInterface $decorator + * + * @return void + */ + public function setTypeDecorator($type, PlatformDecoratorInterface $decorator) + { + $this->decorators[$type] = $decorator; + } + + /** + * @param PreparableSqlInterface|SqlInterface $subject + * @return PlatformDecoratorInterface|PreparableSqlInterface|SqlInterface + */ + public function getTypeDecorator($subject) + { + foreach ($this->decorators as $type => $decorator) { + if ($subject instanceof $type) { + $decorator->setSubject($subject); + + return $decorator; + } + } + + return $subject; + } + + /** + * @return array|PlatformDecoratorInterface[] + */ + public function getDecorators() + { + return $this->decorators; + } + + /** + * {@inheritDoc} + * + * @throws Exception\RuntimeException + */ + public function prepareStatement(AdapterInterface $adapter, StatementContainerInterface $statementContainer) + { + if (! $this->subject instanceof PreparableSqlInterface) { + throw new Exception\RuntimeException( + 'The subject does not appear to implement Laminas\Db\Sql\PreparableSqlInterface, thus calling ' + . 'prepareStatement() has no effect' + ); + } + + $this->getTypeDecorator($this->subject)->prepareStatement($adapter, $statementContainer); + + return $statementContainer; + } + + /** + * {@inheritDoc} + * + * @throws Exception\RuntimeException + */ + public function getSqlString(PlatformInterface $adapterPlatform = null) + { + if (! $this->subject instanceof SqlInterface) { + throw new Exception\RuntimeException( + 'The subject does not appear to implement Laminas\Db\Sql\SqlInterface, thus calling ' + . 'prepareStatement() has no effect' + ); + } + + return $this->getTypeDecorator($this->subject)->getSqlString($adapterPlatform); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Platform/IbmDb2/IbmDb2.php b/bundled-libs/laminas/laminas-db/src/Sql/Platform/IbmDb2/IbmDb2.php new file mode 100644 index 00000000..188b69bb --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Platform/IbmDb2/IbmDb2.php @@ -0,0 +1,22 @@ +setTypeDecorator('Laminas\Db\Sql\Select', ($selectDecorator) ?: new SelectDecorator()); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Platform/IbmDb2/SelectDecorator.php b/bundled-libs/laminas/laminas-db/src/Sql/Platform/IbmDb2/SelectDecorator.php new file mode 100644 index 00000000..7c21f3bc --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Platform/IbmDb2/SelectDecorator.php @@ -0,0 +1,211 @@ +isSelectContainDistinct; + } + + /** + * @param boolean $isSelectContainDistinct + */ + public function setIsSelectContainDistinct($isSelectContainDistinct) + { + $this->isSelectContainDistinct = $isSelectContainDistinct; + } + + /** + * @param Select $select + */ + public function setSubject($select) + { + $this->subject = $select; + } + + /** + * @return bool + */ + public function getSupportsLimitOffset() + { + return $this->supportsLimitOffset; + } + + /** + * @param bool $supportsLimitOffset + */ + public function setSupportsLimitOffset($supportsLimitOffset) + { + $this->supportsLimitOffset = $supportsLimitOffset; + } + + /** + * @see Select::renderTable + */ + protected function renderTable($table, $alias = null) + { + return $table . ' ' . $alias; + } + + protected function localizeVariables() + { + parent::localizeVariables(); + // set specifications + unset($this->specifications[self::LIMIT]); + unset($this->specifications[self::OFFSET]); + + $this->specifications['LIMITOFFSET'] = null; + } + + /** + * @param PlatformInterface $platform + * @param DriverInterface $driver + * @param ParameterContainer $parameterContainer + * @param array $sqls + * @param array $parameters + */ + protected function processLimitOffset( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null, + &$sqls, + &$parameters + ) { + if ($this->limit === null && $this->offset === null) { + return; + } + + if ($this->supportsLimitOffset) { + // Note: db2_prepare/db2_execute fails with positional parameters, for LIMIT & OFFSET + $limit = (int) $this->limit; + if (! $limit) { + return; + } + + $offset = (int) $this->offset; + if ($offset) { + array_push($sqls, sprintf("LIMIT %s OFFSET %s", $limit, $offset)); + return; + } + + array_push($sqls, sprintf("LIMIT %s", $limit)); + return; + } + + $selectParameters = $parameters[self::SELECT]; + + $starSuffix = $platform->getIdentifierSeparator() . self::SQL_STAR; + foreach ($selectParameters[0] as $i => $columnParameters) { + if ($columnParameters[0] == self::SQL_STAR + || (isset($columnParameters[1]) && $columnParameters[1] == self::SQL_STAR) + || strpos($columnParameters[0], $starSuffix) + ) { + $selectParameters[0] = [[self::SQL_STAR]]; + break; + } + + if (isset($columnParameters[1])) { + array_shift($columnParameters); + $selectParameters[0][$i] = $columnParameters; + } + } + + // first, produce column list without compound names (using the AS portion only) + array_unshift($sqls, $this->createSqlFromSpecificationAndParameters( + ['SELECT %1$s FROM (' => current($this->specifications[self::SELECT])], + $selectParameters + )); + + if (preg_match('/DISTINCT/i', $sqls[0])) { + $this->setIsSelectContainDistinct(true); + } + + if ($parameterContainer) { + // create bottom part of query, with offset and limit using row_number + $limitParamName = $driver->formatParameterName('limit'); + $offsetParamName = $driver->formatParameterName('offset'); + + array_push($sqls, sprintf( + // @codingStandardsIgnoreStart + ") AS LAMINAS_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION WHERE LAMINAS_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION.LAMINAS_DB_ROWNUM BETWEEN %s AND %s", + // @codingStandardsIgnoreEnd + $offsetParamName, + $limitParamName + )); + + if ((int) $this->offset > 0) { + $parameterContainer->offsetSet('offset', (int) $this->offset + 1); + } else { + $parameterContainer->offsetSet('offset', (int) $this->offset); + } + + $parameterContainer->offsetSet('limit', (int) $this->limit + (int) $this->offset); + } else { + if ((int) $this->offset > 0) { + $offset = (int) $this->offset + 1; + } else { + $offset = (int) $this->offset; + } + + array_push($sqls, sprintf( + // @codingStandardsIgnoreStart + ") AS LAMINAS_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION WHERE LAMINAS_IBMDB2_SERVER_LIMIT_OFFSET_EMULATION.LAMINAS_DB_ROWNUM BETWEEN %d AND %d", + // @codingStandardsIgnoreEnd + $offset, + (int) $this->limit + (int) $this->offset + )); + } + + if (isset($sqls[self::ORDER])) { + $orderBy = $sqls[self::ORDER]; + unset($sqls[self::ORDER]); + } else { + $orderBy = ''; + } + + // add a column for row_number() using the order specification //dense_rank() + if ($this->getIsSelectContainDistinct()) { + $parameters[self::SELECT][0][] = ['DENSE_RANK() OVER (' . $orderBy . ')', 'LAMINAS_DB_ROWNUM']; + } else { + $parameters[self::SELECT][0][] = ['ROW_NUMBER() OVER (' . $orderBy . ')', 'LAMINAS_DB_ROWNUM']; + } + + $sqls[self::SELECT] = $this->createSqlFromSpecificationAndParameters( + $this->specifications[self::SELECT], + $parameters[self::SELECT] + ); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Platform/Mysql/Ddl/AlterTableDecorator.php b/bundled-libs/laminas/laminas-db/src/Sql/Platform/Mysql/Ddl/AlterTableDecorator.php new file mode 100644 index 00000000..ff9ed1ce --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Platform/Mysql/Ddl/AlterTableDecorator.php @@ -0,0 +1,250 @@ + 0, + 'zerofill' => 1, + 'identity' => 2, + 'serial' => 2, + 'autoincrement' => 2, + 'comment' => 3, + 'columnformat' => 4, + 'format' => 4, + 'storage' => 5, + 'after' => 6 + ]; + + /** + * @param AlterTable $subject + * @return self Provides a fluent interface + */ + public function setSubject($subject) + { + $this->subject = $subject; + + return $this; + } + + /** + * @param string $sql + * @return array + */ + protected function getSqlInsertOffsets($sql) + { + $sqlLength = strlen($sql); + $insertStart = []; + + foreach (['NOT NULL', 'NULL', 'DEFAULT', 'UNIQUE', 'PRIMARY', 'REFERENCES'] as $needle) { + $insertPos = strpos($sql, ' ' . $needle); + + if ($insertPos !== false) { + switch ($needle) { + case 'REFERENCES': + $insertStart[2] = ! isset($insertStart[2]) ? $insertPos : $insertStart[2]; + // no break + case 'PRIMARY': + case 'UNIQUE': + $insertStart[1] = ! isset($insertStart[1]) ? $insertPos : $insertStart[1]; + // no break + default: + $insertStart[0] = ! isset($insertStart[0]) ? $insertPos : $insertStart[0]; + } + } + } + + foreach (range(0, 3) as $i) { + $insertStart[$i] = isset($insertStart[$i]) ? $insertStart[$i] : $sqlLength; + } + + return $insertStart; + } + + /** + * @param PlatformInterface $adapterPlatform + * @return array + */ + protected function processAddColumns(PlatformInterface $adapterPlatform = null) + { + $sqls = []; + + foreach ($this->addColumns as $i => $column) { + $sql = $this->processExpression($column, $adapterPlatform); + $insertStart = $this->getSqlInsertOffsets($sql); + $columnOptions = $column->getOptions(); + + uksort($columnOptions, [$this, 'compareColumnOptions']); + + foreach ($columnOptions as $coName => $coValue) { + $insert = ''; + + if (! $coValue) { + continue; + } + + switch ($this->normalizeColumnOption($coName)) { + case 'unsigned': + $insert = ' UNSIGNED'; + $j = 0; + break; + case 'zerofill': + $insert = ' ZEROFILL'; + $j = 0; + break; + case 'identity': + case 'serial': + case 'autoincrement': + $insert = ' AUTO_INCREMENT'; + $j = 1; + break; + case 'comment': + $insert = ' COMMENT ' . $adapterPlatform->quoteValue($coValue); + $j = 2; + break; + case 'columnformat': + case 'format': + $insert = ' COLUMN_FORMAT ' . strtoupper($coValue); + $j = 2; + break; + case 'storage': + $insert = ' STORAGE ' . strtoupper($coValue); + $j = 2; + break; + case 'after': + $insert = ' AFTER ' . $adapterPlatform->quoteIdentifier($coValue); + $j = 2; + } + + if ($insert) { + $j = isset($j) ? $j : 0; + $sql = substr_replace($sql, $insert, $insertStart[$j], 0); + $insertStartCount = count($insertStart); + for (; $j < $insertStartCount; ++$j) { + $insertStart[$j] += strlen($insert); + } + } + } + $sqls[$i] = $sql; + } + return [$sqls]; + } + + /** + * @param PlatformInterface $adapterPlatform + * @return array + */ + protected function processChangeColumns(PlatformInterface $adapterPlatform = null) + { + $sqls = []; + foreach ($this->changeColumns as $name => $column) { + $sql = $this->processExpression($column, $adapterPlatform); + $insertStart = $this->getSqlInsertOffsets($sql); + $columnOptions = $column->getOptions(); + + uksort($columnOptions, [$this, 'compareColumnOptions']); + + foreach ($columnOptions as $coName => $coValue) { + $insert = ''; + + if (! $coValue) { + continue; + } + + switch ($this->normalizeColumnOption($coName)) { + case 'unsigned': + $insert = ' UNSIGNED'; + $j = 0; + break; + case 'zerofill': + $insert = ' ZEROFILL'; + $j = 0; + break; + case 'identity': + case 'serial': + case 'autoincrement': + $insert = ' AUTO_INCREMENT'; + $j = 1; + break; + case 'comment': + $insert = ' COMMENT ' . $adapterPlatform->quoteValue($coValue); + $j = 2; + break; + case 'columnformat': + case 'format': + $insert = ' COLUMN_FORMAT ' . strtoupper($coValue); + $j = 2; + break; + case 'storage': + $insert = ' STORAGE ' . strtoupper($coValue); + $j = 2; + break; + } + + if ($insert) { + $j = isset($j) ? $j : 0; + $sql = substr_replace($sql, $insert, $insertStart[$j], 0); + $insertStartCount = count($insertStart); + for (; $j < $insertStartCount; ++$j) { + $insertStart[$j] += strlen($insert); + } + } + } + $sqls[] = [ + $adapterPlatform->quoteIdentifier($name), + $sql + ]; + } + + return [$sqls]; + } + + /** + * @param string $name + * + * @return string + */ + private function normalizeColumnOption($name) + { + return strtolower(str_replace(['-', '_', ' '], '', $name)); + } + + /** + * + * @param string $columnA + * @param string $columnB + * + * @return int + */ + private function compareColumnOptions($columnA, $columnB) + { + $columnA = $this->normalizeColumnOption($columnA); + $columnA = isset($this->columnOptionSortOrder[$columnA]) + ? $this->columnOptionSortOrder[$columnA] : count($this->columnOptionSortOrder); + + $columnB = $this->normalizeColumnOption($columnB); + $columnB = isset($this->columnOptionSortOrder[$columnB]) + ? $this->columnOptionSortOrder[$columnB] : count($this->columnOptionSortOrder); + + return $columnA - $columnB; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Platform/Mysql/Ddl/CreateTableDecorator.php b/bundled-libs/laminas/laminas-db/src/Sql/Platform/Mysql/Ddl/CreateTableDecorator.php new file mode 100644 index 00000000..d33e8c6e --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Platform/Mysql/Ddl/CreateTableDecorator.php @@ -0,0 +1,183 @@ + 0, + 'zerofill' => 1, + 'identity' => 2, + 'serial' => 2, + 'autoincrement' => 2, + 'comment' => 3, + 'columnformat' => 4, + 'format' => 4, + 'storage' => 5, + ]; + + /** + * @param CreateTable $subject + * + * @return self Provides a fluent interface + */ + public function setSubject($subject) + { + $this->subject = $subject; + + return $this; + } + + /** + * @param string $sql + * @return array + */ + protected function getSqlInsertOffsets($sql) + { + $sqlLength = strlen($sql); + $insertStart = []; + + foreach (['NOT NULL', 'NULL', 'DEFAULT', 'UNIQUE', 'PRIMARY', 'REFERENCES'] as $needle) { + $insertPos = strpos($sql, ' ' . $needle); + + if ($insertPos !== false) { + switch ($needle) { + case 'REFERENCES': + $insertStart[2] = ! isset($insertStart[2]) ? $insertPos : $insertStart[2]; + // no break + case 'PRIMARY': + case 'UNIQUE': + $insertStart[1] = ! isset($insertStart[1]) ? $insertPos : $insertStart[1]; + // no break + default: + $insertStart[0] = ! isset($insertStart[0]) ? $insertPos : $insertStart[0]; + } + } + } + + foreach (range(0, 3) as $i) { + $insertStart[$i] = isset($insertStart[$i]) ? $insertStart[$i] : $sqlLength; + } + + return $insertStart; + } + + /** + * {@inheritDoc} + */ + protected function processColumns(PlatformInterface $platform = null) + { + if (! $this->columns) { + return; + } + + $sqls = []; + + foreach ($this->columns as $i => $column) { + $sql = $this->processExpression($column, $platform); + $insertStart = $this->getSqlInsertOffsets($sql); + $columnOptions = $column->getOptions(); + + uksort($columnOptions, [$this, 'compareColumnOptions']); + + foreach ($columnOptions as $coName => $coValue) { + $insert = ''; + + if (! $coValue) { + continue; + } + + switch ($this->normalizeColumnOption($coName)) { + case 'unsigned': + $insert = ' UNSIGNED'; + $j = 0; + break; + case 'zerofill': + $insert = ' ZEROFILL'; + $j = 0; + break; + case 'identity': + case 'serial': + case 'autoincrement': + $insert = ' AUTO_INCREMENT'; + $j = 1; + break; + case 'comment': + $insert = ' COMMENT ' . $platform->quoteValue($coValue); + $j = 2; + break; + case 'columnformat': + case 'format': + $insert = ' COLUMN_FORMAT ' . strtoupper($coValue); + $j = 2; + break; + case 'storage': + $insert = ' STORAGE ' . strtoupper($coValue); + $j = 2; + break; + } + + if ($insert) { + $j = isset($j) ? $j : 0; + $sql = substr_replace($sql, $insert, $insertStart[$j], 0); + $insertStartCount = count($insertStart); + for (; $j < $insertStartCount; ++$j) { + $insertStart[$j] += strlen($insert); + } + } + } + + $sqls[$i] = $sql; + } + + return [$sqls]; + } + + /** + * @param string $name + * + * @return string + */ + private function normalizeColumnOption($name) + { + return strtolower(str_replace(['-', '_', ' '], '', $name)); + } + + /** + * + * @param string $columnA + * @param string $columnB + * + * @return int + */ + private function compareColumnOptions($columnA, $columnB) + { + $columnA = $this->normalizeColumnOption($columnA); + $columnA = isset($this->columnOptionSortOrder[$columnA]) + ? $this->columnOptionSortOrder[$columnA] : count($this->columnOptionSortOrder); + + $columnB = $this->normalizeColumnOption($columnB); + $columnB = isset($this->columnOptionSortOrder[$columnB]) + ? $this->columnOptionSortOrder[$columnB] : count($this->columnOptionSortOrder); + + return $columnA - $columnB; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Platform/Mysql/Mysql.php b/bundled-libs/laminas/laminas-db/src/Sql/Platform/Mysql/Mysql.php new file mode 100644 index 00000000..e24f0daf --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Platform/Mysql/Mysql.php @@ -0,0 +1,21 @@ +setTypeDecorator('Laminas\Db\Sql\Select', new SelectDecorator()); + $this->setTypeDecorator('Laminas\Db\Sql\Ddl\CreateTable', new Ddl\CreateTableDecorator()); + $this->setTypeDecorator('Laminas\Db\Sql\Ddl\AlterTable', new Ddl\AlterTableDecorator()); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Platform/Mysql/SelectDecorator.php b/bundled-libs/laminas/laminas-db/src/Sql/Platform/Mysql/SelectDecorator.php new file mode 100644 index 00000000..ab1cb876 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Platform/Mysql/SelectDecorator.php @@ -0,0 +1,76 @@ +subject = $select; + } + + protected function localizeVariables() + { + parent::localizeVariables(); + if ($this->limit === null && $this->offset !== null) { + $this->specifications[self::LIMIT] = 'LIMIT 18446744073709551615'; + } + } + + protected function processLimit( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + if ($this->limit === null && $this->offset !== null) { + return ['']; + } + if ($this->limit === null) { + return; + } + if ($parameterContainer) { + $paramPrefix = $this->processInfo['paramPrefix']; + $parameterContainer->offsetSet($paramPrefix . 'limit', $this->limit, ParameterContainer::TYPE_INTEGER); + return [$driver->formatParameterName($paramPrefix . 'limit')]; + } + + return [$this->limit]; + } + + protected function processOffset( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + if ($this->offset === null) { + return; + } + if ($parameterContainer) { + $paramPrefix = $this->processInfo['paramPrefix']; + $parameterContainer->offsetSet($paramPrefix . 'offset', $this->offset, ParameterContainer::TYPE_INTEGER); + return [$driver->formatParameterName($paramPrefix . 'offset')]; + } + + return [$this->offset]; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Platform/Oracle/Oracle.php b/bundled-libs/laminas/laminas-db/src/Sql/Platform/Oracle/Oracle.php new file mode 100644 index 00000000..11e8f5ac --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Platform/Oracle/Oracle.php @@ -0,0 +1,19 @@ +setTypeDecorator('Laminas\Db\Sql\Select', ($selectDecorator) ?: new SelectDecorator()); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Platform/Oracle/SelectDecorator.php b/bundled-libs/laminas/laminas-db/src/Sql/Platform/Oracle/SelectDecorator.php new file mode 100644 index 00000000..0731c43b --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Platform/Oracle/SelectDecorator.php @@ -0,0 +1,154 @@ +subject = $select; + } + + /** + * @see \Laminas\Db\Sql\Select::renderTable + */ + protected function renderTable($table, $alias = null) + { + return $table . ($alias ? ' ' . $alias : ''); + } + + protected function localizeVariables() + { + parent::localizeVariables(); + unset($this->specifications[self::LIMIT]); + unset($this->specifications[self::OFFSET]); + + $this->specifications['LIMITOFFSET'] = null; + } + + /** + * @param PlatformInterface $platform + * @param DriverInterface $driver + * @param ParameterContainer $parameterContainer + * @param array $sqls + * @param array $parameters + * @return null + */ + protected function processLimitOffset( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null, + &$sqls = [], + &$parameters = [] + ) { + if ($this->limit === null && $this->offset === null) { + return; + } + + $selectParameters = $parameters[self::SELECT]; + $starSuffix = $platform->getIdentifierSeparator() . self::SQL_STAR; + + foreach ($selectParameters[0] as $i => $columnParameters) { + if ($columnParameters[0] == self::SQL_STAR + || (isset($columnParameters[1]) && $columnParameters[1] == self::SQL_STAR) + || strpos($columnParameters[0], $starSuffix) + ) { + $selectParameters[0] = [[self::SQL_STAR]]; + break; + } + + if (isset($columnParameters[1])) { + array_shift($columnParameters); + $selectParameters[0][$i] = $columnParameters; + } + } + + if ($this->offset === null) { + $this->offset = 0; + } + + // first, produce column list without compound names (using the AS portion only) + array_unshift($sqls, $this->createSqlFromSpecificationAndParameters([ + 'SELECT %1$s FROM (SELECT b.%1$s, rownum b_rownum FROM (' => current($this->specifications[self::SELECT]), + ], $selectParameters)); + + if ($parameterContainer) { + $number = $this->processInfo['subselectCount'] ? $this->processInfo['subselectCount'] : ''; + + if ($this->limit === null) { + array_push( + $sqls, + ') b ) WHERE b_rownum > (:offset' . $number . ')' + ); + $parameterContainer->offsetSet( + 'offset' . $number, + $this->offset, + $parameterContainer::TYPE_INTEGER + ); + } else { + // create bottom part of query, with offset and limit using row_number + array_push( + $sqls, + ') b WHERE rownum <= (:offset' + . $number + . '+:limit' + . $number + . ')) WHERE b_rownum >= (:offset' + . $number + . ' + 1)' + ); + $parameterContainer->offsetSet( + 'offset' . $number, + $this->offset, + $parameterContainer::TYPE_INTEGER + ); + $parameterContainer->offsetSet( + 'limit' . $number, + $this->limit, + $parameterContainer::TYPE_INTEGER + ); + } + $this->processInfo['subselectCount']++; + } else { + if ($this->limit === null) { + array_push($sqls, ') b ) WHERE b_rownum > (' . (int) $this->offset . ')'); + } else { + array_push( + $sqls, + ') b WHERE rownum <= (' + . (int) $this->offset + . '+' + . (int) $this->limit + . ')) WHERE b_rownum >= (' + . (int) $this->offset + . ' + 1)' + ); + } + } + + $sqls[self::SELECT] = $this->createSqlFromSpecificationAndParameters( + $this->specifications[self::SELECT], + $parameters[self::SELECT] + ); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Platform/Platform.php b/bundled-libs/laminas/laminas-db/src/Sql/Platform/Platform.php new file mode 100644 index 00000000..9d1cb781 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Platform/Platform.php @@ -0,0 +1,172 @@ +defaultPlatform = $adapter->getPlatform(); + + $mySqlPlatform = new Mysql\Mysql(); + $sqlServerPlatform = new SqlServer\SqlServer(); + $oraclePlatform = new Oracle\Oracle(); + $ibmDb2Platform = new IbmDb2\IbmDb2(); + $sqlitePlatform = new Sqlite\Sqlite(); + + $this->decorators['mysql'] = $mySqlPlatform->getDecorators(); + $this->decorators['sqlserver'] = $sqlServerPlatform->getDecorators(); + $this->decorators['oracle'] = $oraclePlatform->getDecorators(); + $this->decorators['ibmdb2'] = $ibmDb2Platform->getDecorators(); + $this->decorators['sqlite'] = $sqlitePlatform->getDecorators(); + } + + /** + * @param string $type + * @param PlatformDecoratorInterface $decorator + * @param AdapterInterface|PlatformInterface $adapterOrPlatform + */ + public function setTypeDecorator($type, PlatformDecoratorInterface $decorator, $adapterOrPlatform = null) + { + $platformName = $this->resolvePlatformName($adapterOrPlatform); + $this->decorators[$platformName][$type] = $decorator; + } + + /** + * @param PreparableSqlInterface|SqlInterface $subject + * @param AdapterInterface|PlatformInterface|null $adapterOrPlatform + * @return PlatformDecoratorInterface|PreparableSqlInterface|SqlInterface + */ + public function getTypeDecorator($subject, $adapterOrPlatform = null) + { + $platformName = $this->resolvePlatformName($adapterOrPlatform); + + if (isset($this->decorators[$platformName])) { + foreach ($this->decorators[$platformName] as $type => $decorator) { + if ($subject instanceof $type && is_a($decorator, $type, true)) { + $decorator->setSubject($subject); + return $decorator; + } + } + } + + return $subject; + } + + /** + * @return array|PlatformDecoratorInterface[] + */ + public function getDecorators() + { + $platformName = $this->resolvePlatformName($this->getDefaultPlatform()); + return $this->decorators[$platformName]; + } + + /** + * {@inheritDoc} + * + * @throws Exception\RuntimeException + */ + public function prepareStatement(AdapterInterface $adapter, StatementContainerInterface $statementContainer) + { + if (! $this->subject instanceof PreparableSqlInterface) { + throw new Exception\RuntimeException( + 'The subject does not appear to implement Laminas\Db\Sql\PreparableSqlInterface, thus calling ' + . 'prepareStatement() has no effect' + ); + } + + $this->getTypeDecorator($this->subject, $adapter)->prepareStatement($adapter, $statementContainer); + + return $statementContainer; + } + + /** + * {@inheritDoc} + * + * @throws Exception\RuntimeException + */ + public function getSqlString(PlatformInterface $adapterPlatform = null) + { + if (! $this->subject instanceof SqlInterface) { + throw new Exception\RuntimeException( + 'The subject does not appear to implement Laminas\Db\Sql\SqlInterface, thus calling ' + . 'prepareStatement() has no effect' + ); + } + + $adapterPlatform = $this->resolvePlatform($adapterPlatform); + + return $this->getTypeDecorator($this->subject, $adapterPlatform)->getSqlString($adapterPlatform); + } + + protected function resolvePlatformName($adapterOrPlatform) + { + $platformName = $this->resolvePlatform($adapterOrPlatform)->getName(); + return str_replace([' ', '_'], '', strtolower($platformName)); + } + /** + * @param null|PlatformInterface|AdapterInterface $adapterOrPlatform + * + * @return PlatformInterface + * + * @throws Exception\InvalidArgumentException + */ + protected function resolvePlatform($adapterOrPlatform) + { + if (! $adapterOrPlatform) { + return $this->getDefaultPlatform(); + } + + if ($adapterOrPlatform instanceof AdapterInterface) { + return $adapterOrPlatform->getPlatform(); + } + + if ($adapterOrPlatform instanceof PlatformInterface) { + return $adapterOrPlatform; + } + + throw new Exception\InvalidArgumentException(sprintf( + '$adapterOrPlatform should be null, %s, or %s', + 'Laminas\Db\Adapter\AdapterInterface', + 'Laminas\Db\Adapter\Platform\PlatformInterface' + )); + } + + /** + * @return PlatformInterface + * + * @throws Exception\RuntimeException + */ + protected function getDefaultPlatform() + { + if (! $this->defaultPlatform) { + throw new Exception\RuntimeException('$this->defaultPlatform was not set'); + } + + return $this->defaultPlatform; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Platform/PlatformDecoratorInterface.php b/bundled-libs/laminas/laminas-db/src/Sql/Platform/PlatformDecoratorInterface.php new file mode 100644 index 00000000..cdb4fc39 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Platform/PlatformDecoratorInterface.php @@ -0,0 +1,19 @@ +subject = $subject; + return $this; + } + + /** + * @param PlatformInterface $adapterPlatform + * @return array + */ + protected function processTable(PlatformInterface $adapterPlatform = null) + { + $table = ($this->isTemporary ? '#' : '') . ltrim($this->table, '#'); + return [ + '', + $adapterPlatform->quoteIdentifier($table), + ]; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Platform/SqlServer/SelectDecorator.php b/bundled-libs/laminas/laminas-db/src/Sql/Platform/SqlServer/SelectDecorator.php new file mode 100644 index 00000000..f27c3998 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Platform/SqlServer/SelectDecorator.php @@ -0,0 +1,130 @@ +subject = $select; + } + + protected function localizeVariables() + { + parent::localizeVariables(); + // set specifications + unset($this->specifications[self::LIMIT]); + unset($this->specifications[self::OFFSET]); + + $this->specifications['LIMITOFFSET'] = null; + } + + /** + * @param PlatformInterface $platform + * @param DriverInterface $driver + * @param ParameterContainer $parameterContainer + * @param $sqls + * @param $parameters + * @return null + */ + protected function processLimitOffset( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null, + &$sqls, + &$parameters + ) { + if ($this->limit === null && $this->offset === null) { + return; + } + + $selectParameters = $parameters[self::SELECT]; + + /** if this is a DISTINCT query then real SELECT part goes to second element in array **/ + $parameterIndex = 0; + if ($selectParameters[0] === 'DISTINCT') { + unset($selectParameters[0]); + $selectParameters = array_values($selectParameters); + $parameterIndex = 1; + } + + $starSuffix = $platform->getIdentifierSeparator() . self::SQL_STAR; + foreach ($selectParameters[0] as $i => $columnParameters) { + if ($columnParameters[0] == self::SQL_STAR + || (isset($columnParameters[1]) && $columnParameters[1] == self::SQL_STAR) + || strpos($columnParameters[0], $starSuffix) + ) { + $selectParameters[0] = [[self::SQL_STAR]]; + break; + } + if (isset($columnParameters[1])) { + array_shift($columnParameters); + $selectParameters[0][$i] = $columnParameters; + } + } + + // first, produce column list without compound names (using the AS portion only) + array_unshift($sqls, $this->createSqlFromSpecificationAndParameters( + ['SELECT %1$s FROM (' => current($this->specifications[self::SELECT])], + $selectParameters + )); + + if ($parameterContainer) { + // create bottom part of query, with offset and limit using row_number + $limitParamName = $driver->formatParameterName('limit'); + $offsetParamName = $driver->formatParameterName('offset'); + $offsetForSumParamName = $driver->formatParameterName('offsetForSum'); + // @codingStandardsIgnoreStart + array_push($sqls, ') AS [LAMINAS_SQL_SERVER_LIMIT_OFFSET_EMULATION] WHERE [LAMINAS_SQL_SERVER_LIMIT_OFFSET_EMULATION].[__LAMINAS_ROW_NUMBER] BETWEEN ' + . $offsetParamName . '+1 AND ' . $limitParamName . '+' . $offsetForSumParamName); + // @codingStandardsIgnoreEnd + $parameterContainer->offsetSet('offset', $this->offset); + $parameterContainer->offsetSet('limit', $this->limit); + $parameterContainer->offsetSetReference('offsetForSum', 'offset'); + } else { + // @codingStandardsIgnoreStart + array_push($sqls, ') AS [LAMINAS_SQL_SERVER_LIMIT_OFFSET_EMULATION] WHERE [LAMINAS_SQL_SERVER_LIMIT_OFFSET_EMULATION].[__LAMINAS_ROW_NUMBER] BETWEEN ' + . (int) $this->offset . '+1 AND ' + . (int) $this->limit . '+' . (int) $this->offset); + // @codingStandardsIgnoreEnd + } + + if (isset($sqls[self::ORDER])) { + $orderBy = $sqls[self::ORDER]; + unset($sqls[self::ORDER]); + } else { + $orderBy = 'ORDER BY (SELECT 1)'; + } + + // add a column for row_number() using the order specification + $parameters[self::SELECT][$parameterIndex][] = [ + 'ROW_NUMBER() OVER (' . $orderBy . ')', + '[__LAMINAS_ROW_NUMBER]', + ]; + + $sqls[self::SELECT] = $this->createSqlFromSpecificationAndParameters( + $this->specifications[self::SELECT], + $parameters[self::SELECT] + ); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Platform/SqlServer/SqlServer.php b/bundled-libs/laminas/laminas-db/src/Sql/Platform/SqlServer/SqlServer.php new file mode 100644 index 00000000..52bd20ec --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Platform/SqlServer/SqlServer.php @@ -0,0 +1,20 @@ +setTypeDecorator('Laminas\Db\Sql\Select', ($selectDecorator) ?: new SelectDecorator()); + $this->setTypeDecorator('Laminas\Db\Sql\Ddl\CreateTable', new Ddl\CreateTableDecorator()); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Platform/Sqlite/SelectDecorator.php b/bundled-libs/laminas/laminas-db/src/Sql/Platform/Sqlite/SelectDecorator.php new file mode 100644 index 00000000..ab6ad49c --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Platform/Sqlite/SelectDecorator.php @@ -0,0 +1,104 @@ +subject = $select; + + return $this; + } + + /** + * {@inheritDoc} + */ + protected function localizeVariables() + { + parent::localizeVariables(); + $this->specifications[self::COMBINE] = '%1$s %2$s'; + } + + /** + * {@inheritDoc} + */ + protected function processStatementStart( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + return ''; + } + + protected function processLimit( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + if ($this->limit === null && $this->offset !== null) { + return ['']; + } + if ($this->limit === null) { + return; + } + if ($parameterContainer) { + $paramPrefix = $this->processInfo['paramPrefix']; + $parameterContainer->offsetSet($paramPrefix . 'limit', $this->limit, ParameterContainer::TYPE_INTEGER); + return [$driver->formatParameterName('limit')]; + } + + return [$this->limit]; + } + + protected function processOffset( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + if ($this->offset === null) { + return; + } + if ($parameterContainer) { + $paramPrefix = $this->processInfo['paramPrefix']; + $parameterContainer->offsetSet($paramPrefix . 'offset', $this->offset, ParameterContainer::TYPE_INTEGER); + return [$driver->formatParameterName('offset')]; + } + + return [$this->offset]; + } + + /** + * {@inheritDoc} + */ + protected function processStatementEnd( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + return ''; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Platform/Sqlite/Sqlite.php b/bundled-libs/laminas/laminas-db/src/Sql/Platform/Sqlite/Sqlite.php new file mode 100644 index 00000000..b4741b97 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Platform/Sqlite/Sqlite.php @@ -0,0 +1,24 @@ +setTypeDecorator('Laminas\Db\Sql\Select', new SelectDecorator()); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Predicate/Between.php b/bundled-libs/laminas/laminas-db/src/Sql/Predicate/Between.php new file mode 100644 index 00000000..64a8138c --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Predicate/Between.php @@ -0,0 +1,146 @@ +setIdentifier($identifier); + } + if ($minValue !== null) { + $this->setMinValue($minValue); + } + if ($maxValue !== null) { + $this->setMaxValue($maxValue); + } + } + + /** + * Set identifier for comparison + * + * @param string $identifier + * @return self Provides a fluent interface + */ + public function setIdentifier($identifier) + { + $this->identifier = $identifier; + return $this; + } + + /** + * Get identifier of comparison + * + * @return null|string + */ + public function getIdentifier() + { + return $this->identifier; + } + + /** + * Set minimum boundary for comparison + * + * @param int|float|string $minValue + * @return self Provides a fluent interface + */ + public function setMinValue($minValue) + { + $this->minValue = $minValue; + return $this; + } + + /** + * Get minimum boundary for comparison + * + * @return null|int|float|string + */ + public function getMinValue() + { + return $this->minValue; + } + + /** + * Set maximum boundary for comparison + * + * @param int|float|string $maxValue + * @return self Provides a fluent interface + */ + public function setMaxValue($maxValue) + { + $this->maxValue = $maxValue; + return $this; + } + + /** + * Get maximum boundary for comparison + * + * @return null|int|float|string + */ + public function getMaxValue() + { + return $this->maxValue; + } + + /** + * Set specification string to use in forming SQL predicate + * + * @param string $specification + * @return self Provides a fluent interface + */ + public function setSpecification($specification) + { + $this->specification = $specification; + return $this; + } + + /** + * Get specification string to use in forming SQL predicate + * + * @return string + */ + public function getSpecification() + { + return $this->specification; + } + + /** + * Return "where" parts + * + * @return array + */ + public function getExpressionData() + { + list($values[], $types[]) = $this->normalizeArgument($this->identifier, self::TYPE_IDENTIFIER); + list($values[], $types[]) = $this->normalizeArgument($this->minValue, self::TYPE_VALUE); + list($values[], $types[]) = $this->normalizeArgument($this->maxValue, self::TYPE_VALUE); + return [ + [ + $this->getSpecification(), + $values, + $types, + ], + ]; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Predicate/Expression.php b/bundled-libs/laminas/laminas-db/src/Sql/Predicate/Expression.php new file mode 100644 index 00000000..a29925e0 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Predicate/Expression.php @@ -0,0 +1,29 @@ +setExpression($expression); + } + + $this->setParameters(is_array($valueParameter) ? $valueParameter : array_slice(func_get_args(), 1)); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Predicate/In.php b/bundled-libs/laminas/laminas-db/src/Sql/Predicate/In.php new file mode 100644 index 00000000..006f87df --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Predicate/In.php @@ -0,0 +1,143 @@ +setIdentifier($identifier); + } + if ($valueSet !== null) { + $this->setValueSet($valueSet); + } + } + + /** + * Set identifier for comparison + * + * @param string|array $identifier + * @return self Provides a fluent interface + */ + public function setIdentifier($identifier) + { + $this->identifier = $identifier; + + return $this; + } + + /** + * Get identifier of comparison + * + * @return null|string|array + */ + public function getIdentifier() + { + return $this->identifier; + } + + /** + * Set set of values for IN comparison + * + * @param array|Select $valueSet + * @return self Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function setValueSet($valueSet) + { + if (! is_array($valueSet) && ! $valueSet instanceof Select) { + throw new Exception\InvalidArgumentException( + '$valueSet must be either an array or a Laminas\Db\Sql\Select object, ' . gettype($valueSet) . ' given' + ); + } + $this->valueSet = $valueSet; + + return $this; + } + + /** + * Gets set of values in IN comparison + * + * @return array|Select + */ + public function getValueSet() + { + return $this->valueSet; + } + + /** + * Return array of parts for where statement + * + * @return array + */ + public function getExpressionData() + { + $identifier = $this->getIdentifier(); + $values = $this->getValueSet(); + $replacements = []; + + if (is_array($identifier)) { + $countIdentifier = count($identifier); + $identifierSpecFragment = '(' . implode(', ', array_fill(0, $countIdentifier, '%s')) . ')'; + $types = array_fill(0, $countIdentifier, self::TYPE_IDENTIFIER); + $replacements = $identifier; + } else { + $identifierSpecFragment = '%s'; + $replacements[] = $identifier; + $types = [self::TYPE_IDENTIFIER]; + } + + if ($values instanceof Select) { + $specification = vsprintf( + $this->specification, + [$identifierSpecFragment, '%s'] + ); + $replacements[] = $values; + $types[] = self::TYPE_VALUE; + } else { + foreach ($values as $argument) { + list($replacements[], $types[]) = $this->normalizeArgument($argument, self::TYPE_VALUE); + } + $countValues = count($values); + $valuePlaceholders = $countValues > 0 ? array_fill(0, $countValues, '%s') : []; + $inValueList = implode(', ', $valuePlaceholders); + if ('' === $inValueList) { + $inValueList = 'NULL'; + } + $specification = vsprintf( + $this->specification, + [$identifierSpecFragment, '(' . $inValueList . ')'] + ); + } + + return [[ + $specification, + $replacements, + $types, + ]]; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Predicate/IsNotNull.php b/bundled-libs/laminas/laminas-db/src/Sql/Predicate/IsNotNull.php new file mode 100644 index 00000000..3004a819 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Predicate/IsNotNull.php @@ -0,0 +1,14 @@ +setIdentifier($identifier); + } + } + + /** + * Set identifier for comparison + * + * @param string $identifier + * @return self Provides a fluent interface + */ + public function setIdentifier($identifier) + { + $this->identifier = $identifier; + return $this; + } + + /** + * Get identifier of comparison + * + * @return null|string + */ + public function getIdentifier() + { + return $this->identifier; + } + + /** + * Set specification string to use in forming SQL predicate + * + * @param string $specification + * @return self Provides a fluent interface + */ + public function setSpecification($specification) + { + $this->specification = $specification; + return $this; + } + + /** + * Get specification string to use in forming SQL predicate + * + * @return string + */ + public function getSpecification() + { + return $this->specification; + } + + /** + * Get parts for where statement + * + * @return array + */ + public function getExpressionData() + { + $identifier = $this->normalizeArgument($this->identifier, self::TYPE_IDENTIFIER); + return [[ + $this->getSpecification(), + [$identifier[0]], + [$identifier[1]], + ]]; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Predicate/Like.php b/bundled-libs/laminas/laminas-db/src/Sql/Predicate/Like.php new file mode 100644 index 00000000..91604f78 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Predicate/Like.php @@ -0,0 +1,113 @@ +setIdentifier($identifier); + } + if ($like) { + $this->setLike($like); + } + } + + /** + * @param string $identifier + * @return self Provides a fluent interface + */ + public function setIdentifier($identifier) + { + $this->identifier = $identifier; + return $this; + } + + /** + * @return string + */ + public function getIdentifier() + { + return $this->identifier; + } + + /** + * @param string $like + * @return self Provides a fluent interface + */ + public function setLike($like) + { + $this->like = $like; + return $this; + } + + /** + * @return string + */ + public function getLike() + { + return $this->like; + } + + /** + * @param string $specification + * @return self Provides a fluent interface + */ + public function setSpecification($specification) + { + $this->specification = $specification; + return $this; + } + + /** + * @return string + */ + public function getSpecification() + { + return $this->specification; + } + + /** + * @return array + */ + public function getExpressionData() + { + list($values[], $types[]) = $this->normalizeArgument($this->identifier, self::TYPE_IDENTIFIER); + list($values[], $types[]) = $this->normalizeArgument($this->like, self::TYPE_VALUE); + return [ + [ + $this->specification, + $values, + $types, + ] + ]; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Predicate/Literal.php b/bundled-libs/laminas/laminas-db/src/Sql/Predicate/Literal.php new file mode 100644 index 00000000..d40ed8b3 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Predicate/Literal.php @@ -0,0 +1,15 @@ +'; + const OP_GT = '>'; + + const OPERATOR_GREATER_THAN_OR_EQUAL_TO = '>='; + const OP_GTE = '>='; + + /** + * {@inheritDoc} + */ + protected $allowedTypes = [ + self::TYPE_IDENTIFIER, + self::TYPE_VALUE, + ]; + + /** + * @var int|float|bool|string + */ + protected $left; + + /** + * @var int|float|bool|string + */ + protected $right; + + /** + * @var string + */ + protected $leftType = self::TYPE_IDENTIFIER; + + /** + * @var string + */ + protected $rightType = self::TYPE_VALUE; + + /** + * @var string + */ + protected $operator = self::OPERATOR_EQUAL_TO; + + /** + * Constructor + * + * @param int|float|bool|string $left + * @param string $operator + * @param int|float|bool|string $right + * @param string $leftType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_IDENTIFIER {@see allowedTypes} + * @param string $rightType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_VALUE {@see allowedTypes} + */ + public function __construct( + $left = null, + $operator = self::OPERATOR_EQUAL_TO, + $right = null, + $leftType = self::TYPE_IDENTIFIER, + $rightType = self::TYPE_VALUE + ) { + if ($left !== null) { + $this->setLeft($left); + } + + if ($operator !== self::OPERATOR_EQUAL_TO) { + $this->setOperator($operator); + } + + if ($right !== null) { + $this->setRight($right); + } + + if ($leftType !== self::TYPE_IDENTIFIER) { + $this->setLeftType($leftType); + } + + if ($rightType !== self::TYPE_VALUE) { + $this->setRightType($rightType); + } + } + + /** + * Set left side of operator + * + * @param int|float|bool|string $left + * + * @return self Provides a fluent interface + */ + public function setLeft($left) + { + $this->left = $left; + + if (is_array($left)) { + $left = $this->normalizeArgument($left, $this->leftType); + $this->leftType = $left[1]; + } + + return $this; + } + + /** + * Get left side of operator + * + * @return int|float|bool|string + */ + public function getLeft() + { + return $this->left; + } + + /** + * Set parameter type for left side of operator + * + * @param string $type TYPE_IDENTIFIER or TYPE_VALUE {@see allowedTypes} + * + * @return self Provides a fluent interface + * + * @throws Exception\InvalidArgumentException + */ + public function setLeftType($type) + { + if (! in_array($type, $this->allowedTypes)) { + throw new Exception\InvalidArgumentException(sprintf( + 'Invalid type "%s" provided; must be of type "%s" or "%s"', + $type, + __CLASS__ . '::TYPE_IDENTIFIER', + __CLASS__ . '::TYPE_VALUE' + )); + } + + $this->leftType = $type; + + return $this; + } + + /** + * Get parameter type on left side of operator + * + * @return string + */ + public function getLeftType() + { + return $this->leftType; + } + + /** + * Set operator string + * + * @param string $operator + * @return self Provides a fluent interface + */ + public function setOperator($operator) + { + $this->operator = $operator; + + return $this; + } + + /** + * Get operator string + * + * @return string + */ + public function getOperator() + { + return $this->operator; + } + + /** + * Set right side of operator + * + * @param int|float|bool|string $right + * + * @return self Provides a fluent interface + */ + public function setRight($right) + { + $this->right = $right; + + if (is_array($right)) { + $right = $this->normalizeArgument($right, $this->rightType); + $this->rightType = $right[1]; + } + + return $this; + } + + /** + * Get right side of operator + * + * @return int|float|bool|string + */ + public function getRight() + { + return $this->right; + } + + /** + * Set parameter type for right side of operator + * + * @param string $type TYPE_IDENTIFIER or TYPE_VALUE {@see allowedTypes} + * @return self Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function setRightType($type) + { + if (! in_array($type, $this->allowedTypes)) { + throw new Exception\InvalidArgumentException(sprintf( + 'Invalid type "%s" provided; must be of type "%s" or "%s"', + $type, + __CLASS__ . '::TYPE_IDENTIFIER', + __CLASS__ . '::TYPE_VALUE' + )); + } + + $this->rightType = $type; + + return $this; + } + + /** + * Get parameter type on right side of operator + * + * @return string + */ + public function getRightType() + { + return $this->rightType; + } + + /** + * Get predicate parts for where statement + * + * @return array + */ + public function getExpressionData() + { + list($values[], $types[]) = $this->normalizeArgument($this->left, $this->leftType); + list($values[], $types[]) = $this->normalizeArgument($this->right, $this->rightType); + + return [[ + '%s ' . $this->operator . ' %s', + $values, + $types + ]]; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Predicate/Predicate.php b/bundled-libs/laminas/laminas-db/src/Sql/Predicate/Predicate.php new file mode 100644 index 00000000..f266a661 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Predicate/Predicate.php @@ -0,0 +1,454 @@ +setUnnest($this); + $this->addPredicate($predicateSet, ($this->nextPredicateCombineOperator) ?: $this->defaultCombination); + $this->nextPredicateCombineOperator = null; + return $predicateSet; + } + + /** + * Indicate what predicate will be unnested + * + * @param Predicate $predicate + * @return void + */ + public function setUnnest(Predicate $predicate) + { + $this->unnest = $predicate; + } + + /** + * Indicate end of nested predicate + * + * @return Predicate + * @throws RuntimeException + */ + public function unnest() + { + if ($this->unnest === null) { + throw new RuntimeException('Not nested'); + } + $unnest = $this->unnest; + $this->unnest = null; + return $unnest; + } + + /** + * Create "Equal To" predicate + * + * Utilizes Operator predicate + * + * @param int|float|bool|string|Expression $left + * @param int|float|bool|string|Expression $right + * @param string $leftType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_IDENTIFIER {@see allowedTypes} + * @param string $rightType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_VALUE {@see allowedTypes} + * @return self Provides a fluent interface + */ + public function equalTo($left, $right, $leftType = self::TYPE_IDENTIFIER, $rightType = self::TYPE_VALUE) + { + $this->addPredicate( + new Operator($left, Operator::OPERATOR_EQUAL_TO, $right, $leftType, $rightType), + ($this->nextPredicateCombineOperator) ?: $this->defaultCombination + ); + $this->nextPredicateCombineOperator = null; + + return $this; + } + + /** + * Create "Not Equal To" predicate + * + * Utilizes Operator predicate + * + * @param int|float|bool|string|Expression $left + * @param int|float|bool|string|Expression $right + * @param string $leftType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_IDENTIFIER {@see allowedTypes} + * @param string $rightType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_VALUE {@see allowedTypes} + * @return self Provides a fluent interface + */ + public function notEqualTo($left, $right, $leftType = self::TYPE_IDENTIFIER, $rightType = self::TYPE_VALUE) + { + $this->addPredicate( + new Operator($left, Operator::OPERATOR_NOT_EQUAL_TO, $right, $leftType, $rightType), + ($this->nextPredicateCombineOperator) ?: $this->defaultCombination + ); + $this->nextPredicateCombineOperator = null; + + return $this; + } + + /** + * Create "Less Than" predicate + * + * Utilizes Operator predicate + * + * @param int|float|bool|string|Expression $left + * @param int|float|bool|string|Expression $right + * @param string $leftType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_IDENTIFIER {@see allowedTypes} + * @param string $rightType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_VALUE {@see allowedTypes} + * @return self Provides a fluent interface + */ + public function lessThan($left, $right, $leftType = self::TYPE_IDENTIFIER, $rightType = self::TYPE_VALUE) + { + $this->addPredicate( + new Operator($left, Operator::OPERATOR_LESS_THAN, $right, $leftType, $rightType), + ($this->nextPredicateCombineOperator) ?: $this->defaultCombination + ); + $this->nextPredicateCombineOperator = null; + + return $this; + } + + /** + * Create "Greater Than" predicate + * + * Utilizes Operator predicate + * + * @param int|float|bool|string|Expression $left + * @param int|float|bool|string|Expression $right + * @param string $leftType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_IDENTIFIER {@see allowedTypes} + * @param string $rightType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_VALUE {@see allowedTypes} + * @return self Provides a fluent interface + */ + public function greaterThan($left, $right, $leftType = self::TYPE_IDENTIFIER, $rightType = self::TYPE_VALUE) + { + $this->addPredicate( + new Operator($left, Operator::OPERATOR_GREATER_THAN, $right, $leftType, $rightType), + ($this->nextPredicateCombineOperator) ?: $this->defaultCombination + ); + $this->nextPredicateCombineOperator = null; + + return $this; + } + + /** + * Create "Less Than Or Equal To" predicate + * + * Utilizes Operator predicate + * + * @param int|float|bool|string|Expression $left + * @param int|float|bool|string|Expression $right + * @param string $leftType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_IDENTIFIER {@see allowedTypes} + * @param string $rightType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_VALUE {@see allowedTypes} + * @return self Provides a fluent interface + */ + public function lessThanOrEqualTo($left, $right, $leftType = self::TYPE_IDENTIFIER, $rightType = self::TYPE_VALUE) + { + $this->addPredicate( + new Operator($left, Operator::OPERATOR_LESS_THAN_OR_EQUAL_TO, $right, $leftType, $rightType), + ($this->nextPredicateCombineOperator) ?: $this->defaultCombination + ); + $this->nextPredicateCombineOperator = null; + + return $this; + } + + /** + * Create "Greater Than Or Equal To" predicate + * + * Utilizes Operator predicate + * + * @param int|float|bool|string|Expression $left + * @param int|float|bool|string|Expression $right + * @param string $leftType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_IDENTIFIER {@see allowedTypes} + * @param string $rightType TYPE_IDENTIFIER or TYPE_VALUE by default TYPE_VALUE {@see allowedTypes} + * @return self Provides a fluent interface + */ + public function greaterThanOrEqualTo( + $left, + $right, + $leftType = self::TYPE_IDENTIFIER, + $rightType = self::TYPE_VALUE + ) { + $this->addPredicate( + new Operator($left, Operator::OPERATOR_GREATER_THAN_OR_EQUAL_TO, $right, $leftType, $rightType), + ($this->nextPredicateCombineOperator) ?: $this->defaultCombination + ); + $this->nextPredicateCombineOperator = null; + + return $this; + } + + /** + * Create "Like" predicate + * + * Utilizes Like predicate + * + * @param string|Expression $identifier + * @param string $like + * @return self Provides a fluent interface + */ + public function like($identifier, $like) + { + $this->addPredicate( + new Like($identifier, $like), + ($this->nextPredicateCombineOperator) ?: $this->defaultCombination + ); + $this->nextPredicateCombineOperator = null; + + return $this; + } + /** + * Create "notLike" predicate + * + * Utilizes In predicate + * + * @param string|Expression $identifier + * @param string $notLike + * @return self Provides a fluent interface + */ + public function notLike($identifier, $notLike) + { + $this->addPredicate( + new NotLike($identifier, $notLike), + ($this->nextPredicateCombineOperator) ? : $this->defaultCombination + ); + $this->nextPredicateCombineOperator = null; + return $this; + } + + /** + * Create an expression, with parameter placeholders + * + * @param $expression + * @param $parameters + * @return self Provides a fluent interface + */ + public function expression($expression, $parameters = null) + { + $this->addPredicate( + new Expression($expression, $parameters), + ($this->nextPredicateCombineOperator) ?: $this->defaultCombination + ); + $this->nextPredicateCombineOperator = null; + + return $this; + } + + /** + * Create "Literal" predicate + * + * Literal predicate, for parameters, use expression() + * + * @param string $literal + * @return self Provides a fluent interface + */ + public function literal($literal) + { + // process deprecated parameters from previous literal($literal, $parameters = null) signature + if (func_num_args() >= 2) { + $parameters = func_get_arg(1); + $predicate = new Expression($literal, $parameters); + } + + // normal workflow for "Literals" here + if (! isset($predicate)) { + $predicate = new Literal($literal); + } + + $this->addPredicate( + $predicate, + ($this->nextPredicateCombineOperator) ?: $this->defaultCombination + ); + $this->nextPredicateCombineOperator = null; + + return $this; + } + + /** + * Create "IS NULL" predicate + * + * Utilizes IsNull predicate + * + * @param string|Expression $identifier + * @return self Provides a fluent interface + */ + public function isNull($identifier) + { + $this->addPredicate( + new IsNull($identifier), + ($this->nextPredicateCombineOperator) ?: $this->defaultCombination + ); + $this->nextPredicateCombineOperator = null; + + return $this; + } + + /** + * Create "IS NOT NULL" predicate + * + * Utilizes IsNotNull predicate + * + * @param string|Expression $identifier + * @return self Provides a fluent interface + */ + public function isNotNull($identifier) + { + $this->addPredicate( + new IsNotNull($identifier), + ($this->nextPredicateCombineOperator) ?: $this->defaultCombination + ); + $this->nextPredicateCombineOperator = null; + + return $this; + } + + /** + * Create "IN" predicate + * + * Utilizes In predicate + * + * @param string|Expression $identifier + * @param array|\Laminas\Db\Sql\Select $valueSet + * @return self Provides a fluent interface + */ + public function in($identifier, $valueSet = null) + { + $this->addPredicate( + new In($identifier, $valueSet), + ($this->nextPredicateCombineOperator) ?: $this->defaultCombination + ); + $this->nextPredicateCombineOperator = null; + + return $this; + } + + /** + * Create "NOT IN" predicate + * + * Utilizes NotIn predicate + * + * @param string|Expression $identifier + * @param array|\Laminas\Db\Sql\Select $valueSet + * @return self Provides a fluent interface + */ + public function notIn($identifier, $valueSet = null) + { + $this->addPredicate( + new NotIn($identifier, $valueSet), + ($this->nextPredicateCombineOperator) ?: $this->defaultCombination + ); + $this->nextPredicateCombineOperator = null; + + return $this; + } + + /** + * Create "between" predicate + * + * Utilizes Between predicate + * + * @param string|Expression $identifier + * @param int|float|string $minValue + * @param int|float|string $maxValue + * @return self Provides a fluent interface + */ + public function between($identifier, $minValue, $maxValue) + { + $this->addPredicate( + new Between($identifier, $minValue, $maxValue), + ($this->nextPredicateCombineOperator) ?: $this->defaultCombination + ); + $this->nextPredicateCombineOperator = null; + + return $this; + } + + /** + * Create "NOT BETWEEN" predicate + * + * Utilizes NotBetween predicate + * + * @param string|Expression $identifier + * @param int|float|string $minValue + * @param int|float|string $maxValue + * @return self Provides a fluent interface + */ + public function notBetween($identifier, $minValue, $maxValue) + { + $this->addPredicate( + new NotBetween($identifier, $minValue, $maxValue), + ($this->nextPredicateCombineOperator) ?: $this->defaultCombination + ); + $this->nextPredicateCombineOperator = null; + + return $this; + } + + /** + * Use given predicate directly + * + * Contrary to {@link addPredicate()} this method respects formerly set + * AND / OR combination operator, thus allowing generic predicates to be + * used fluently within where chains as any other concrete predicate. + * + * @param PredicateInterface $predicate + * @return self Provides a fluent interface + */ + public function predicate(PredicateInterface $predicate) + { + $this->addPredicate( + $predicate, + $this->nextPredicateCombineOperator ?: $this->defaultCombination + ); + $this->nextPredicateCombineOperator = null; + + return $this; + } + + /** + * Overloading + * + * Overloads "or", "and", "nest", and "unnest" + * + * @param string $name + * @return self Provides a fluent interface + */ + public function __get($name) + { + switch (strtolower($name)) { + case 'or': + $this->nextPredicateCombineOperator = self::OP_OR; + break; + case 'and': + $this->nextPredicateCombineOperator = self::OP_AND; + break; + case 'nest': + return $this->nest(); + case 'unnest': + return $this->unnest(); + } + return $this; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Predicate/PredicateInterface.php b/bundled-libs/laminas/laminas-db/src/Sql/Predicate/PredicateInterface.php new file mode 100644 index 00000000..5777aec9 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Predicate/PredicateInterface.php @@ -0,0 +1,15 @@ +defaultCombination = $defaultCombination; + if ($predicates) { + foreach ($predicates as $predicate) { + $this->addPredicate($predicate); + } + } + } + + /** + * Add predicate to set + * + * @param PredicateInterface $predicate + * @param string $combination + * @return self Provides a fluent interface + */ + public function addPredicate(PredicateInterface $predicate, $combination = null) + { + if ($combination === null || ! in_array($combination, [self::OP_AND, self::OP_OR])) { + $combination = $this->defaultCombination; + } + + if ($combination == self::OP_OR) { + $this->orPredicate($predicate); + return $this; + } + + $this->andPredicate($predicate); + return $this; + } + + /** + * Add predicates to set + * + * @param PredicateInterface|\Closure|string|array $predicates + * @param string $combination + * @return self Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function addPredicates($predicates, $combination = self::OP_AND) + { + if ($predicates === null) { + throw new Exception\InvalidArgumentException('Predicate cannot be null'); + } + if ($predicates instanceof PredicateInterface) { + $this->addPredicate($predicates, $combination); + return $this; + } + if ($predicates instanceof \Closure) { + $predicates($this); + return $this; + } + if (is_string($predicates)) { + // String $predicate should be passed as an expression + $predicate = (strpos($predicates, Expression::PLACEHOLDER) !== false) + ? new Expression($predicates) : new Literal($predicates); + $this->addPredicate($predicate, $combination); + return $this; + } + if (is_array($predicates)) { + foreach ($predicates as $pkey => $pvalue) { + // loop through predicates + if (is_string($pkey)) { + if (strpos($pkey, '?') !== false) { + // First, process strings that the abstraction replacement character ? + // as an Expression predicate + $predicate = new Expression($pkey, $pvalue); + } elseif ($pvalue === null) { + // Otherwise, if still a string, do something intelligent with the PHP type provided + // map PHP null to SQL IS NULL expression + $predicate = new IsNull($pkey); + } elseif (is_array($pvalue)) { + // if the value is an array, assume IN() is desired + $predicate = new In($pkey, $pvalue); + } elseif ($pvalue instanceof PredicateInterface) { + throw new Exception\InvalidArgumentException( + 'Using Predicate must not use string keys' + ); + } else { + // otherwise assume that array('foo' => 'bar') means "foo" = 'bar' + $predicate = new Operator($pkey, Operator::OP_EQ, $pvalue); + } + } elseif ($pvalue instanceof PredicateInterface) { + // Predicate type is ok + $predicate = $pvalue; + } else { + // must be an array of expressions (with int-indexed array) + $predicate = (strpos($pvalue, Expression::PLACEHOLDER) !== false) + ? new Expression($pvalue) : new Literal($pvalue); + } + $this->addPredicate($predicate, $combination); + } + } + return $this; + } + + /** + * Return the predicates + * + * @return PredicateInterface[] + */ + public function getPredicates() + { + return $this->predicates; + } + + /** + * Add predicate using OR operator + * + * @param PredicateInterface $predicate + * @return self Provides a fluent interface + */ + public function orPredicate(PredicateInterface $predicate) + { + $this->predicates[] = [self::OP_OR, $predicate]; + return $this; + } + + /** + * Add predicate using AND operator + * + * @param PredicateInterface $predicate + * @return self Provides a fluent interface + */ + public function andPredicate(PredicateInterface $predicate) + { + $this->predicates[] = [self::OP_AND, $predicate]; + return $this; + } + + /** + * Get predicate parts for where statement + * + * @return array + */ + public function getExpressionData() + { + $parts = []; + for ($i = 0, $count = count($this->predicates); $i < $count; $i++) { + /** @var $predicate PredicateInterface */ + $predicate = $this->predicates[$i][1]; + + if ($predicate instanceof PredicateSet) { + $parts[] = '('; + } + + $parts = array_merge($parts, $predicate->getExpressionData()); + + if ($predicate instanceof PredicateSet) { + $parts[] = ')'; + } + + if (isset($this->predicates[$i + 1])) { + $parts[] = sprintf(' %s ', $this->predicates[$i + 1][0]); + } + } + return $parts; + } + + /** + * Get count of attached predicates + * + * @return int + */ + public function count() + { + return count($this->predicates); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/PreparableSqlInterface.php b/bundled-libs/laminas/laminas-db/src/Sql/PreparableSqlInterface.php new file mode 100644 index 00000000..3d2a2a8d --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/PreparableSqlInterface.php @@ -0,0 +1,23 @@ + '%1$s', + self::SELECT => [ + 'SELECT %1$s FROM %2$s' => [ + [1 => '%1$s', 2 => '%1$s AS %2$s', 'combinedby' => ', '], + null + ], + 'SELECT %1$s %2$s FROM %3$s' => [ + null, + [1 => '%1$s', 2 => '%1$s AS %2$s', 'combinedby' => ', '], + null + ], + 'SELECT %1$s' => [ + [1 => '%1$s', 2 => '%1$s AS %2$s', 'combinedby' => ', '], + ], + ], + self::JOINS => [ + '%1$s' => [ + [3 => '%1$s JOIN %2$s ON %3$s', 'combinedby' => ' '] + ] + ], + self::WHERE => 'WHERE %1$s', + self::GROUP => [ + 'GROUP BY %1$s' => [ + [1 => '%1$s', 'combinedby' => ', '] + ] + ], + self::HAVING => 'HAVING %1$s', + self::ORDER => [ + 'ORDER BY %1$s' => [ + [1 => '%1$s', 2 => '%1$s %2$s', 'combinedby' => ', '] + ] + ], + self::LIMIT => 'LIMIT %1$s', + self::OFFSET => 'OFFSET %1$s', + 'statementEnd' => '%1$s', + self::COMBINE => '%1$s ( %2$s )', + ]; + + /** + * @var bool + */ + protected $tableReadOnly = false; + + /** + * @var bool + */ + protected $prefixColumnsWithTable = true; + + /** + * @var string|array|TableIdentifier + */ + protected $table = null; + + /** + * @var null|string|Expression + */ + protected $quantifier = null; + + /** + * @var array + */ + protected $columns = [self::SQL_STAR]; + + /** + * @var null|Join + */ + protected $joins = null; + + /** + * @var Where + */ + protected $where = null; + + /** + * @var array + */ + protected $order = []; + + /** + * @var null|array + */ + protected $group = null; + + /** + * @var null|string|array + */ + protected $having = null; + + /** + * @var int|null + */ + protected $limit = null; + + /** + * @var int|null + */ + protected $offset = null; + + /** + * @var array + */ + protected $combine = []; + + /** + * Constructor + * + * @param null|string|array|TableIdentifier $table + */ + public function __construct($table = null) + { + if ($table) { + $this->from($table); + $this->tableReadOnly = true; + } + + $this->where = new Where; + $this->joins = new Join; + $this->having = new Having; + } + + /** + * Create from clause + * + * @param string|array|TableIdentifier $table + * @return self Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function from($table) + { + if ($this->tableReadOnly) { + throw new Exception\InvalidArgumentException( + 'Since this object was created with a table and/or schema in the constructor, it is read only.' + ); + } + + if (! is_string($table) && ! is_array($table) && ! $table instanceof TableIdentifier) { + throw new Exception\InvalidArgumentException( + '$table must be a string, array, or an instance of TableIdentifier' + ); + } + + if (is_array($table) && (! is_string(key($table)) || count($table) !== 1)) { + throw new Exception\InvalidArgumentException( + 'from() expects $table as an array is a single element associative array' + ); + } + + $this->table = $table; + return $this; + } + + /** + * @param string|Expression $quantifier DISTINCT|ALL + * @return self Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function quantifier($quantifier) + { + if (! is_string($quantifier) && ! $quantifier instanceof ExpressionInterface) { + throw new Exception\InvalidArgumentException( + 'Quantifier must be one of DISTINCT, ALL, or some platform specific object implementing ' + . 'ExpressionInterface' + ); + } + $this->quantifier = $quantifier; + return $this; + } + + /** + * Specify columns from which to select + * + * Possible valid states: + * + * array(*) + * + * array(value, ...) + * value can be strings or Expression objects + * + * array(string => value, ...) + * key string will be use as alias, + * value can be string or Expression objects + * + * @param array $columns + * @param bool $prefixColumnsWithTable + * @return self Provides a fluent interface + */ + public function columns(array $columns, $prefixColumnsWithTable = true) + { + $this->columns = $columns; + $this->prefixColumnsWithTable = (bool) $prefixColumnsWithTable; + return $this; + } + + /** + * Create join clause + * + * @param string|array|TableIdentifier $name + * @param string|Predicate\Expression $on + * @param string|array $columns + * @param string $type one of the JOIN_* constants + * @return self Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function join($name, $on, $columns = self::SQL_STAR, $type = self::JOIN_INNER) + { + $this->joins->join($name, $on, $columns, $type); + + return $this; + } + + /** + * Create where clause + * + * @param Where|\Closure|string|array|Predicate\PredicateInterface $predicate + * @param string $combination One of the OP_* constants from Predicate\PredicateSet + * @return self Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function where($predicate, $combination = Predicate\PredicateSet::OP_AND) + { + if ($predicate instanceof Where) { + $this->where = $predicate; + } else { + $this->where->addPredicates($predicate, $combination); + } + return $this; + } + + /** + * @param mixed $group + * @return self Provides a fluent interface + */ + public function group($group) + { + if (is_array($group)) { + foreach ($group as $o) { + $this->group[] = $o; + } + } else { + $this->group[] = $group; + } + return $this; + } + + /** + * Create having clause + * + * @param Where|\Closure|string|array $predicate + * @param string $combination One of the OP_* constants from Predicate\PredicateSet + * @return self Provides a fluent interface + */ + public function having($predicate, $combination = Predicate\PredicateSet::OP_AND) + { + if ($predicate instanceof Having) { + $this->having = $predicate; + } else { + $this->having->addPredicates($predicate, $combination); + } + return $this; + } + + /** + * @param string|array|Expression $order + * @return self Provides a fluent interface + */ + public function order($order) + { + if (is_string($order)) { + if (strpos($order, ',') !== false) { + $order = preg_split('#,\s+#', $order); + } else { + $order = (array) $order; + } + } elseif (! is_array($order)) { + $order = [$order]; + } + foreach ($order as $k => $v) { + if (is_string($k)) { + $this->order[$k] = $v; + } else { + $this->order[] = $v; + } + } + return $this; + } + + /** + * @param int $limit + * @return self Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function limit($limit) + { + if (! is_numeric($limit)) { + throw new Exception\InvalidArgumentException(sprintf( + '%s expects parameter to be numeric, "%s" given', + __METHOD__, + (is_object($limit) ? get_class($limit) : gettype($limit)) + )); + } + + $this->limit = $limit; + return $this; + } + + /** + * @param int $offset + * @return self Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function offset($offset) + { + if (! is_numeric($offset)) { + throw new Exception\InvalidArgumentException(sprintf( + '%s expects parameter to be numeric, "%s" given', + __METHOD__, + (is_object($offset) ? get_class($offset) : gettype($offset)) + )); + } + + $this->offset = $offset; + return $this; + } + + /** + * @param Select $select + * @param string $type + * @param string $modifier + * @return self Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function combine(Select $select, $type = self::COMBINE_UNION, $modifier = '') + { + if ($this->combine !== []) { + throw new Exception\InvalidArgumentException( + 'This Select object is already combined and cannot be combined with multiple Selects objects' + ); + } + $this->combine = [ + 'select' => $select, + 'type' => $type, + 'modifier' => $modifier + ]; + return $this; + } + + /** + * @param string $part + * @return self Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function reset($part) + { + switch ($part) { + case self::TABLE: + if ($this->tableReadOnly) { + throw new Exception\InvalidArgumentException( + 'Since this object was created with a table and/or schema in the constructor, it is read only.' + ); + } + $this->table = null; + break; + case self::QUANTIFIER: + $this->quantifier = null; + break; + case self::COLUMNS: + $this->columns = []; + break; + case self::JOINS: + $this->joins = new Join; + break; + case self::WHERE: + $this->where = new Where; + break; + case self::GROUP: + $this->group = null; + break; + case self::HAVING: + $this->having = new Having; + break; + case self::LIMIT: + $this->limit = null; + break; + case self::OFFSET: + $this->offset = null; + break; + case self::ORDER: + $this->order = []; + break; + case self::COMBINE: + $this->combine = []; + break; + } + return $this; + } + + /** + * @param $index + * @param $specification + * @return self Provides a fluent interface + */ + public function setSpecification($index, $specification) + { + if (! method_exists($this, 'process' . $index)) { + throw new Exception\InvalidArgumentException('Not a valid specification name.'); + } + $this->specifications[$index] = $specification; + return $this; + } + + public function getRawState($key = null) + { + $rawState = [ + self::TABLE => $this->table, + self::QUANTIFIER => $this->quantifier, + self::COLUMNS => $this->columns, + self::JOINS => $this->joins, + self::WHERE => $this->where, + self::ORDER => $this->order, + self::GROUP => $this->group, + self::HAVING => $this->having, + self::LIMIT => $this->limit, + self::OFFSET => $this->offset, + self::COMBINE => $this->combine + ]; + return (isset($key) && array_key_exists($key, $rawState)) ? $rawState[$key] : $rawState; + } + + /** + * Returns whether the table is read only or not. + * + * @return bool + */ + public function isTableReadOnly() + { + return $this->tableReadOnly; + } + + protected function processStatementStart( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + if ($this->combine !== []) { + return ['(']; + } + } + + protected function processStatementEnd( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + if ($this->combine !== []) { + return [')']; + } + } + + /** + * Process the select part + * + * @param PlatformInterface $platform + * @param DriverInterface $driver + * @param ParameterContainer $parameterContainer + * @return null|array + */ + protected function processSelect( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + $expr = 1; + + list($table, $fromTable) = $this->resolveTable($this->table, $platform, $driver, $parameterContainer); + // process table columns + $columns = []; + foreach ($this->columns as $columnIndexOrAs => $column) { + if ($column === self::SQL_STAR) { + $columns[] = [$fromTable . self::SQL_STAR]; + continue; + } + + $columnName = $this->resolveColumnValue( + [ + 'column' => $column, + 'fromTable' => $fromTable, + 'isIdentifier' => true, + ], + $platform, + $driver, + $parameterContainer, + (is_string($columnIndexOrAs) ? $columnIndexOrAs : 'column') + ); + // process As portion + if (is_string($columnIndexOrAs)) { + $columnAs = $platform->quoteIdentifier($columnIndexOrAs); + } elseif (stripos($columnName, ' as ') === false) { + $columnAs = (is_string($column)) ? $platform->quoteIdentifier($column) : 'Expression' . $expr++; + } + $columns[] = (isset($columnAs)) ? [$columnName, $columnAs] : [$columnName]; + } + + // process join columns + foreach ($this->joins->getJoins() as $join) { + $joinName = (is_array($join['name'])) ? key($join['name']) : $join['name']; + $joinName = parent::resolveTable($joinName, $platform, $driver, $parameterContainer); + + foreach ($join['columns'] as $jKey => $jColumn) { + $jColumns = []; + $jFromTable = is_scalar($jColumn) + ? $joinName . $platform->getIdentifierSeparator() + : ''; + $jColumns[] = $this->resolveColumnValue( + [ + 'column' => $jColumn, + 'fromTable' => $jFromTable, + 'isIdentifier' => true, + ], + $platform, + $driver, + $parameterContainer, + (is_string($jKey) ? $jKey : 'column') + ); + if (is_string($jKey)) { + $jColumns[] = $platform->quoteIdentifier($jKey); + } elseif ($jColumn !== self::SQL_STAR) { + $jColumns[] = $platform->quoteIdentifier($jColumn); + } + $columns[] = $jColumns; + } + } + + if ($this->quantifier) { + $quantifier = ($this->quantifier instanceof ExpressionInterface) + ? $this->processExpression($this->quantifier, $platform, $driver, $parameterContainer, 'quantifier') + : $this->quantifier; + } + + if (! isset($table)) { + return [$columns]; + } elseif (isset($quantifier)) { + return [$quantifier, $columns, $table]; + } else { + return [$columns, $table]; + } + } + + protected function processJoins( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + return $this->processJoin($this->joins, $platform, $driver, $parameterContainer); + } + + protected function processWhere( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + if ($this->where->count() == 0) { + return; + } + return [ + $this->processExpression($this->where, $platform, $driver, $parameterContainer, 'where') + ]; + } + + protected function processGroup( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + if ($this->group === null) { + return; + } + // process table columns + $groups = []; + foreach ($this->group as $column) { + $groups[] = $this->resolveColumnValue( + [ + 'column' => $column, + 'isIdentifier' => true, + ], + $platform, + $driver, + $parameterContainer, + 'group' + ); + } + return [$groups]; + } + + protected function processHaving( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + if ($this->having->count() == 0) { + return; + } + return [ + $this->processExpression($this->having, $platform, $driver, $parameterContainer, 'having') + ]; + } + + protected function processOrder( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + if (empty($this->order)) { + return; + } + $orders = []; + foreach ($this->order as $k => $v) { + if ($v instanceof ExpressionInterface) { + $orders[] = [ + $this->processExpression($v, $platform, $driver, $parameterContainer) + ]; + continue; + } + if (is_int($k)) { + if (strpos($v, ' ') !== false) { + list($k, $v) = preg_split('# #', $v, 2); + } else { + $k = $v; + $v = self::ORDER_ASCENDING; + } + } + if (strcasecmp(trim($v), self::ORDER_DESCENDING) === 0) { + $orders[] = [$platform->quoteIdentifierInFragment($k), self::ORDER_DESCENDING]; + } else { + $orders[] = [$platform->quoteIdentifierInFragment($k), self::ORDER_ASCENDING]; + } + } + return [$orders]; + } + + protected function processLimit( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + if ($this->limit === null) { + return; + } + if ($parameterContainer) { + $paramPrefix = $this->processInfo['paramPrefix']; + $parameterContainer->offsetSet($paramPrefix . 'limit', $this->limit, ParameterContainer::TYPE_INTEGER); + return [$driver->formatParameterName($paramPrefix . 'limit')]; + } + return [$platform->quoteValue($this->limit)]; + } + + protected function processOffset( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + if ($this->offset === null) { + return; + } + if ($parameterContainer) { + $paramPrefix = $this->processInfo['paramPrefix']; + $parameterContainer->offsetSet($paramPrefix . 'offset', $this->offset, ParameterContainer::TYPE_INTEGER); + return [$driver->formatParameterName($paramPrefix . 'offset')]; + } + + return [$platform->quoteValue($this->offset)]; + } + + protected function processCombine( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + if ($this->combine == []) { + return; + } + + $type = $this->combine['type']; + if ($this->combine['modifier']) { + $type .= ' ' . $this->combine['modifier']; + } + + return [ + strtoupper($type), + $this->processSubSelect($this->combine['select'], $platform, $driver, $parameterContainer), + ]; + } + + /** + * Variable overloading + * + * @param string $name + * @throws Exception\InvalidArgumentException + * @return mixed + */ + public function __get($name) + { + switch (strtolower($name)) { + case 'where': + return $this->where; + case 'having': + return $this->having; + case 'joins': + return $this->joins; + default: + throw new Exception\InvalidArgumentException('Not a valid magic property for this object'); + } + } + + /** + * __clone + * + * Resets the where object each time the Select is cloned. + * + * @return void + */ + public function __clone() + { + $this->where = clone $this->where; + $this->joins = clone $this->joins; + $this->having = clone $this->having; + } + + /** + * @param string|TableIdentifier|Select $table + * @param PlatformInterface $platform + * @param DriverInterface $driver + * @param ParameterContainer $parameterContainer + * @return string + */ + protected function resolveTable( + $table, + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + $alias = null; + + if (is_array($table)) { + $alias = key($table); + $table = current($table); + } + + $table = parent::resolveTable($table, $platform, $driver, $parameterContainer); + + if ($alias) { + $fromTable = $platform->quoteIdentifier($alias); + $table = $this->renderTable($table, $fromTable); + } else { + $fromTable = $table; + } + + if ($this->prefixColumnsWithTable && $fromTable) { + $fromTable .= $platform->getIdentifierSeparator(); + } else { + $fromTable = ''; + } + + return [ + $table, + $fromTable + ]; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Sql.php b/bundled-libs/laminas/laminas-db/src/Sql/Sql.php new file mode 100644 index 00000000..25013530 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Sql.php @@ -0,0 +1,173 @@ +adapter = $adapter; + if ($table) { + $this->setTable($table); + } + $this->sqlPlatform = $sqlPlatform ?: new Platform\Platform($adapter); + } + + /** + * @return null|\Laminas\Db\Adapter\AdapterInterface + */ + public function getAdapter() + { + return $this->adapter; + } + + public function hasTable() + { + return ($this->table !== null); + } + + /** + * @param string|array|TableIdentifier $table + * @return self Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function setTable($table) + { + if (is_string($table) || is_array($table) || $table instanceof TableIdentifier) { + $this->table = $table; + } else { + throw new Exception\InvalidArgumentException( + 'Table must be a string, array or instance of TableIdentifier.' + ); + } + return $this; + } + + public function getTable() + { + return $this->table; + } + + public function getSqlPlatform() + { + return $this->sqlPlatform; + } + + public function select($table = null) + { + if ($this->table !== null && $table !== null) { + throw new Exception\InvalidArgumentException(sprintf( + 'This Sql object is intended to work with only the table "%s" provided at construction time.', + $this->table + )); + } + return new Select(($table) ?: $this->table); + } + + public function insert($table = null) + { + if ($this->table !== null && $table !== null) { + throw new Exception\InvalidArgumentException(sprintf( + 'This Sql object is intended to work with only the table "%s" provided at construction time.', + $this->table + )); + } + return new Insert(($table) ?: $this->table); + } + + public function update($table = null) + { + if ($this->table !== null && $table !== null) { + throw new Exception\InvalidArgumentException(sprintf( + 'This Sql object is intended to work with only the table "%s" provided at construction time.', + $this->table + )); + } + return new Update(($table) ?: $this->table); + } + + public function delete($table = null) + { + if ($this->table !== null && $table !== null) { + throw new Exception\InvalidArgumentException(sprintf( + 'This Sql object is intended to work with only the table "%s" provided at construction time.', + $this->table + )); + } + return new Delete(($table) ?: $this->table); + } + + /** + * @param PreparableSqlInterface $sqlObject + * @param StatementInterface $statement + * @param AdapterInterface $adapter + * + * @return StatementInterface + */ + public function prepareStatementForSqlObject( + PreparableSqlInterface $sqlObject, + StatementInterface $statement = null, + AdapterInterface $adapter = null + ) { + $adapter = $adapter ?: $this->adapter; + $statement = $statement ?: $adapter->getDriver()->createStatement(); + + return $this->sqlPlatform->setSubject($sqlObject)->prepareStatement($adapter, $statement); + } + + /** + * Get sql string using platform or sql object + * + * @param SqlInterface $sqlObject + * @param PlatformInterface|null $platform + * + * @return string + * + * @deprecated Deprecated in 2.4. Use buildSqlString() instead + */ + public function getSqlStringForSqlObject(SqlInterface $sqlObject, PlatformInterface $platform = null) + { + $platform = ($platform) ?: $this->adapter->getPlatform(); + return $this->sqlPlatform->setSubject($sqlObject)->getSqlString($platform); + } + + /** + * @param SqlInterface $sqlObject + * @param AdapterInterface $adapter + * + * @return string + * + * @throws Exception\InvalidArgumentException + */ + public function buildSqlString(SqlInterface $sqlObject, AdapterInterface $adapter = null) + { + return $this + ->sqlPlatform + ->setSubject($sqlObject) + ->getSqlString($adapter ? $adapter->getPlatform() : $this->adapter->getPlatform()); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/SqlInterface.php b/bundled-libs/laminas/laminas-db/src/Sql/SqlInterface.php new file mode 100644 index 00000000..b45edb30 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/SqlInterface.php @@ -0,0 +1,23 @@ +table = (string) $table; + + if ('' === $this->table) { + throw new Exception\InvalidArgumentException('$table must be a valid table name, empty string given'); + } + + if (null === $schema) { + $this->schema = null; + } else { + if (! (is_string($schema) || is_callable([$schema, '__toString']))) { + throw new Exception\InvalidArgumentException(sprintf( + '$schema must be a valid schema name, parameter of type %s given', + is_object($schema) ? get_class($schema) : gettype($schema) + )); + } + + $this->schema = (string) $schema; + + if ('' === $this->schema) { + throw new Exception\InvalidArgumentException( + '$schema must be a valid schema name or null, empty string given' + ); + } + } + } + + /** + * @param string $table + * + * @deprecated please use the constructor and build a new {@see TableIdentifier} instead + */ + public function setTable($table) + { + $this->table = $table; + } + + /** + * @return string + */ + public function getTable() + { + return $this->table; + } + + /** + * @return bool + */ + public function hasSchema() + { + return ($this->schema !== null); + } + + /** + * @param $schema + * + * @deprecated please use the constructor and build a new {@see TableIdentifier} instead + */ + public function setSchema($schema) + { + $this->schema = $schema; + } + + /** + * @return null|string + */ + public function getSchema() + { + return $this->schema; + } + + public function getTableAndSchema() + { + return [$this->table, $this->schema]; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Update.php b/bundled-libs/laminas/laminas-db/src/Sql/Update.php new file mode 100644 index 00000000..3ad1d9b5 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Update.php @@ -0,0 +1,272 @@ + 'UPDATE %1$s', + self::SPECIFICATION_JOIN => [ + '%1$s' => [ + [3 => '%1$s JOIN %2$s ON %3$s', 'combinedby' => ' '] + ] + ], + self::SPECIFICATION_SET => 'SET %1$s', + self::SPECIFICATION_WHERE => 'WHERE %1$s', + ]; + + /** + * @var string|TableIdentifier + */ + protected $table = ''; + + /** + * @var bool + */ + protected $emptyWhereProtection = true; + + /** + * @var PriorityList + */ + protected $set; + + /** + * @var string|Where + */ + protected $where = null; + + /** + * @var null|Join + */ + protected $joins = null; + + /** + * Constructor + * + * @param null|string|TableIdentifier $table + */ + public function __construct($table = null) + { + if ($table) { + $this->table($table); + } + $this->where = new Where(); + $this->joins = new Join(); + $this->set = new PriorityList(); + $this->set->isLIFO(false); + } + + /** + * Specify table for statement + * + * @param string|TableIdentifier $table + * @return self Provides a fluent interface + */ + public function table($table) + { + $this->table = $table; + return $this; + } + + /** + * Set key/value pairs to update + * + * @param array $values Associative array of key values + * @param string $flag One of the VALUES_* constants + * @return self Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function set(array $values, $flag = self::VALUES_SET) + { + if ($flag == self::VALUES_SET) { + $this->set->clear(); + } + $priority = is_numeric($flag) ? $flag : 0; + foreach ($values as $k => $v) { + if (! is_string($k)) { + throw new Exception\InvalidArgumentException('set() expects a string for the value key'); + } + $this->set->insert($k, $v, $priority); + } + return $this; + } + + /** + * Create where clause + * + * @param Where|\Closure|string|array $predicate + * @param string $combination One of the OP_* constants from Predicate\PredicateSet + * @return self Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function where($predicate, $combination = Predicate\PredicateSet::OP_AND) + { + if ($predicate instanceof Where) { + $this->where = $predicate; + } else { + $this->where->addPredicates($predicate, $combination); + } + return $this; + } + + /** + * Create join clause + * + * @param string|array $name + * @param string $on + * @param string $type one of the JOIN_* constants + * @return self Provides a fluent interface + * @throws Exception\InvalidArgumentException + */ + public function join($name, $on, $type = Join::JOIN_INNER) + { + $this->joins->join($name, $on, [], $type); + + return $this; + } + + public function getRawState($key = null) + { + $rawState = [ + 'emptyWhereProtection' => $this->emptyWhereProtection, + 'table' => $this->table, + 'set' => $this->set->toArray(), + 'where' => $this->where, + 'joins' => $this->joins + ]; + return (isset($key) && array_key_exists($key, $rawState)) ? $rawState[$key] : $rawState; + } + + protected function processUpdate( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + return sprintf( + $this->specifications[static::SPECIFICATION_UPDATE], + $this->resolveTable($this->table, $platform, $driver, $parameterContainer) + ); + } + + protected function processSet( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + $setSql = []; + $i = 0; + foreach ($this->set as $column => $value) { + $prefix = $this->resolveColumnValue( + [ + 'column' => $column, + 'fromTable' => '', + 'isIdentifier' => true, + ], + $platform, + $driver, + $parameterContainer, + 'column' + ); + $prefix .= ' = '; + if (is_scalar($value) && $parameterContainer) { + // use incremental value instead of column name for PDO + // @see https://github.com/zendframework/zend-db/issues/35 + if ($driver instanceof Pdo) { + $column = 'c_' . $i++; + } + $setSql[] = $prefix . $driver->formatParameterName($column); + $parameterContainer->offsetSet($column, $value); + } else { + $setSql[] = $prefix . $this->resolveColumnValue( + $value, + $platform, + $driver, + $parameterContainer + ); + } + } + + return sprintf( + $this->specifications[static::SPECIFICATION_SET], + implode(', ', $setSql) + ); + } + + protected function processWhere( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + if ($this->where->count() == 0) { + return; + } + return sprintf( + $this->specifications[static::SPECIFICATION_WHERE], + $this->processExpression($this->where, $platform, $driver, $parameterContainer, 'where') + ); + } + + protected function processJoins( + PlatformInterface $platform, + DriverInterface $driver = null, + ParameterContainer $parameterContainer = null + ) { + return $this->processJoin($this->joins, $platform, $driver, $parameterContainer); + } + + /** + * Variable overloading + * + * Proxies to "where" only + * + * @param string $name + * @return mixed + */ + public function __get($name) + { + if (strtolower($name) == 'where') { + return $this->where; + } + } + + /** + * __clone + * + * Resets the where object each time the Update is cloned. + * + * @return void + */ + public function __clone() + { + $this->where = clone $this->where; + $this->set = clone $this->set; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/Sql/Where.php b/bundled-libs/laminas/laminas-db/src/Sql/Where.php new file mode 100644 index 00000000..634bc279 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/Sql/Where.php @@ -0,0 +1,13 @@ +isInitialized; + } + + /** + * Initialize + * + * @throws Exception\RuntimeException + * @return null + */ + public function initialize() + { + if ($this->isInitialized) { + return; + } + + if (! $this->featureSet instanceof Feature\FeatureSet) { + $this->featureSet = new Feature\FeatureSet; + } + + $this->featureSet->setTableGateway($this); + $this->featureSet->apply(EventFeatureEventsInterface::EVENT_PRE_INITIALIZE, []); + + if (! $this->adapter instanceof AdapterInterface) { + throw new Exception\RuntimeException('This table does not have an Adapter setup'); + } + + if (! is_string($this->table) && ! $this->table instanceof TableIdentifier && ! is_array($this->table)) { + throw new Exception\RuntimeException('This table object does not have a valid table set.'); + } + + if (! $this->resultSetPrototype instanceof ResultSetInterface) { + $this->resultSetPrototype = new ResultSet; + } + + if (! $this->sql instanceof Sql) { + $this->sql = new Sql($this->adapter, $this->table); + } + + $this->featureSet->apply(EventFeatureEventsInterface::EVENT_POST_INITIALIZE, []); + + $this->isInitialized = true; + } + + /** + * Get table name + * + * @return string + */ + public function getTable() + { + return $this->table; + } + + /** + * Get adapter + * + * @return AdapterInterface + */ + public function getAdapter() + { + return $this->adapter; + } + + /** + * @return array + */ + public function getColumns() + { + return $this->columns; + } + + /** + * @return Feature\FeatureSet + */ + public function getFeatureSet() + { + return $this->featureSet; + } + + /** + * Get select result prototype + * + * @return ResultSetInterface + */ + public function getResultSetPrototype() + { + return $this->resultSetPrototype; + } + + /** + * @return Sql + */ + public function getSql() + { + return $this->sql; + } + + /** + * Select + * + * @param Where|\Closure|string|array $where + * @return ResultSetInterface + */ + public function select($where = null) + { + if (! $this->isInitialized) { + $this->initialize(); + } + + $select = $this->sql->select(); + + if ($where instanceof \Closure) { + $where($select); + } elseif ($where !== null) { + $select->where($where); + } + + return $this->selectWith($select); + } + + /** + * @param Select $select + * @return ResultSetInterface + */ + public function selectWith(Select $select) + { + if (! $this->isInitialized) { + $this->initialize(); + } + return $this->executeSelect($select); + } + + /** + * @param Select $select + * @return ResultSetInterface + * @throws Exception\RuntimeException + */ + protected function executeSelect(Select $select) + { + $selectState = $select->getRawState(); + if (isset($selectState['table']) + && $selectState['table'] != $this->table + && (is_array($selectState['table']) + && end($selectState['table']) != $this->table) + ) { + throw new Exception\RuntimeException( + 'The table name of the provided Select object must match that of the table' + ); + } + + if (isset($selectState['columns']) + && $selectState['columns'] == [Select::SQL_STAR] + && $this->columns !== []) { + $select->columns($this->columns); + } + + // apply preSelect features + $this->featureSet->apply(EventFeatureEventsInterface::EVENT_PRE_SELECT, [$select]); + + // prepare and execute + $statement = $this->sql->prepareStatementForSqlObject($select); + $result = $statement->execute(); + + // build result set + $resultSet = clone $this->resultSetPrototype; + $resultSet->initialize($result); + + // apply postSelect features + $this->featureSet->apply(EventFeatureEventsInterface::EVENT_POST_SELECT, [$statement, $result, $resultSet]); + + return $resultSet; + } + + /** + * Insert + * + * @param array $set + * @return int + */ + public function insert($set) + { + if (! $this->isInitialized) { + $this->initialize(); + } + $insert = $this->sql->insert(); + $insert->values($set); + return $this->executeInsert($insert); + } + + /** + * @param Insert $insert + * @return int + */ + public function insertWith(Insert $insert) + { + if (! $this->isInitialized) { + $this->initialize(); + } + return $this->executeInsert($insert); + } + + /** + * @todo add $columns support + * + * @param Insert $insert + * @return int + * @throws Exception\RuntimeException + */ + protected function executeInsert(Insert $insert) + { + $insertState = $insert->getRawState(); + if ($insertState['table'] != $this->table) { + throw new Exception\RuntimeException( + 'The table name of the provided Insert object must match that of the table' + ); + } + + // apply preInsert features + $this->featureSet->apply(EventFeatureEventsInterface::EVENT_PRE_INSERT, [$insert]); + + // Most RDBMS solutions do not allow using table aliases in INSERTs + // See https://github.com/zendframework/zf2/issues/7311 + $unaliasedTable = false; + if (is_array($insertState['table'])) { + $tableData = array_values($insertState['table']); + $unaliasedTable = array_shift($tableData); + $insert->into($unaliasedTable); + } + + $statement = $this->sql->prepareStatementForSqlObject($insert); + $result = $statement->execute(); + $this->lastInsertValue = $this->adapter->getDriver()->getConnection()->getLastGeneratedValue(); + + // apply postInsert features + $this->featureSet->apply(EventFeatureEventsInterface::EVENT_POST_INSERT, [$statement, $result]); + + // Reset original table information in Insert instance, if necessary + if ($unaliasedTable) { + $insert->into($insertState['table']); + } + + return $result->getAffectedRows(); + } + + /** + * Update + * + * @param array $set + * @param string|array|\Closure $where + * @param null|array $joins + * @return int + */ + public function update($set, $where = null, array $joins = null) + { + if (! $this->isInitialized) { + $this->initialize(); + } + $sql = $this->sql; + $update = $sql->update(); + $update->set($set); + if ($where !== null) { + $update->where($where); + } + + if ($joins) { + foreach ($joins as $join) { + $type = isset($join['type']) ? $join['type'] : Join::JOIN_INNER; + $update->join($join['name'], $join['on'], $type); + } + } + + return $this->executeUpdate($update); + } + + /** + * @param \Laminas\Db\Sql\Update $update + * @return int + */ + public function updateWith(Update $update) + { + if (! $this->isInitialized) { + $this->initialize(); + } + return $this->executeUpdate($update); + } + + /** + * @todo add $columns support + * + * @param Update $update + * @return int + * @throws Exception\RuntimeException + */ + protected function executeUpdate(Update $update) + { + $updateState = $update->getRawState(); + if ($updateState['table'] != $this->table) { + throw new Exception\RuntimeException( + 'The table name of the provided Update object must match that of the table' + ); + } + + // apply preUpdate features + $this->featureSet->apply(EventFeatureEventsInterface::EVENT_PRE_UPDATE, [$update]); + + $unaliasedTable = false; + if (is_array($updateState['table'])) { + $tableData = array_values($updateState['table']); + $unaliasedTable = array_shift($tableData); + $update->table($unaliasedTable); + } + + $statement = $this->sql->prepareStatementForSqlObject($update); + $result = $statement->execute(); + + // apply postUpdate features + $this->featureSet->apply(EventFeatureEventsInterface::EVENT_POST_UPDATE, [$statement, $result]); + + // Reset original table information in Update instance, if necessary + if ($unaliasedTable) { + $update->table($updateState['table']); + } + + return $result->getAffectedRows(); + } + + /** + * Delete + * + * @param Where|\Closure|string|array $where + * @return int + */ + public function delete($where) + { + if (! $this->isInitialized) { + $this->initialize(); + } + $delete = $this->sql->delete(); + if ($where instanceof \Closure) { + $where($delete); + } else { + $delete->where($where); + } + return $this->executeDelete($delete); + } + + /** + * @param Delete $delete + * @return int + */ + public function deleteWith(Delete $delete) + { + $this->initialize(); + return $this->executeDelete($delete); + } + + /** + * @todo add $columns support + * + * @param Delete $delete + * @return int + * @throws Exception\RuntimeException + */ + protected function executeDelete(Delete $delete) + { + $deleteState = $delete->getRawState(); + if ($deleteState['table'] != $this->table) { + throw new Exception\RuntimeException( + 'The table name of the provided Delete object must match that of the table' + ); + } + + // pre delete update + $this->featureSet->apply(EventFeatureEventsInterface::EVENT_PRE_DELETE, [$delete]); + + $unaliasedTable = false; + if (is_array($deleteState['table'])) { + $tableData = array_values($deleteState['table']); + $unaliasedTable = array_shift($tableData); + $delete->from($unaliasedTable); + } + + $statement = $this->sql->prepareStatementForSqlObject($delete); + $result = $statement->execute(); + + // apply postDelete features + $this->featureSet->apply(EventFeatureEventsInterface::EVENT_POST_DELETE, [$statement, $result]); + + // Reset original table information in Delete instance, if necessary + if ($unaliasedTable) { + $delete->from($deleteState['table']); + } + + return $result->getAffectedRows(); + } + + /** + * Get last insert value + * + * @return int + */ + public function getLastInsertValue() + { + return $this->lastInsertValue; + } + + /** + * __get + * + * @param string $property + * @throws Exception\InvalidArgumentException + * @return mixed + */ + public function __get($property) + { + switch (strtolower($property)) { + case 'lastinsertvalue': + return $this->lastInsertValue; + case 'adapter': + return $this->adapter; + case 'table': + return $this->table; + } + if ($this->featureSet->canCallMagicGet($property)) { + return $this->featureSet->callMagicGet($property); + } + throw new Exception\InvalidArgumentException('Invalid magic property access in ' . __CLASS__ . '::__get()'); + } + + /** + * @param string $property + * @param mixed $value + * @return mixed + * @throws Exception\InvalidArgumentException + */ + public function __set($property, $value) + { + if ($this->featureSet->canCallMagicSet($property)) { + return $this->featureSet->callMagicSet($property, $value); + } + throw new Exception\InvalidArgumentException('Invalid magic property access in ' . __CLASS__ . '::__set()'); + } + + /** + * @param $method + * @param $arguments + * @return mixed + * @throws Exception\InvalidArgumentException + */ + public function __call($method, $arguments) + { + if ($this->featureSet->canCallMagicCall($method)) { + return $this->featureSet->callMagicCall($method, $arguments); + } + throw new Exception\InvalidArgumentException(sprintf( + 'Invalid method (%s) called, caught by %s::__call()', + $method, + __CLASS__ + )); + } + + /** + * __clone + */ + public function __clone() + { + $this->resultSetPrototype = (isset($this->resultSetPrototype)) ? clone $this->resultSetPrototype : null; + $this->sql = clone $this->sql; + if (is_object($this->table)) { + $this->table = clone $this->table; + } elseif (is_array($this->table) + && count($this->table) == 1 + && is_object(reset($this->table)) + ) { + foreach ($this->table as $alias => &$tableObject) { + $tableObject = clone $tableObject; + } + } + } +} diff --git a/bundled-libs/laminas/laminas-db/src/TableGateway/Exception/ExceptionInterface.php b/bundled-libs/laminas/laminas-db/src/TableGateway/Exception/ExceptionInterface.php new file mode 100644 index 00000000..dd4861e2 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/TableGateway/Exception/ExceptionInterface.php @@ -0,0 +1,15 @@ +tableGateway = $tableGateway; + } + + public function initialize() + { + throw new Exception\RuntimeException('This method is not intended to be called on this object.'); + } + + public function getMagicMethodSpecifications() + { + return []; + } + + + /* + public function preInitialize(); + public function postInitialize(); + public function preSelect(Select $select); + public function postSelect(StatementInterface $statement, ResultInterface $result, ResultSetInterface $resultSet); + public function preInsert(Insert $insert); + public function postInsert(StatementInterface $statement, ResultInterface $result); + public function preUpdate(Update $update); + public function postUpdate(StatementInterface $statement, ResultInterface $result); + public function preDelete(Delete $delete); + public function postDelete(StatementInterface $statement, ResultInterface $result); + */ +} diff --git a/bundled-libs/laminas/laminas-db/src/TableGateway/Feature/EventFeature.php b/bundled-libs/laminas/laminas-db/src/TableGateway/Feature/EventFeature.php new file mode 100644 index 00000000..b52ce42a --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/TableGateway/Feature/EventFeature.php @@ -0,0 +1,256 @@ +eventManager = ($eventManager instanceof EventManagerInterface) + ? $eventManager + : new EventManager; + + $this->eventManager->addIdentifiers([ + 'Laminas\Db\TableGateway\TableGateway', + ]); + + $this->event = ($tableGatewayEvent) ?: new EventFeature\TableGatewayEvent(); + } + + /** + * Retrieve composed event manager instance + * + * @return EventManagerInterface + */ + public function getEventManager() + { + return $this->eventManager; + } + + /** + * Retrieve composed event instance + * + * @return EventFeature\TableGatewayEvent + */ + public function getEvent() + { + return $this->event; + } + + /** + * Initialize feature and trigger "preInitialize" event + * + * Ensures that the composed TableGateway has identifiers based on the + * class name, and that the event target is set to the TableGateway + * instance. It then triggers the "preInitialize" event. + * + * @return void + */ + public function preInitialize() + { + if (get_class($this->tableGateway) != 'Laminas\Db\TableGateway\TableGateway') { + $this->eventManager->addIdentifiers([get_class($this->tableGateway)]); + } + + $this->event->setTarget($this->tableGateway); + $this->event->setName(static::EVENT_PRE_INITIALIZE); + $this->eventManager->triggerEvent($this->event); + } + + /** + * Trigger the "postInitialize" event + * + * @return void + */ + public function postInitialize() + { + $this->event->setName(static::EVENT_POST_INITIALIZE); + $this->eventManager->triggerEvent($this->event); + } + + /** + * Trigger the "preSelect" event + * + * Triggers the "preSelect" event mapping the following parameters: + * - $select as "select" + * + * @param Select $select + * @return void + */ + public function preSelect(Select $select) + { + $this->event->setName(static::EVENT_PRE_SELECT); + $this->event->setParams(['select' => $select]); + $this->eventManager->triggerEvent($this->event); + } + + /** + * Trigger the "postSelect" event + * + * Triggers the "postSelect" event mapping the following parameters: + * - $statement as "statement" + * - $result as "result" + * - $resultSet as "result_set" + * + * @param StatementInterface $statement + * @param ResultInterface $result + * @param ResultSetInterface $resultSet + * @return void + */ + public function postSelect(StatementInterface $statement, ResultInterface $result, ResultSetInterface $resultSet) + { + $this->event->setName(static::EVENT_POST_SELECT); + $this->event->setParams([ + 'statement' => $statement, + 'result' => $result, + 'result_set' => $resultSet + ]); + $this->eventManager->triggerEvent($this->event); + } + + /** + * Trigger the "preInsert" event + * + * Triggers the "preInsert" event mapping the following parameters: + * - $insert as "insert" + * + * @param Insert $insert + * @return void + */ + public function preInsert(Insert $insert) + { + $this->event->setName(static::EVENT_PRE_INSERT); + $this->event->setParams(['insert' => $insert]); + $this->eventManager->triggerEvent($this->event); + } + + /** + * Trigger the "postInsert" event + * + * Triggers the "postInsert" event mapping the following parameters: + * - $statement as "statement" + * - $result as "result" + * + * @param StatementInterface $statement + * @param ResultInterface $result + * @return void + */ + public function postInsert(StatementInterface $statement, ResultInterface $result) + { + $this->event->setName(static::EVENT_POST_INSERT); + $this->event->setParams([ + 'statement' => $statement, + 'result' => $result, + ]); + $this->eventManager->triggerEvent($this->event); + } + + /** + * Trigger the "preUpdate" event + * + * Triggers the "preUpdate" event mapping the following parameters: + * - $update as "update" + * + * @param Update $update + * @return void + */ + public function preUpdate(Update $update) + { + $this->event->setName(static::EVENT_PRE_UPDATE); + $this->event->setParams(['update' => $update]); + $this->eventManager->triggerEvent($this->event); + } + + /** + * Trigger the "postUpdate" event + * + * Triggers the "postUpdate" event mapping the following parameters: + * - $statement as "statement" + * - $result as "result" + * + * @param StatementInterface $statement + * @param ResultInterface $result + * @return void + */ + public function postUpdate(StatementInterface $statement, ResultInterface $result) + { + $this->event->setName(static::EVENT_POST_UPDATE); + $this->event->setParams([ + 'statement' => $statement, + 'result' => $result, + ]); + $this->eventManager->triggerEvent($this->event); + } + + /** + * Trigger the "preDelete" event + * + * Triggers the "preDelete" event mapping the following parameters: + * - $delete as "delete" + * + * @param Delete $delete + * @return void + */ + public function preDelete(Delete $delete) + { + $this->event->setName(static::EVENT_PRE_DELETE); + $this->event->setParams(['delete' => $delete]); + $this->eventManager->triggerEvent($this->event); + } + + /** + * Trigger the "postDelete" event + * + * Triggers the "postDelete" event mapping the following parameters: + * - $statement as "statement" + * - $result as "result" + * + * @param StatementInterface $statement + * @param ResultInterface $result + * @return void + */ + public function postDelete(StatementInterface $statement, ResultInterface $result) + { + $this->event->setName(static::EVENT_POST_DELETE); + $this->event->setParams([ + 'statement' => $statement, + 'result' => $result, + ]); + $this->eventManager->triggerEvent($this->event); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/TableGateway/Feature/EventFeature/TableGatewayEvent.php b/bundled-libs/laminas/laminas-db/src/TableGateway/Feature/EventFeature/TableGatewayEvent.php new file mode 100644 index 00000000..0310c467 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/TableGateway/Feature/EventFeature/TableGatewayEvent.php @@ -0,0 +1,138 @@ +name; + } + + /** + * Get target/context from which event was triggered + * + * @return null|string|object + */ + public function getTarget() + { + return $this->target; + } + + /** + * Get parameters passed to the event + * + * @return array|\ArrayAccess + */ + public function getParams() + { + return $this->params; + } + + /** + * Get a single parameter by name + * + * @param string $name + * @param mixed $default Default value to return if parameter does not exist + * @return mixed + */ + public function getParam($name, $default = null) + { + return (isset($this->params[$name]) ? $this->params[$name] : $default); + } + + /** + * Set the event name + * + * @param string $name + * @return void + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * Set the event target/context + * + * @param null|string|object $target + * @return void + */ + public function setTarget($target) + { + $this->target = $target; + } + + /** + * Set event parameters + * + * @param string $params + * @return void + */ + public function setParams($params) + { + $this->params = $params; + } + + /** + * Set a single parameter by key + * + * @param string $name + * @param mixed $value + * @return void + */ + public function setParam($name, $value) + { + $this->params[$name] = $value; + } + + /** + * Indicate whether or not the parent EventManagerInterface should stop propagating events + * + * @param bool $flag + * @return void + */ + public function stopPropagation($flag = true) + { + return; + } + + /** + * Has this event indicated event propagation should stop? + * + * @return bool + */ + public function propagationIsStopped() + { + return false; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/TableGateway/Feature/EventFeatureEventsInterface.php b/bundled-libs/laminas/laminas-db/src/TableGateway/Feature/EventFeatureEventsInterface.php new file mode 100644 index 00000000..107f374b --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/TableGateway/Feature/EventFeatureEventsInterface.php @@ -0,0 +1,35 @@ +addFeatures($features); + } + } + + /** + * @param AbstractTableGateway $tableGateway + * @return self Provides a fluent interface + */ + public function setTableGateway(AbstractTableGateway $tableGateway) + { + $this->tableGateway = $tableGateway; + foreach ($this->features as $feature) { + $feature->setTableGateway($this->tableGateway); + } + return $this; + } + + public function getFeatureByClassName($featureClassName) + { + $feature = false; + foreach ($this->features as $potentialFeature) { + if ($potentialFeature instanceof $featureClassName) { + $feature = $potentialFeature; + break; + } + } + return $feature; + } + + /** + * @param array $features + * @return self Provides a fluent interface + */ + public function addFeatures(array $features) + { + foreach ($features as $feature) { + $this->addFeature($feature); + } + return $this; + } + + /** + * @param AbstractFeature $feature + * @return self Provides a fluent interface + */ + public function addFeature(AbstractFeature $feature) + { + if ($this->tableGateway instanceof TableGatewayInterface) { + $feature->setTableGateway($this->tableGateway); + } + $this->features[] = $feature; + return $this; + } + + public function apply($method, $args) + { + foreach ($this->features as $feature) { + if (method_exists($feature, $method)) { + $return = call_user_func_array([$feature, $method], $args); + if ($return === self::APPLY_HALT) { + break; + } + } + } + } + + /** + * @param string $property + * @return bool + */ + public function canCallMagicGet($property) + { + return false; + } + + /** + * @param string $property + * @return mixed + */ + public function callMagicGet($property) + { + $return = null; + return $return; + } + + /** + * @param string $property + * @return bool + */ + public function canCallMagicSet($property) + { + return false; + } + + /** + * @param $property + * @param $value + * @return mixed + */ + public function callMagicSet($property, $value) + { + $return = null; + return $return; + } + + /** + * Is the method requested available in one of the added features + * @param string $method + * @return bool + */ + public function canCallMagicCall($method) + { + if (! empty($this->features)) { + foreach ($this->features as $feature) { + if (method_exists($feature, $method)) { + return true; + } + } + } + return false; + } + + /** + * Call method of on added feature as though it were a local method + * @param string $method + * @param array $arguments + * @return mixed + */ + public function callMagicCall($method, $arguments) + { + foreach ($this->features as $feature) { + if (method_exists($feature, $method)) { + return $feature->$method($arguments); + } + } + + return; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/TableGateway/Feature/GlobalAdapterFeature.php b/bundled-libs/laminas/laminas-db/src/TableGateway/Feature/GlobalAdapterFeature.php new file mode 100644 index 00000000..5fb81446 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/TableGateway/Feature/GlobalAdapterFeature.php @@ -0,0 +1,66 @@ +tableGateway->adapter = self::getStaticAdapter(); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/TableGateway/Feature/MasterSlaveFeature.php b/bundled-libs/laminas/laminas-db/src/TableGateway/Feature/MasterSlaveFeature.php new file mode 100644 index 00000000..204073da --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/TableGateway/Feature/MasterSlaveFeature.php @@ -0,0 +1,90 @@ +slaveAdapter = $slaveAdapter; + if ($slaveSql) { + $this->slaveSql = $slaveSql; + } + } + + public function getSlaveAdapter() + { + return $this->slaveAdapter; + } + + /** + * @return Sql + */ + public function getSlaveSql() + { + return $this->slaveSql; + } + + /** + * after initialization, retrieve the original adapter as "master" + */ + public function postInitialize() + { + $this->masterSql = $this->tableGateway->sql; + if ($this->slaveSql === null) { + $this->slaveSql = new Sql( + $this->slaveAdapter, + $this->tableGateway->sql->getTable(), + $this->tableGateway->sql->getSqlPlatform() + ); + } + } + + /** + * preSelect() + * Replace adapter with slave temporarily + */ + public function preSelect() + { + $this->tableGateway->sql = $this->slaveSql; + } + + /** + * postSelect() + * Ensure to return to the master adapter + */ + public function postSelect() + { + $this->tableGateway->sql = $this->masterSql; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/TableGateway/Feature/MetadataFeature.php b/bundled-libs/laminas/laminas-db/src/TableGateway/Feature/MetadataFeature.php new file mode 100644 index 00000000..cb0197ad --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/TableGateway/Feature/MetadataFeature.php @@ -0,0 +1,95 @@ +metadata = $metadata; + } + $this->sharedData['metadata'] = [ + 'primaryKey' => null, + 'columns' => [] + ]; + } + + public function postInitialize() + { + if ($this->metadata === null) { + $this->metadata = SourceFactory::createSourceFromAdapter($this->tableGateway->adapter); + } + + // localize variable for brevity + $t = $this->tableGateway; + $m = $this->metadata; + + $tableGatewayTable = is_array($t->table) ? current($t->table) : $t->table; + + if ($tableGatewayTable instanceof TableIdentifier) { + $table = $tableGatewayTable->getTable(); + $schema = $tableGatewayTable->getSchema(); + } else { + $table = $tableGatewayTable; + $schema = null; + } + + // get column named + $columns = $m->getColumnNames($table, $schema); + $t->columns = $columns; + + // set locally + $this->sharedData['metadata']['columns'] = $columns; + + // process primary key only if table is a table; there are no PK constraints on views + if (! ($m->getTable($table, $schema) instanceof TableObject)) { + return; + } + + $pkc = null; + + foreach ($m->getConstraints($table, $schema) as $constraint) { + /** @var $constraint \Laminas\Db\Metadata\Object\ConstraintObject */ + if ($constraint->getType() == 'PRIMARY KEY') { + $pkc = $constraint; + break; + } + } + + if ($pkc === null) { + throw new Exception\RuntimeException('A primary key for this column could not be found in the metadata.'); + } + + $pkcColumns = $pkc->getColumns(); + if (count($pkcColumns) === 1) { + $primaryKey = $pkcColumns[0]; + } else { + $primaryKey = $pkcColumns; + } + + $this->sharedData['metadata']['primaryKey'] = $primaryKey; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/TableGateway/Feature/RowGatewayFeature.php b/bundled-libs/laminas/laminas-db/src/TableGateway/Feature/RowGatewayFeature.php new file mode 100644 index 00000000..2c10715e --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/TableGateway/Feature/RowGatewayFeature.php @@ -0,0 +1,77 @@ +constructorArguments = func_get_args(); + } + + public function postInitialize() + { + $args = $this->constructorArguments; + + /** @var $resultSetPrototype ResultSet */ + $resultSetPrototype = $this->tableGateway->resultSetPrototype; + + if (! $this->tableGateway->resultSetPrototype instanceof ResultSet) { + throw new Exception\RuntimeException( + 'This feature ' . __CLASS__ . ' expects the ResultSet to be an instance of ' . ResultSet::class + ); + } + + if (isset($args[0])) { + if (is_string($args[0])) { + $primaryKey = $args[0]; + $rowGatewayPrototype = new RowGateway( + $primaryKey, + $this->tableGateway->table, + $this->tableGateway->adapter + ); + $resultSetPrototype->setArrayObjectPrototype($rowGatewayPrototype); + } elseif ($args[0] instanceof RowGatewayInterface) { + $rowGatewayPrototype = $args[0]; + $resultSetPrototype->setArrayObjectPrototype($rowGatewayPrototype); + } + } else { + // get from metadata feature + $metadata = $this->tableGateway->featureSet->getFeatureByClassName( + 'Laminas\Db\TableGateway\Feature\MetadataFeature' + ); + if ($metadata === false || ! isset($metadata->sharedData['metadata'])) { + throw new Exception\RuntimeException( + 'No information was provided to the RowGatewayFeature and/or no MetadataFeature could be consulted ' + . 'to find the primary key necessary for RowGateway object creation.' + ); + } + $primaryKey = $metadata->sharedData['metadata']['primaryKey']; + $rowGatewayPrototype = new RowGateway( + $primaryKey, + $this->tableGateway->table, + $this->tableGateway->adapter + ); + $resultSetPrototype->setArrayObjectPrototype($rowGatewayPrototype); + } + } +} diff --git a/bundled-libs/laminas/laminas-db/src/TableGateway/Feature/SequenceFeature.php b/bundled-libs/laminas/laminas-db/src/TableGateway/Feature/SequenceFeature.php new file mode 100644 index 00000000..cec94b3e --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/TableGateway/Feature/SequenceFeature.php @@ -0,0 +1,132 @@ +primaryKeyField = $primaryKeyField; + $this->sequenceName = $sequenceName; + } + + /** + * @param Insert $insert + * @return Insert + */ + public function preInsert(Insert $insert) + { + $columns = $insert->getRawState('columns'); + $values = $insert->getRawState('values'); + $key = array_search($this->primaryKeyField, $columns); + if ($key !== false) { + $this->sequenceValue = isset($values[$key]) ? $values[$key] : null; + return $insert; + } + + $this->sequenceValue = $this->nextSequenceId(); + if ($this->sequenceValue === null) { + return $insert; + } + + $insert->values([$this->primaryKeyField => $this->sequenceValue], Insert::VALUES_MERGE); + return $insert; + } + + /** + * @param StatementInterface $statement + * @param ResultInterface $result + */ + public function postInsert(StatementInterface $statement, ResultInterface $result) + { + if ($this->sequenceValue !== null) { + $this->tableGateway->lastInsertValue = $this->sequenceValue; + } + } + + /** + * Generate a new value from the specified sequence in the database, and return it. + * @return int + */ + public function nextSequenceId() + { + $platform = $this->tableGateway->adapter->getPlatform(); + $platformName = $platform->getName(); + + switch ($platformName) { + case 'Oracle': + $sql = 'SELECT ' . $platform->quoteIdentifier($this->sequenceName) . '.NEXTVAL as "nextval" FROM dual'; + break; + case 'PostgreSQL': + $sql = 'SELECT NEXTVAL(\'"' . $this->sequenceName . '"\')'; + break; + default: + return; + } + + $statement = $this->tableGateway->adapter->createStatement(); + $statement->prepare($sql); + $result = $statement->execute(); + $sequence = $result->current(); + unset($statement, $result); + return $sequence['nextval']; + } + + /** + * Return the most recent value from the specified sequence in the database. + * @return int + */ + public function lastSequenceId() + { + $platform = $this->tableGateway->adapter->getPlatform(); + $platformName = $platform->getName(); + + switch ($platformName) { + case 'Oracle': + $sql = 'SELECT ' . $platform->quoteIdentifier($this->sequenceName) . '.CURRVAL as "currval" FROM dual'; + break; + case 'PostgreSQL': + $sql = 'SELECT CURRVAL(\'' . $this->sequenceName . '\')'; + break; + default: + return; + } + + $statement = $this->tableGateway->adapter->createStatement(); + $statement->prepare($sql); + $result = $statement->execute(); + $sequence = $result->current(); + unset($statement, $result); + return $sequence['currval']; + } +} diff --git a/bundled-libs/laminas/laminas-db/src/TableGateway/TableGateway.php b/bundled-libs/laminas/laminas-db/src/TableGateway/TableGateway.php new file mode 100644 index 00000000..08e6aaf0 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/TableGateway/TableGateway.php @@ -0,0 +1,82 @@ +table = $table; + + // adapter + $this->adapter = $adapter; + + // process features + if ($features !== null) { + if ($features instanceof Feature\AbstractFeature) { + $features = [$features]; + } + if (is_array($features)) { + $this->featureSet = new Feature\FeatureSet($features); + } elseif ($features instanceof Feature\FeatureSet) { + $this->featureSet = $features; + } else { + throw new Exception\InvalidArgumentException( + 'TableGateway expects $feature to be an instance of an AbstractFeature or a FeatureSet, or an ' + . 'array of AbstractFeatures' + ); + } + } else { + $this->featureSet = new Feature\FeatureSet(); + } + + // result prototype + $this->resultSetPrototype = ($resultSetPrototype) ?: new ResultSet; + + // Sql object (factory for select, insert, update, delete) + $this->sql = ($sql) ?: new Sql($this->adapter, $this->table); + + // check sql object bound to same table + if ($this->sql->getTable() != $this->table) { + throw new Exception\InvalidArgumentException( + 'The table inside the provided Sql object must match the table of this TableGateway' + ); + } + + $this->initialize(); + } +} diff --git a/bundled-libs/laminas/laminas-db/src/TableGateway/TableGatewayInterface.php b/bundled-libs/laminas/laminas-db/src/TableGateway/TableGatewayInterface.php new file mode 100644 index 00000000..bb531223 --- /dev/null +++ b/bundled-libs/laminas/laminas-db/src/TableGateway/TableGatewayInterface.php @@ -0,0 +1,18 @@ +setFromArray($options); + } + } + + /** + * Set one or more configuration properties + * + * @param array|Traversable|AbstractOptions $options + * @throws Exception\InvalidArgumentException + * @return AbstractOptions Provides fluent interface + */ + public function setFromArray($options) + { + if ($options instanceof self) { + $options = $options->toArray(); + } + + if (! is_array($options) && ! $options instanceof Traversable) { + throw new Exception\InvalidArgumentException( + sprintf( + 'Parameter provided to %s must be an %s, %s or %s', + __METHOD__, + 'array', + 'Traversable', + 'Laminas\Stdlib\AbstractOptions' + ) + ); + } + + foreach ($options as $key => $value) { + $this->__set($key, $value); + } + + return $this; + } + + /** + * Cast to array + * + * @return array + */ + public function toArray() + { + $array = []; + $transform = function ($letters) { + $letter = array_shift($letters); + return '_' . strtolower($letter); + }; + foreach ($this as $key => $value) { + if ($key === '__strictMode__') { + continue; + } + $normalizedKey = preg_replace_callback('/([A-Z])/', $transform, $key); + $array[$normalizedKey] = $value; + } + return $array; + } + + /** + * Set a configuration property + * + * @see ParameterObject::__set() + * @param string $key + * @param mixed $value + * @throws Exception\BadMethodCallException + * @return void + */ + public function __set($key, $value) + { + $setter = 'set' . str_replace('_', '', $key); + + if (is_callable([$this, $setter])) { + $this->{$setter}($value); + + return; + } + + if ($this->__strictMode__) { + throw new Exception\BadMethodCallException(sprintf( + 'The option "%s" does not have a callable "%s" ("%s") setter method which must be defined', + $key, + 'set' . str_replace(' ', '', ucwords(str_replace('_', ' ', $key))), + $setter + )); + } + } + + /** + * Get a configuration property + * + * @see ParameterObject::__get() + * @param string $key + * @throws Exception\BadMethodCallException + * @return mixed + */ + public function __get($key) + { + $getter = 'get' . str_replace('_', '', $key); + + if (is_callable([$this, $getter])) { + return $this->{$getter}(); + } + + throw new Exception\BadMethodCallException(sprintf( + 'The option "%s" does not have a callable "%s" getter method which must be defined', + $key, + 'get' . str_replace(' ', '', ucwords(str_replace('_', ' ', $key))) + )); + } + + /** + * Test if a configuration property is null + * @see ParameterObject::__isset() + * @param string $key + * @return bool + */ + public function __isset($key) + { + $getter = 'get' . str_replace('_', '', $key); + + return method_exists($this, $getter) && null !== $this->__get($key); + } + + /** + * Set a configuration property to NULL + * + * @see ParameterObject::__unset() + * @param string $key + * @throws Exception\InvalidArgumentException + * @return void + */ + public function __unset($key) + { + try { + $this->__set($key, null); + } catch (Exception\BadMethodCallException $e) { + throw new Exception\InvalidArgumentException( + 'The class property $' . $key . ' cannot be unset as' + . ' NULL is an invalid value for it', + 0, + $e + ); + } + } +} diff --git a/bundled-libs/laminas/laminas-stdlib/src/ArrayObject.php b/bundled-libs/laminas/laminas-stdlib/src/ArrayObject.php new file mode 100644 index 00000000..9bbb0741 --- /dev/null +++ b/bundled-libs/laminas/laminas-stdlib/src/ArrayObject.php @@ -0,0 +1,433 @@ +setFlags($flags); + $this->storage = $input; + $this->setIteratorClass($iteratorClass); + $this->protectedProperties = array_keys(get_object_vars($this)); + } + + /** + * Returns whether the requested key exists + * + * @param mixed $key + * @return bool + */ + public function __isset($key) + { + if ($this->flag == self::ARRAY_AS_PROPS) { + return $this->offsetExists($key); + } + if (in_array($key, $this->protectedProperties)) { + throw new Exception\InvalidArgumentException('$key is a protected property, use a different key'); + } + + return isset($this->$key); + } + + /** + * Sets the value at the specified key to value + * + * @param mixed $key + * @param mixed $value + * @return void + */ + public function __set($key, $value) + { + if ($this->flag == self::ARRAY_AS_PROPS) { + return $this->offsetSet($key, $value); + } + if (in_array($key, $this->protectedProperties)) { + throw new Exception\InvalidArgumentException('$key is a protected property, use a different key'); + } + $this->$key = $value; + } + + /** + * Unsets the value at the specified key + * + * @param mixed $key + * @return void + */ + public function __unset($key) + { + if ($this->flag == self::ARRAY_AS_PROPS) { + return $this->offsetUnset($key); + } + if (in_array($key, $this->protectedProperties)) { + throw new Exception\InvalidArgumentException('$key is a protected property, use a different key'); + } + unset($this->$key); + } + + /** + * Returns the value at the specified key by reference + * + * @param mixed $key + * @return mixed + */ + public function &__get($key) + { + $ret = null; + if ($this->flag == self::ARRAY_AS_PROPS) { + $ret =& $this->offsetGet($key); + + return $ret; + } + if (in_array($key, $this->protectedProperties)) { + throw new Exception\InvalidArgumentException('$key is a protected property, use a different key'); + } + + return $this->$key; + } + + /** + * Appends the value + * + * @param mixed $value + * @return void + */ + public function append($value) + { + $this->storage[] = $value; + } + + /** + * Sort the entries by value + * + * @return void + */ + public function asort() + { + asort($this->storage); + } + + /** + * Get the number of public properties in the ArrayObject + * + * @return int + */ + public function count() + { + return count($this->storage); + } + + /** + * Exchange the array for another one. + * + * @param array|ArrayObject $data + * @return array + */ + public function exchangeArray($data) + { + if (! is_array($data) && ! is_object($data)) { + throw new Exception\InvalidArgumentException( + 'Passed variable is not an array or object, using empty array instead' + ); + } + + if (is_object($data) && ($data instanceof self || $data instanceof \ArrayObject)) { + $data = $data->getArrayCopy(); + } + if (! is_array($data)) { + $data = (array) $data; + } + + $storage = $this->storage; + + $this->storage = $data; + + return $storage; + } + + /** + * Creates a copy of the ArrayObject. + * + * @return array + */ + public function getArrayCopy() + { + return $this->storage; + } + + /** + * Gets the behavior flags. + * + * @return int + */ + public function getFlags() + { + return $this->flag; + } + + /** + * Create a new iterator from an ArrayObject instance + * + * @return \Iterator + */ + public function getIterator() + { + $class = $this->iteratorClass; + + return new $class($this->storage); + } + + /** + * Gets the iterator classname for the ArrayObject. + * + * @return string + */ + public function getIteratorClass() + { + return $this->iteratorClass; + } + + /** + * Sort the entries by key + * + * @return void + */ + public function ksort() + { + ksort($this->storage); + } + + /** + * Sort an array using a case insensitive "natural order" algorithm + * + * @return void + */ + public function natcasesort() + { + natcasesort($this->storage); + } + + /** + * Sort entries using a "natural order" algorithm + * + * @return void + */ + public function natsort() + { + natsort($this->storage); + } + + /** + * Returns whether the requested key exists + * + * @param mixed $key + * @return bool + */ + public function offsetExists($key) + { + return isset($this->storage[$key]); + } + + /** + * Returns the value at the specified key + * + * @param mixed $key + * @return mixed + */ + public function &offsetGet($key) + { + $ret = null; + if (! $this->offsetExists($key)) { + return $ret; + } + $ret =& $this->storage[$key]; + + return $ret; + } + + /** + * Sets the value at the specified key to value + * + * @param mixed $key + * @param mixed $value + * @return void + */ + public function offsetSet($key, $value) + { + $this->storage[$key] = $value; + } + + /** + * Unsets the value at the specified key + * + * @param mixed $key + * @return void + */ + public function offsetUnset($key) + { + if ($this->offsetExists($key)) { + unset($this->storage[$key]); + } + } + + /** + * Serialize an ArrayObject + * + * @return string + */ + public function serialize() + { + return serialize(get_object_vars($this)); + } + + /** + * Sets the behavior flags + * + * @param int $flags + * @return void + */ + public function setFlags($flags) + { + $this->flag = $flags; + } + + /** + * Sets the iterator classname for the ArrayObject + * + * @param string $class + * @return void + */ + public function setIteratorClass($class) + { + if (class_exists($class)) { + $this->iteratorClass = $class; + + return ; + } + + if (strpos($class, '\\') === 0) { + $class = '\\' . $class; + if (class_exists($class)) { + $this->iteratorClass = $class; + + return ; + } + } + + throw new Exception\InvalidArgumentException('The iterator class does not exist'); + } + + /** + * Sort the entries with a user-defined comparison function and maintain key association + * + * @param callable $function + * @return void + */ + public function uasort($function) + { + if (is_callable($function)) { + uasort($this->storage, $function); + } + } + + /** + * Sort the entries by keys using a user-defined comparison function + * + * @param callable $function + * @return void + */ + public function uksort($function) + { + if (is_callable($function)) { + uksort($this->storage, $function); + } + } + + /** + * Unserialize an ArrayObject + * + * @param string $data + * @return void + */ + public function unserialize($data) + { + $ar = unserialize($data); + $this->protectedProperties = array_keys(get_object_vars($this)); + + $this->setFlags($ar['flag']); + $this->exchangeArray($ar['storage']); + $this->setIteratorClass($ar['iteratorClass']); + + foreach ($ar as $k => $v) { + switch ($k) { + case 'flag': + $this->setFlags($v); + break; + case 'storage': + $this->exchangeArray($v); + break; + case 'iteratorClass': + $this->setIteratorClass($v); + break; + case 'protectedProperties': + break; + default: + $this->__set($k, $v); + } + } + } +} diff --git a/bundled-libs/laminas/laminas-stdlib/src/ArraySerializableInterface.php b/bundled-libs/laminas/laminas-stdlib/src/ArraySerializableInterface.php new file mode 100644 index 00000000..d0d95eef --- /dev/null +++ b/bundled-libs/laminas/laminas-stdlib/src/ArraySerializableInterface.php @@ -0,0 +1,27 @@ +getArrayCopy(); + return new ArrayIterator(array_reverse($array)); + } +} diff --git a/bundled-libs/laminas/laminas-stdlib/src/ArrayUtils.php b/bundled-libs/laminas/laminas-stdlib/src/ArrayUtils.php new file mode 100644 index 00000000..13eb25d0 --- /dev/null +++ b/bundled-libs/laminas/laminas-stdlib/src/ArrayUtils.php @@ -0,0 +1,313 @@ + 0; + } + + /** + * Test whether an array contains one or more integer keys + * + * @param mixed $value + * @param bool $allowEmpty Should an empty array() return true + * @return bool + */ + public static function hasIntegerKeys($value, $allowEmpty = false) + { + if (! is_array($value)) { + return false; + } + + if (! $value) { + return $allowEmpty; + } + + return count(array_filter(array_keys($value), 'is_int')) > 0; + } + + /** + * Test whether an array contains one or more numeric keys. + * + * A numeric key can be one of the following: + * - an integer 1, + * - a string with a number '20' + * - a string with negative number: '-1000' + * - a float: 2.2120, -78.150999 + * - a string with float: '4000.99999', '-10.10' + * + * @param mixed $value + * @param bool $allowEmpty Should an empty array() return true + * @return bool + */ + public static function hasNumericKeys($value, $allowEmpty = false) + { + if (! is_array($value)) { + return false; + } + + if (! $value) { + return $allowEmpty; + } + + return count(array_filter(array_keys($value), 'is_numeric')) > 0; + } + + /** + * Test whether an array is a list + * + * A list is a collection of values assigned to continuous integer keys + * starting at 0 and ending at count() - 1. + * + * For example: + * + * $list = array('a', 'b', 'c', 'd'); + * $list = array( + * 0 => 'foo', + * 1 => 'bar', + * 2 => array('foo' => 'baz'), + * ); + * + * + * @param mixed $value + * @param bool $allowEmpty Is an empty list a valid list? + * @return bool + */ + public static function isList($value, $allowEmpty = false) + { + if (! is_array($value)) { + return false; + } + + if (! $value) { + return $allowEmpty; + } + + return (array_values($value) === $value); + } + + /** + * Test whether an array is a hash table. + * + * An array is a hash table if: + * + * 1. Contains one or more non-integer keys, or + * 2. Integer keys are non-continuous or misaligned (not starting with 0) + * + * For example: + * + * $hash = array( + * 'foo' => 15, + * 'bar' => false, + * ); + * $hash = array( + * 1995 => 'Birth of PHP', + * 2009 => 'PHP 5.3.0', + * 2012 => 'PHP 5.4.0', + * ); + * $hash = array( + * 'formElement, + * 'options' => array( 'debug' => true ), + * ); + * + * + * @param mixed $value + * @param bool $allowEmpty Is an empty array() a valid hash table? + * @return bool + */ + public static function isHashTable($value, $allowEmpty = false) + { + if (! is_array($value)) { + return false; + } + + if (! $value) { + return $allowEmpty; + } + + return (array_values($value) !== $value); + } + + /** + * Checks if a value exists in an array. + * + * Due to "foo" == 0 === TRUE with in_array when strict = false, an option + * has been added to prevent this. When $strict = 0/false, the most secure + * non-strict check is implemented. if $strict = -1, the default in_array + * non-strict behaviour is used. + * + * @param mixed $needle + * @param array $haystack + * @param int|bool $strict + * @return bool + */ + public static function inArray($needle, array $haystack, $strict = false) + { + if (! $strict) { + if (is_int($needle) || is_float($needle)) { + $needle = (string) $needle; + } + if (is_string($needle)) { + foreach ($haystack as &$h) { + if (is_int($h) || is_float($h)) { + $h = (string) $h; + } + } + } + } + return in_array($needle, $haystack, $strict); + } + + /** + * Convert an iterator to an array. + * + * Converts an iterator to an array. The $recursive flag, on by default, + * hints whether or not you want to do so recursively. + * + * @param array|Traversable $iterator The array or Traversable object to convert + * @param bool $recursive Recursively check all nested structures + * @throws Exception\InvalidArgumentException if $iterator is not an array or a Traversable object + * @return array + */ + public static function iteratorToArray($iterator, $recursive = true) + { + if (! is_array($iterator) && ! $iterator instanceof Traversable) { + throw new Exception\InvalidArgumentException(__METHOD__ . ' expects an array or Traversable object'); + } + + if (! $recursive) { + if (is_array($iterator)) { + return $iterator; + } + + return iterator_to_array($iterator); + } + + if (method_exists($iterator, 'toArray')) { + return $iterator->toArray(); + } + + $array = []; + foreach ($iterator as $key => $value) { + if (is_scalar($value)) { + $array[$key] = $value; + continue; + } + + if ($value instanceof Traversable) { + $array[$key] = static::iteratorToArray($value, $recursive); + continue; + } + + if (is_array($value)) { + $array[$key] = static::iteratorToArray($value, $recursive); + continue; + } + + $array[$key] = $value; + } + + return $array; + } + + /** + * Merge two arrays together. + * + * If an integer key exists in both arrays and preserveNumericKeys is false, the value + * from the second array will be appended to the first array. If both values are arrays, they + * are merged together, else the value of the second array overwrites the one of the first array. + * + * @param array $a + * @param array $b + * @param bool $preserveNumericKeys + * @return array + */ + public static function merge(array $a, array $b, $preserveNumericKeys = false) + { + foreach ($b as $key => $value) { + if ($value instanceof MergeReplaceKeyInterface) { + $a[$key] = $value->getData(); + } elseif (isset($a[$key]) || array_key_exists($key, $a)) { + if ($value instanceof MergeRemoveKey) { + unset($a[$key]); + } elseif (! $preserveNumericKeys && is_int($key)) { + $a[] = $value; + } elseif (is_array($value) && is_array($a[$key])) { + $a[$key] = static::merge($a[$key], $value, $preserveNumericKeys); + } else { + $a[$key] = $value; + } + } else { + if (! $value instanceof MergeRemoveKey) { + $a[$key] = $value; + } + } + } + + return $a; + } + + /** + * @deprecated Since 3.2.0; use the native array_filter methods + * + * @param array $data + * @param callable $callback + * @param null|int $flag + * @return array + * @throws Exception\InvalidArgumentException + */ + public static function filter(array $data, $callback, $flag = null) + { + if (! is_callable($callback)) { + throw new Exception\InvalidArgumentException(sprintf( + 'Second parameter of %s must be callable', + __METHOD__ + )); + } + + return array_filter($data, $callback, $flag); + } +} diff --git a/bundled-libs/laminas/laminas-stdlib/src/ArrayUtils/MergeRemoveKey.php b/bundled-libs/laminas/laminas-stdlib/src/ArrayUtils/MergeRemoveKey.php new file mode 100644 index 00000000..8c9d56e6 --- /dev/null +++ b/bundled-libs/laminas/laminas-stdlib/src/ArrayUtils/MergeRemoveKey.php @@ -0,0 +1,13 @@ +data = $data; + } + + /** + * {@inheritDoc} + */ + public function getData() + { + return $this->data; + } +} diff --git a/bundled-libs/laminas/laminas-stdlib/src/ArrayUtils/MergeReplaceKeyInterface.php b/bundled-libs/laminas/laminas-stdlib/src/ArrayUtils/MergeReplaceKeyInterface.php new file mode 100644 index 00000000..54c24438 --- /dev/null +++ b/bundled-libs/laminas/laminas-stdlib/src/ArrayUtils/MergeReplaceKeyInterface.php @@ -0,0 +1,20 @@ +message`, + * `message`) + * - Write output to a specified stream, optionally with colorization. + * - Write a line of output to a specified stream, optionally with + * colorization, using the system EOL sequence.. + * - Write an error message to STDERR. + * + * Colorization will only occur when expected sequences are discovered, and + * then, only if the console terminal allows it. + * + * Essentially, provides the bare minimum to allow you to provide messages to + * the current console. + */ +class ConsoleHelper +{ + const COLOR_GREEN = "\033[32m"; + const COLOR_RED = "\033[31m"; + const COLOR_RESET = "\033[0m"; + + const HIGHLIGHT_INFO = 'info'; + const HIGHLIGHT_ERROR = 'error'; + + private $highlightMap = [ + self::HIGHLIGHT_INFO => self::COLOR_GREEN, + self::HIGHLIGHT_ERROR => self::COLOR_RED, + ]; + + /** + * @var string Exists only for testing. + */ + private $eol = PHP_EOL; + + /** + * @var resource Exists only for testing. + */ + private $stderr = STDERR; + + /** + * @var bool + */ + private $supportsColor; + + /** + * @param resource $resource + */ + public function __construct($resource = STDOUT) + { + $this->supportsColor = $this->detectColorCapabilities($resource); + } + + /** + * Colorize a string for use with the terminal. + * + * Takes strings formatted as `string` and formats them per the + * $highlightMap; if color support is disabled, simply removes the formatting + * tags. + * + * @param string $string + * @return string + */ + public function colorize($string) + { + $reset = $this->supportsColor ? self::COLOR_RESET : ''; + foreach ($this->highlightMap as $key => $color) { + $pattern = sprintf('#<%s>(.*?)#s', $key, $key); + $color = $this->supportsColor ? $color : ''; + $string = preg_replace($pattern, $color . '$1' . $reset, $string); + } + return $string; + } + + /** + * @param string $string + * @param bool $colorize Whether or not to colorize the string + * @param resource $resource Defaults to STDOUT + * @return void + */ + public function write($string, $colorize = true, $resource = STDOUT) + { + if ($colorize) { + $string = $this->colorize($string); + } + + $string = $this->formatNewlines($string); + + fwrite($resource, $string); + } + + /** + * @param string $string + * @param bool $colorize Whether or not to colorize the line + * @param resource $resource Defaults to STDOUT + * @return void + */ + public function writeLine($string, $colorize = true, $resource = STDOUT) + { + $this->write($string . $this->eol, $colorize, $resource); + } + + /** + * Emit an error message. + * + * Wraps the message in ``, and passes it to `writeLine()`, + * using STDERR as the resource; emits an additional empty line when done, + * also to STDERR. + * + * @param string $message + * @return void + */ + public function writeErrorMessage($message) + { + $this->writeLine(sprintf('%s', $message), true, $this->stderr); + $this->writeLine('', false, $this->stderr); + } + + /** + * @param resource $resource + * @return bool + */ + private function detectColorCapabilities($resource = STDOUT) + { + if ('\\' === DIRECTORY_SEPARATOR) { + // Windows + return false !== getenv('ANSICON') + || 'ON' === getenv('ConEmuANSI') + || 'xterm' === getenv('TERM'); + } + + return function_exists('posix_isatty') && posix_isatty($resource); + } + + /** + * Ensure newlines are appropriate for the current terminal. + * + * @param string + * @return string + */ + private function formatNewlines($string) + { + $string = str_replace($this->eol, "\0PHP_EOL\0", $string); + $string = preg_replace("/(\r\n|\n|\r)/", $this->eol, $string); + return str_replace("\0PHP_EOL\0", $this->eol, $string); + } +} diff --git a/bundled-libs/laminas/laminas-stdlib/src/DispatchableInterface.php b/bundled-libs/laminas/laminas-stdlib/src/DispatchableInterface.php new file mode 100644 index 00000000..62b813af --- /dev/null +++ b/bundled-libs/laminas/laminas-stdlib/src/DispatchableInterface.php @@ -0,0 +1,21 @@ +values[$priority][] = $value; + if (! isset($this->priorities[$priority])) { + $this->priorities[$priority] = $priority; + $this->maxPriority = $this->maxPriority === null ? $priority : max($priority, $this->maxPriority); + } + ++$this->count; + } + + /** + * Extract an element in the queue according to the priority and the + * order of insertion + * + * @return mixed + */ + public function extract() + { + if (! $this->valid()) { + return false; + } + $value = $this->current(); + $this->nextAndRemove(); + return $value; + } + + /** + * Remove an item from the queue + * + * This is different than {@link extract()}; its purpose is to dequeue an + * item. + * + * Note: this removes the first item matching the provided item found. If + * the same item has been added multiple times, it will not remove other + * instances. + * + * @param mixed $datum + * @return bool False if the item was not found, true otherwise. + */ + public function remove($datum) + { + $currentIndex = $this->index; + $currentSubIndex = $this->subIndex; + $currentPriority = $this->maxPriority; + + $this->rewind(); + while ($this->valid()) { + if (current($this->values[$this->maxPriority]) === $datum) { + $index = key($this->values[$this->maxPriority]); + unset($this->values[$this->maxPriority][$index]); + + // The `next()` method advances the internal array pointer, so we need to use the `reset()` function, + // otherwise we would lose all elements before the place the pointer points. + reset($this->values[$this->maxPriority]); + + $this->index = $currentIndex; + $this->subIndex = $currentSubIndex; + + // If the array is empty we need to destroy the unnecessary priority, + // otherwise we would end up with an incorrect value of `$this->count` + // {@see \Laminas\Stdlib\FastPriorityQueue::nextAndRemove()}. + if (empty($this->values[$this->maxPriority])) { + unset($this->values[$this->maxPriority]); + unset($this->priorities[$this->maxPriority]); + if ($this->maxPriority === $currentPriority) { + $this->subIndex = 0; + } + } + + $this->maxPriority = empty($this->priorities) ? null : max($this->priorities); + --$this->count; + return true; + } + $this->next(); + } + return false; + } + + /** + * Get the total number of elements in the queue + * + * @return integer + */ + public function count() + { + return $this->count; + } + + /** + * Get the current element in the queue + * + * @return mixed + */ + public function current() + { + switch ($this->extractFlag) { + case self::EXTR_DATA: + return current($this->values[$this->maxPriority]); + case self::EXTR_PRIORITY: + return $this->maxPriority; + case self::EXTR_BOTH: + return [ + 'data' => current($this->values[$this->maxPriority]), + 'priority' => $this->maxPriority + ]; + } + } + + /** + * Get the index of the current element in the queue + * + * @return integer + */ + public function key() + { + return $this->index; + } + + /** + * Set the iterator pointer to the next element in the queue + * removing the previous element + */ + protected function nextAndRemove() + { + $key = key($this->values[$this->maxPriority]); + + if (false === next($this->values[$this->maxPriority])) { + unset($this->priorities[$this->maxPriority]); + unset($this->values[$this->maxPriority]); + $this->maxPriority = empty($this->priorities) ? null : max($this->priorities); + $this->subIndex = -1; + } else { + unset($this->values[$this->maxPriority][$key]); + } + ++$this->index; + ++$this->subIndex; + --$this->count; + } + + /** + * Set the iterator pointer to the next element in the queue + * without removing the previous element + */ + public function next() + { + if (false === next($this->values[$this->maxPriority])) { + unset($this->subPriorities[$this->maxPriority]); + reset($this->values[$this->maxPriority]); + $this->maxPriority = empty($this->subPriorities) ? null : max($this->subPriorities); + $this->subIndex = -1; + } + ++$this->index; + ++$this->subIndex; + } + + /** + * Check if the current iterator is valid + * + * @return boolean + */ + public function valid() + { + return isset($this->values[$this->maxPriority]); + } + + /** + * Rewind the current iterator + */ + public function rewind() + { + $this->subPriorities = $this->priorities; + $this->maxPriority = empty($this->priorities) ? 0 : max($this->priorities); + $this->index = 0; + $this->subIndex = 0; + } + + /** + * Serialize to an array + * + * Array will be priority => data pairs + * + * @return array + */ + public function toArray() + { + $array = []; + foreach (clone $this as $item) { + $array[] = $item; + } + return $array; + } + + /** + * Serialize + * + * @return string + */ + public function serialize() + { + $clone = clone $this; + $clone->setExtractFlags(self::EXTR_BOTH); + + $data = []; + foreach ($clone as $item) { + $data[] = $item; + } + + return serialize($data); + } + + /** + * Deserialize + * + * @param string $data + * @return void + */ + public function unserialize($data) + { + foreach (unserialize($data) as $item) { + $this->insert($item['data'], $item['priority']); + } + } + + /** + * Set the extract flag + * + * @param integer $flag + */ + public function setExtractFlags($flag) + { + switch ($flag) { + case self::EXTR_DATA: + case self::EXTR_PRIORITY: + case self::EXTR_BOTH: + $this->extractFlag = $flag; + break; + default: + throw new Exception\InvalidArgumentException("The extract flag specified is not valid"); + } + } + + /** + * Check if the queue is empty + * + * @return boolean + */ + public function isEmpty() + { + return empty($this->values); + } + + /** + * Does the queue contain the given datum? + * + * @param mixed $datum + * @return bool + */ + public function contains($datum) + { + foreach ($this->values as $values) { + if (in_array($datum, $values)) { + return true; + } + } + return false; + } + + /** + * Does the queue have an item with the given priority? + * + * @param int $priority + * @return bool + */ + public function hasPriority($priority) + { + return isset($this->values[$priority]); + } +} diff --git a/bundled-libs/laminas/laminas-stdlib/src/Glob.php b/bundled-libs/laminas/laminas-stdlib/src/Glob.php new file mode 100644 index 00000000..f25d0b9d --- /dev/null +++ b/bundled-libs/laminas/laminas-stdlib/src/Glob.php @@ -0,0 +1,201 @@ + GLOB_MARK, + self::GLOB_NOSORT => GLOB_NOSORT, + self::GLOB_NOCHECK => GLOB_NOCHECK, + self::GLOB_NOESCAPE => GLOB_NOESCAPE, + self::GLOB_BRACE => defined('GLOB_BRACE') ? GLOB_BRACE : 0, + self::GLOB_ONLYDIR => GLOB_ONLYDIR, + self::GLOB_ERR => GLOB_ERR, + ]; + + $globFlags = 0; + + foreach ($flagMap as $internalFlag => $globFlag) { + if ($flags & $internalFlag) { + $globFlags |= $globFlag; + } + } + } else { + $globFlags = 0; + } + + ErrorHandler::start(); + $res = glob($pattern, $globFlags); + $err = ErrorHandler::stop(); + if ($res === false) { + throw new Exception\RuntimeException("glob('{$pattern}', {$globFlags}) failed", 0, $err); + } + return $res; + } + + /** + * Expand braces manually, then use the system glob. + * + * @param string $pattern + * @param int $flags + * @return array + * @throws Exception\RuntimeException + */ + protected static function fallbackGlob($pattern, $flags) + { + if (! $flags & self::GLOB_BRACE) { + return static::systemGlob($pattern, $flags); + } + + $flags &= ~self::GLOB_BRACE; + $length = strlen($pattern); + $paths = []; + + if ($flags & self::GLOB_NOESCAPE) { + $begin = strpos($pattern, '{'); + } else { + $begin = 0; + + while (true) { + if ($begin === $length) { + $begin = false; + break; + } elseif ($pattern[$begin] === '\\' && ($begin + 1) < $length) { + $begin++; + } elseif ($pattern[$begin] === '{') { + break; + } + + $begin++; + } + } + + if ($begin === false) { + return static::systemGlob($pattern, $flags); + } + + $next = static::nextBraceSub($pattern, $begin + 1, $flags); + + if ($next === null) { + return static::systemGlob($pattern, $flags); + } + + $rest = $next; + + while ($pattern[$rest] !== '}') { + $rest = static::nextBraceSub($pattern, $rest + 1, $flags); + + if ($rest === null) { + return static::systemGlob($pattern, $flags); + } + } + + $p = $begin + 1; + + while (true) { + $subPattern = substr($pattern, 0, $begin) + . substr($pattern, $p, $next - $p) + . substr($pattern, $rest + 1); + + $result = static::fallbackGlob($subPattern, $flags | self::GLOB_BRACE); + + if ($result) { + $paths = array_merge($paths, $result); + } + + if ($pattern[$next] === '}') { + break; + } + + $p = $next + 1; + $next = static::nextBraceSub($pattern, $p, $flags); + } + + return array_unique($paths); + } + + /** + * Find the end of the sub-pattern in a brace expression. + * + * @param string $pattern + * @param int $begin + * @param int $flags + * @return int|null + */ + protected static function nextBraceSub($pattern, $begin, $flags) + { + $length = strlen($pattern); + $depth = 0; + $current = $begin; + + while ($current < $length) { + if (! $flags & self::GLOB_NOESCAPE && $pattern[$current] === '\\') { + if (++$current === $length) { + break; + } + + $current++; + } else { + if (($pattern[$current] === '}' && $depth-- === 0) || ($pattern[$current] === ',' && $depth === 0)) { + break; + } elseif ($pattern[$current++] === '{') { + $depth++; + } + } + } + + return ($current < $length ? $current : null); + } +} diff --git a/bundled-libs/laminas/laminas-stdlib/src/Guard/AllGuardsTrait.php b/bundled-libs/laminas/laminas-stdlib/src/Guard/AllGuardsTrait.php new file mode 100644 index 00000000..e701c176 --- /dev/null +++ b/bundled-libs/laminas/laminas-stdlib/src/Guard/AllGuardsTrait.php @@ -0,0 +1,19 @@ +metadata[$spec] = $value; + return $this; + } + if (! is_array($spec) && ! $spec instanceof Traversable) { + throw new Exception\InvalidArgumentException(sprintf( + 'Expected a string, array, or Traversable argument in first position; received "%s"', + (is_object($spec) ? get_class($spec) : gettype($spec)) + )); + } + foreach ($spec as $key => $value) { + $this->metadata[$key] = $value; + } + return $this; + } + + /** + * Retrieve all metadata or a single metadatum as specified by key + * + * @param null|string|int $key + * @param null|mixed $default + * @throws Exception\InvalidArgumentException + * @return mixed + */ + public function getMetadata($key = null, $default = null) + { + if (null === $key) { + return $this->metadata; + } + + if (! is_scalar($key)) { + throw new Exception\InvalidArgumentException('Non-scalar argument provided for key'); + } + + if (array_key_exists($key, $this->metadata)) { + return $this->metadata[$key]; + } + + return $default; + } + + /** + * Set message content + * + * @param mixed $value + * @return Message + */ + public function setContent($value) + { + $this->content = $value; + return $this; + } + + /** + * Get message content + * + * @return mixed + */ + public function getContent() + { + return $this->content; + } + + /** + * @return string + */ + public function toString() + { + $request = ''; + foreach ($this->getMetadata() as $key => $value) { + $request .= sprintf( + "%s: %s\r\n", + (string) $key, + (string) $value + ); + } + $request .= "\r\n" . $this->getContent(); + return $request; + } +} diff --git a/bundled-libs/laminas/laminas-stdlib/src/MessageInterface.php b/bundled-libs/laminas/laminas-stdlib/src/MessageInterface.php new file mode 100644 index 00000000..76f089a0 --- /dev/null +++ b/bundled-libs/laminas/laminas-stdlib/src/MessageInterface.php @@ -0,0 +1,43 @@ +exchangeArray($values); + } + + /** + * Populate from query string + * + * @param string $string + * @return void + */ + public function fromString($string) + { + $array = []; + parse_str($string, $array); + $this->fromArray($array); + } + + /** + * Serialize to native PHP array + * + * @return array + */ + public function toArray() + { + return $this->getArrayCopy(); + } + + /** + * Serialize to query string + * + * @return string + */ + public function toString() + { + return http_build_query($this->toArray()); + } + + /** + * Retrieve by key + * + * Returns null if the key does not exist. + * + * @param string $name + * @return mixed + */ + public function offsetGet($name) + { + if ($this->offsetExists($name)) { + return parent::offsetGet($name); + } + return; + } + + /** + * @param string $name + * @param mixed $default optional default value + * @return mixed + */ + public function get($name, $default = null) + { + if ($this->offsetExists($name)) { + return parent::offsetGet($name); + } + return $default; + } + + /** + * @param string $name + * @param mixed $value + * @return Parameters + */ + public function set($name, $value) + { + $this[$name] = $value; + return $this; + } +} diff --git a/bundled-libs/laminas/laminas-stdlib/src/ParametersInterface.php b/bundled-libs/laminas/laminas-stdlib/src/ParametersInterface.php new file mode 100644 index 00000000..0c62df3a --- /dev/null +++ b/bundled-libs/laminas/laminas-stdlib/src/ParametersInterface.php @@ -0,0 +1,85 @@ +items[$name])) { + $this->count++; + } + + $this->sorted = false; + + $this->items[$name] = [ + 'data' => $value, + 'priority' => (int) $priority, + 'serial' => $this->serial++, + ]; + } + + /** + * @param string $name + * @param int $priority + * + * @return $this + * + * @throws \Exception + */ + public function setPriority($name, $priority) + { + if (! isset($this->items[$name])) { + throw new \Exception("item $name not found"); + } + + $this->items[$name]['priority'] = (int) $priority; + $this->sorted = false; + + return $this; + } + + /** + * Remove a item. + * + * @param string $name + * @return void + */ + public function remove($name) + { + if (isset($this->items[$name])) { + $this->count--; + } + + unset($this->items[$name]); + } + + /** + * Remove all items. + * + * @return void + */ + public function clear() + { + $this->items = []; + $this->serial = 0; + $this->count = 0; + $this->sorted = false; + } + + /** + * Get a item. + * + * @param string $name + * @return mixed + */ + public function get($name) + { + if (! isset($this->items[$name])) { + return; + } + + return $this->items[$name]['data']; + } + + /** + * Sort all items. + * + * @return void + */ + protected function sort() + { + if (! $this->sorted) { + uasort($this->items, [$this, 'compare']); + $this->sorted = true; + } + } + + /** + * Compare the priority of two items. + * + * @param array $item1, + * @param array $item2 + * @return int + */ + protected function compare(array $item1, array $item2) + { + return ($item1['priority'] === $item2['priority']) + ? ($item1['serial'] > $item2['serial'] ? -1 : 1) * $this->isLIFO + : ($item1['priority'] > $item2['priority'] ? -1 : 1); + } + + /** + * Get/Set serial order mode + * + * @param bool|null $flag + * + * @return bool + */ + public function isLIFO($flag = null) + { + if ($flag !== null) { + $isLifo = $flag === true ? 1 : -1; + + if ($isLifo !== $this->isLIFO) { + $this->isLIFO = $isLifo; + $this->sorted = false; + } + } + + return 1 === $this->isLIFO; + } + + /** + * {@inheritDoc} + */ + public function rewind() + { + $this->sort(); + reset($this->items); + } + + /** + * {@inheritDoc} + */ + public function current() + { + $this->sorted || $this->sort(); + $node = current($this->items); + + return $node ? $node['data'] : false; + } + + /** + * {@inheritDoc} + */ + public function key() + { + $this->sorted || $this->sort(); + return key($this->items); + } + + /** + * {@inheritDoc} + */ + public function next() + { + $node = next($this->items); + + return $node ? $node['data'] : false; + } + + /** + * {@inheritDoc} + */ + public function valid() + { + return current($this->items) !== false; + } + + /** + * @return self + */ + public function getIterator() + { + return clone $this; + } + + /** + * {@inheritDoc} + */ + public function count() + { + return $this->count; + } + + /** + * Return list as array + * + * @param int $flag + * + * @return array + */ + public function toArray($flag = self::EXTR_DATA) + { + $this->sort(); + + if ($flag == self::EXTR_BOTH) { + return $this->items; + } + + return array_map( + function ($item) use ($flag) { + return ($flag == PriorityList::EXTR_PRIORITY) ? $item['priority'] : $item['data']; + }, + $this->items + ); + } +} diff --git a/bundled-libs/laminas/laminas-stdlib/src/PriorityQueue.php b/bundled-libs/laminas/laminas-stdlib/src/PriorityQueue.php new file mode 100644 index 00000000..ab4b1b65 --- /dev/null +++ b/bundled-libs/laminas/laminas-stdlib/src/PriorityQueue.php @@ -0,0 +1,300 @@ +items[] = [ + 'data' => $data, + 'priority' => $priority, + ]; + $this->getQueue()->insert($data, $priority); + return $this; + } + + /** + * Remove an item from the queue + * + * This is different than {@link extract()}; its purpose is to dequeue an + * item. + * + * This operation is potentially expensive, as it requires + * re-initialization and re-population of the inner queue. + * + * Note: this removes the first item matching the provided item found. If + * the same item has been added multiple times, it will not remove other + * instances. + * + * @param mixed $datum + * @return bool False if the item was not found, true otherwise. + */ + public function remove($datum) + { + $found = false; + foreach ($this->items as $key => $item) { + if ($item['data'] === $datum) { + $found = true; + break; + } + } + if ($found) { + unset($this->items[$key]); + $this->queue = null; + + if (! $this->isEmpty()) { + $queue = $this->getQueue(); + foreach ($this->items as $item) { + $queue->insert($item['data'], $item['priority']); + } + } + return true; + } + return false; + } + + /** + * Is the queue empty? + * + * @return bool + */ + public function isEmpty() + { + return (0 === $this->count()); + } + + /** + * How many items are in the queue? + * + * @return int + */ + public function count() + { + return count($this->items); + } + + /** + * Peek at the top node in the queue, based on priority. + * + * @return mixed + */ + public function top() + { + return $this->getIterator()->top(); + } + + /** + * Extract a node from the inner queue and sift up + * + * @return mixed + */ + public function extract() + { + return $this->getQueue()->extract(); + } + + /** + * Retrieve the inner iterator + * + * SplPriorityQueue acts as a heap, which typically implies that as items + * are iterated, they are also removed. This does not work for situations + * where the queue may be iterated multiple times. As such, this class + * aggregates the values, and also injects an SplPriorityQueue. This method + * retrieves the inner queue object, and clones it for purposes of + * iteration. + * + * @return SplPriorityQueue + */ + public function getIterator() + { + $queue = $this->getQueue(); + return clone $queue; + } + + /** + * Serialize the data structure + * + * @return string + */ + public function serialize() + { + return serialize($this->items); + } + + /** + * Unserialize a string into a PriorityQueue object + * + * Serialization format is compatible with {@link Laminas\Stdlib\SplPriorityQueue} + * + * @param string $data + * @return void + */ + public function unserialize($data) + { + foreach (unserialize($data) as $item) { + $this->insert($item['data'], $item['priority']); + } + } + + /** + * Serialize to an array + * + * By default, returns only the item data, and in the order registered (not + * sorted). You may provide one of the EXTR_* flags as an argument, allowing + * the ability to return priorities or both data and priority. + * + * @param int $flag + * @return array + */ + public function toArray($flag = self::EXTR_DATA) + { + switch ($flag) { + case self::EXTR_BOTH: + return $this->items; + case self::EXTR_PRIORITY: + return array_map(function ($item) { + return $item['priority']; + }, $this->items); + case self::EXTR_DATA: + default: + return array_map(function ($item) { + return $item['data']; + }, $this->items); + } + } + + /** + * Specify the internal queue class + * + * Please see {@link getIterator()} for details on the necessity of an + * internal queue class. The class provided should extend SplPriorityQueue. + * + * @param string $class + * @return PriorityQueue + */ + public function setInternalQueueClass($class) + { + $this->queueClass = (string) $class; + return $this; + } + + /** + * Does the queue contain the given datum? + * + * @param mixed $datum + * @return bool + */ + public function contains($datum) + { + foreach ($this->items as $item) { + if ($item['data'] === $datum) { + return true; + } + } + return false; + } + + /** + * Does the queue have an item with the given priority? + * + * @param int $priority + * @return bool + */ + public function hasPriority($priority) + { + foreach ($this->items as $item) { + if ($item['priority'] === $priority) { + return true; + } + } + return false; + } + + /** + * Get the inner priority queue instance + * + * @throws Exception\DomainException + * @return SplPriorityQueue + */ + protected function getQueue() + { + if (null === $this->queue) { + $this->queue = new $this->queueClass(); + if (! $this->queue instanceof \SplPriorityQueue) { + throw new Exception\DomainException(sprintf( + 'PriorityQueue expects an internal queue of type SplPriorityQueue; received "%s"', + get_class($this->queue) + )); + } + } + return $this->queue; + } + + /** + * Add support for deep cloning + * + * @return void + */ + public function __clone() + { + if (null !== $this->queue) { + $this->queue = clone $this->queue; + } + } +} diff --git a/bundled-libs/laminas/laminas-stdlib/src/Request.php b/bundled-libs/laminas/laminas-stdlib/src/Request.php new file mode 100644 index 00000000..a593a480 --- /dev/null +++ b/bundled-libs/laminas/laminas-stdlib/src/Request.php @@ -0,0 +1,14 @@ +serial--]; + } + parent::insert($datum, $priority); + } + + /** + * Serialize to an array + * + * Array will be priority => data pairs + * + * @return array + */ + public function toArray() + { + $array = []; + foreach (clone $this as $item) { + $array[] = $item; + } + return $array; + } + + /** + * Serialize + * + * @return string + */ + public function serialize() + { + $clone = clone $this; + $clone->setExtractFlags(self::EXTR_BOTH); + + $data = []; + foreach ($clone as $item) { + $data[] = $item; + } + + return serialize($data); + } + + /** + * Deserialize + * + * @param string $data + * @return void + */ + public function unserialize($data) + { + $this->serial = PHP_INT_MAX; + foreach (unserialize($data) as $item) { + $this->serial--; + $this->insert($item['data'], $item['priority']); + } + } +} diff --git a/bundled-libs/laminas/laminas-stdlib/src/SplQueue.php b/bundled-libs/laminas/laminas-stdlib/src/SplQueue.php new file mode 100644 index 00000000..9eb2abb7 --- /dev/null +++ b/bundled-libs/laminas/laminas-stdlib/src/SplQueue.php @@ -0,0 +1,54 @@ +toArray()); + } + + /** + * Unserialize + * + * @param string $data + * @return void + */ + public function unserialize($data) + { + foreach (unserialize($data) as $item) { + $this->push($item); + } + } +} diff --git a/bundled-libs/laminas/laminas-stdlib/src/SplStack.php b/bundled-libs/laminas/laminas-stdlib/src/SplStack.php new file mode 100644 index 00000000..404203dd --- /dev/null +++ b/bundled-libs/laminas/laminas-stdlib/src/SplStack.php @@ -0,0 +1,54 @@ +toArray()); + } + + /** + * Unserialize + * + * @param string $data + * @return void + */ + public function unserialize($data) + { + foreach (unserialize($data) as $item) { + $this->unshift($item); + } + } +} diff --git a/bundled-libs/laminas/laminas-stdlib/src/StringUtils.php b/bundled-libs/laminas/laminas-stdlib/src/StringUtils.php new file mode 100644 index 00000000..a52218c3 --- /dev/null +++ b/bundled-libs/laminas/laminas-stdlib/src/StringUtils.php @@ -0,0 +1,186 @@ +setEncoding($encoding, $convertEncoding); + return $wrapper; + } + } + + throw new Exception\RuntimeException( + 'No wrapper found supporting "' . $encoding . '"' + . (($convertEncoding !== null) ? ' and "' . $convertEncoding . '"' : '') + ); + } + + /** + * Get a list of all known single-byte character encodings + * + * @return string[] + */ + public static function getSingleByteEncodings() + { + return static::$singleByteEncodings; + } + + /** + * Check if a given encoding is a known single-byte character encoding + * + * @param string $encoding + * @return bool + */ + public static function isSingleByteEncoding($encoding) + { + return in_array(strtoupper($encoding), static::$singleByteEncodings); + } + + /** + * Check if a given string is valid UTF-8 encoded + * + * @param string $str + * @return bool + */ + public static function isValidUtf8($str) + { + return is_string($str) && ($str === '' || preg_match('/^./su', $str) == 1); + } + + /** + * Is PCRE compiled with Unicode support? + * + * @return bool + */ + public static function hasPcreUnicodeSupport() + { + if (static::$hasPcreUnicodeSupport === null) { + ErrorHandler::start(); + static::$hasPcreUnicodeSupport = defined('PREG_BAD_UTF8_OFFSET_ERROR') && preg_match('/\pL/u', 'a') == 1; + ErrorHandler::stop(); + } + return static::$hasPcreUnicodeSupport; + } +} diff --git a/bundled-libs/laminas/laminas-stdlib/src/StringWrapper/AbstractStringWrapper.php b/bundled-libs/laminas/laminas-stdlib/src/StringWrapper/AbstractStringWrapper.php new file mode 100644 index 00000000..a3125f06 --- /dev/null +++ b/bundled-libs/laminas/laminas-stdlib/src/StringWrapper/AbstractStringWrapper.php @@ -0,0 +1,268 @@ +convertEncoding = $convertEncodingUpper; + } else { + $this->convertEncoding = null; + } + $this->encoding = $encodingUpper; + + return $this; + } + + /** + * Get the defined character encoding to work with + * + * @return string + * @throws Exception\LogicException If no encoding was defined + */ + public function getEncoding() + { + return $this->encoding; + } + + /** + * Get the defined character encoding to convert to + * + * @return string|null + */ + public function getConvertEncoding() + { + return $this->convertEncoding; + } + + /** + * Convert a string from defined character encoding to the defined convert encoding + * + * @param string $str + * @param bool $reverse + * @return string|false + */ + public function convert($str, $reverse = false) + { + $encoding = $this->getEncoding(); + $convertEncoding = $this->getConvertEncoding(); + if ($convertEncoding === null) { + throw new Exception\LogicException( + 'No convert encoding defined' + ); + } + + if ($encoding === $convertEncoding) { + return $str; + } + + $from = $reverse ? $convertEncoding : $encoding; + $to = $reverse ? $encoding : $convertEncoding; + throw new Exception\RuntimeException(sprintf( + 'Converting from "%s" to "%s" isn\'t supported by this string wrapper', + $from, + $to + )); + } + + /** + * Wraps a string to a given number of characters + * + * @param string $string + * @param int $width + * @param string $break + * @param bool $cut + * @return string|false + */ + public function wordWrap($string, $width = 75, $break = "\n", $cut = false) + { + $string = (string) $string; + if ($string === '') { + return ''; + } + + $break = (string) $break; + if ($break === '') { + throw new Exception\InvalidArgumentException('Break string cannot be empty'); + } + + $width = (int) $width; + if ($width === 0 && $cut) { + throw new Exception\InvalidArgumentException('Cannot force cut when width is zero'); + } + + if (StringUtils::isSingleByteEncoding($this->getEncoding())) { + return wordwrap($string, $width, $break, $cut); + } + + $stringWidth = $this->strlen($string); + $breakWidth = $this->strlen($break); + + $result = ''; + $lastStart = $lastSpace = 0; + + for ($current = 0; $current < $stringWidth; $current++) { + $char = $this->substr($string, $current, 1); + + $possibleBreak = $char; + if ($breakWidth !== 1) { + $possibleBreak = $this->substr($string, $current, $breakWidth); + } + + if ($possibleBreak === $break) { + $result .= $this->substr($string, $lastStart, $current - $lastStart + $breakWidth); + $current += $breakWidth - 1; + $lastStart = $lastSpace = $current + 1; + continue; + } + + if ($char === ' ') { + if ($current - $lastStart >= $width) { + $result .= $this->substr($string, $lastStart, $current - $lastStart) . $break; + $lastStart = $current + 1; + } + + $lastSpace = $current; + continue; + } + + if ($current - $lastStart >= $width && $cut && $lastStart >= $lastSpace) { + $result .= $this->substr($string, $lastStart, $current - $lastStart) . $break; + $lastStart = $lastSpace = $current; + continue; + } + + if ($current - $lastStart >= $width && $lastStart < $lastSpace) { + $result .= $this->substr($string, $lastStart, $lastSpace - $lastStart) . $break; + $lastStart = $lastSpace = $lastSpace + 1; + continue; + } + } + + if ($lastStart !== $current) { + $result .= $this->substr($string, $lastStart, $current - $lastStart); + } + + return $result; + } + + /** + * Pad a string to a certain length with another string + * + * @param string $input + * @param int $padLength + * @param string $padString + * @param int $padType + * @return string + */ + public function strPad($input, $padLength, $padString = ' ', $padType = STR_PAD_RIGHT) + { + if (StringUtils::isSingleByteEncoding($this->getEncoding())) { + return str_pad($input, $padLength, $padString, $padType); + } + + $lengthOfPadding = $padLength - $this->strlen($input); + if ($lengthOfPadding <= 0) { + return $input; + } + + $padStringLength = $this->strlen($padString); + if ($padStringLength === 0) { + return $input; + } + + $repeatCount = floor($lengthOfPadding / $padStringLength); + + if ($padType === STR_PAD_BOTH) { + $repeatCountLeft = $repeatCountRight = ($repeatCount - $repeatCount % 2) / 2; + + $lastStringLength = $lengthOfPadding - 2 * $repeatCountLeft * $padStringLength; + $lastStringLeftLength = $lastStringRightLength = floor($lastStringLength / 2); + $lastStringRightLength += $lastStringLength % 2; + + $lastStringLeft = $this->substr($padString, 0, $lastStringLeftLength); + $lastStringRight = $this->substr($padString, 0, $lastStringRightLength); + + return str_repeat($padString, $repeatCountLeft) . $lastStringLeft + . $input + . str_repeat($padString, $repeatCountRight) . $lastStringRight; + } + + $lastString = $this->substr($padString, 0, $lengthOfPadding % $padStringLength); + + if ($padType === STR_PAD_LEFT) { + return str_repeat($padString, $repeatCount) . $lastString . $input; + } + + return $input . str_repeat($padString, $repeatCount) . $lastString; + } +} diff --git a/bundled-libs/laminas/laminas-stdlib/src/StringWrapper/Iconv.php b/bundled-libs/laminas/laminas-stdlib/src/StringWrapper/Iconv.php new file mode 100644 index 00000000..126b0485 --- /dev/null +++ b/bundled-libs/laminas/laminas-stdlib/src/StringWrapper/Iconv.php @@ -0,0 +1,288 @@ +getEncoding()); + } + + /** + * Returns the portion of string specified by the start and length parameters + * + * @param string $str + * @param int $offset + * @param int|null $length + * @return string|false + */ + public function substr($str, $offset = 0, $length = null) + { + return iconv_substr($str, $offset, $length, $this->getEncoding()); + } + + /** + * Find the position of the first occurrence of a substring in a string + * + * @param string $haystack + * @param string $needle + * @param int $offset + * @return int|false + */ + public function strpos($haystack, $needle, $offset = 0) + { + return iconv_strpos($haystack, $needle, $offset, $this->getEncoding()); + } + + /** + * Convert a string from defined encoding to the defined convert encoding + * + * @param string $str + * @param bool $reverse + * @return string|false + */ + public function convert($str, $reverse = false) + { + $encoding = $this->getEncoding(); + $convertEncoding = $this->getConvertEncoding(); + if ($convertEncoding === null) { + throw new Exception\LogicException( + 'No convert encoding defined' + ); + } + + if ($encoding === $convertEncoding) { + return $str; + } + + $fromEncoding = $reverse ? $convertEncoding : $encoding; + $toEncoding = $reverse ? $encoding : $convertEncoding; + + // automatically add "//IGNORE" to not stop converting on invalid characters + // invalid characters triggers a notice anyway + return iconv($fromEncoding, $toEncoding . '//IGNORE', $str); + } +} diff --git a/bundled-libs/laminas/laminas-stdlib/src/StringWrapper/Intl.php b/bundled-libs/laminas/laminas-stdlib/src/StringWrapper/Intl.php new file mode 100644 index 00000000..217bd4fc --- /dev/null +++ b/bundled-libs/laminas/laminas-stdlib/src/StringWrapper/Intl.php @@ -0,0 +1,87 @@ +getEncoding()); + } + + /** + * Returns the portion of string specified by the start and length parameters + * + * @param string $str + * @param int $offset + * @param int|null $length + * @return string|false + */ + public function substr($str, $offset = 0, $length = null) + { + return mb_substr($str, $offset, $length, $this->getEncoding()); + } + + /** + * Find the position of the first occurrence of a substring in a string + * + * @param string $haystack + * @param string $needle + * @param int $offset + * @return int|false + */ + public function strpos($haystack, $needle, $offset = 0) + { + return mb_strpos($haystack, $needle, $offset, $this->getEncoding()); + } + + /** + * Convert a string from defined encoding to the defined convert encoding + * + * @param string $str + * @param bool $reverse + * @return string|false + */ + public function convert($str, $reverse = false) + { + $encoding = $this->getEncoding(); + $convertEncoding = $this->getConvertEncoding(); + + if ($convertEncoding === null) { + throw new Exception\LogicException( + 'No convert encoding defined' + ); + } + + if ($encoding === $convertEncoding) { + return $str; + } + + $fromEncoding = $reverse ? $convertEncoding : $encoding; + $toEncoding = $reverse ? $encoding : $convertEncoding; + return mb_convert_encoding($str, $toEncoding, $fromEncoding); + } +} diff --git a/bundled-libs/laminas/laminas-stdlib/src/StringWrapper/Native.php b/bundled-libs/laminas/laminas-stdlib/src/StringWrapper/Native.php new file mode 100644 index 00000000..0c373466 --- /dev/null +++ b/bundled-libs/laminas/laminas-stdlib/src/StringWrapper/Native.php @@ -0,0 +1,133 @@ +convertEncoding = $encodingUpper; + } + + if ($convertEncoding !== null) { + if ($encodingUpper !== strtoupper($convertEncoding)) { + throw new Exception\InvalidArgumentException( + 'Wrapper doesn\'t support to convert between character encodings' + ); + } + + $this->convertEncoding = $encodingUpper; + } else { + $this->convertEncoding = null; + } + $this->encoding = $encodingUpper; + + return $this; + } + + /** + * Returns the length of the given string + * + * @param string $str + * @return int|false + */ + public function strlen($str) + { + return strlen($str); + } + + /** + * Returns the portion of string specified by the start and length parameters + * + * @param string $str + * @param int $offset + * @param int|null $length + * @return string|false + */ + public function substr($str, $offset = 0, $length = null) + { + return substr($str, $offset, $length); + } + + /** + * Find the position of the first occurrence of a substring in a string + * + * @param string $haystack + * @param string $needle + * @param int $offset + * @return int|false + */ + public function strpos($haystack, $needle, $offset = 0) + { + return strpos($haystack, $needle, $offset); + } +} diff --git a/bundled-libs/laminas/laminas-stdlib/src/StringWrapper/StringWrapperInterface.php b/bundled-libs/laminas/laminas-stdlib/src/StringWrapper/StringWrapperInterface.php new file mode 100644 index 00000000..5c10365b --- /dev/null +++ b/bundled-libs/laminas/laminas-stdlib/src/StringWrapper/StringWrapperInterface.php @@ -0,0 +1,110 @@ + laminas-project.flf. + +## 0.3.5 - 2019-11-06 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#25](https://github.com/laminas/laminas-zendframework-bridge/pull/25) adds entries for ZendHttp and ZendModule, which are file name segments in files from the zend-feed and zend-config-aggregator-module packages, respectively. + +## 0.3.4 - 2019-11-06 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#24](https://github.com/laminas/laminas-zendframework-bridge/pull/24) adds a rule to never rewrite the string `Doctrine\Zend`. + +- [#23](https://github.com/laminas/laminas-zendframework-bridge/pull/23) adds a missing map for each of ZendAcl and ZendRbac, which occur in the zend-expressive-authorization-acl and zend-expressive-authorization-rbac packages, respectively. + +## 0.3.3 - 2019-11-06 + +### Added + +- [#22](https://github.com/laminas/laminas-zendframework-bridge/pull/22) adds configuration post-processing features, exposed both as a laminas-config-aggregator post processor (for use with Expressive applications) and as a laminas-modulemanager `EVENT_MERGE_CONFIG` listener (for use with MVC applications). When registered, it will post-process the configuration, replacing known Zend Framework-specific strings with their Laminas replacements. A ruleset is provided that ensures dependency configuration is rewritten in a safe manner, routing configuration is skipped, and certain top-level configuration keys are matched exactly (instead of potentially as substrings or word stems). A later release of laminas-migration will auto-register these tools in applications when possible. + +### Changed + +- [#22](https://github.com/laminas/laminas-zendframework-bridge/pull/22) removes support for PHP versions prior to PHP 5.6. We have decided to only support supported PHP versions, whether that support is via php.net or commercial. The lowest supported PHP version we have found is 5.6. Users wishing to migrate to Laminas must at least update to PHP 5.6 before doing so. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 0.3.2 - 2019-10-30 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- [#21](https://github.com/laminas/laminas-zendframework-bridge/pull/21) removes rewriting of the Amazon library, as it is not moving to Laminas. + +- [#21](https://github.com/laminas/laminas-zendframework-bridge/pull/21) removes rewriting of the GCM and APNS libraries, as they are not moving to Laminas. + +### Fixed + +- [#21](https://github.com/laminas/laminas-zendframework-bridge/pull/21) fixes how the recaptcha and twitter library package and namespaces are rewritten. + +## 0.3.1 - 2019-04-25 + +### Added + +- [#20](https://github.com/laminas/laminas-zendframework-bridge/pull/20) provides an additional autoloader that is _prepended_ to the autoloader + stack. This new autoloader will create class aliases for interfaces, classes, + and traits referenced in type hints and class declarations, ensuring PHP is + able to resolve them correctly during class_alias operations. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 0.3.0 - 2019-04-12 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- [#16](https://github.com/laminas/laminas-zendframework-bridge/pull/16) removes the `RewriteRules::classRewrite()` method, as it is no longer + needed due to internal refactoring. + +### Fixed + +- [#16](https://github.com/laminas/laminas-zendframework-bridge/pull/16) fixes how the rewrite rules detect the word `Zend` in subnamespaces and + class names to be both more robust and simpler. + +## 0.2.5 - 2019-04-11 + +### Added + +- [#12](https://github.com/laminas/laminas-zendframework-bridge/pull/12) adds functionality for ensuring we alias namespaces and classes that + include the word `Zend` in them; e.g., `Zend\Expressive\ZendView\ZendViewRendererFactory` + will now alias to `Expressive\LaminasView\LaminasViewRendererFactory`. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 0.2.4 - 2019-04-11 + +### Added + +- [#11](https://github.com/laminas/laminas-zendframework-bridge/pull/11) adds maps for the Expressive router adapter packages. + +- [#10](https://github.com/laminas/laminas-zendframework-bridge/pull/10) adds a map for the Psr7Bridge package, as it used `Zend` within a subnamespace. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 0.2.3 - 2019-04-10 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#9](https://github.com/laminas/laminas-zendframework-bridge/pull/9) fixes the mapping for the Problem Details package. + +## 0.2.2 - 2019-04-10 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Added a check that the discovered alias exists as a class, interface, or trait + before attempting to call `class_alias()`. + +## 0.2.1 - 2019-04-10 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#8](https://github.com/laminas/laminas-zendframework-bridge/pull/8) fixes mappings for each of zend-expressive-authentication-zendauthentication, + zend-expressive-zendrouter, and zend-expressive-zendviewrenderer. + +## 0.2.0 - 2019-04-01 + +### Added + +- Nothing. + +### Changed + +- [#4](https://github.com/laminas/laminas-zendframework-bridge/pull/4) rewrites the autoloader to be class-based, via the class + `Laminas\ZendFrameworkBridge\Autoloader`. Additionally, the new approach + provides a performance boost by using a balanced tree algorithm, ensuring + matches occur faster. + +### Deprecated + +- Nothing. + +### Removed + +- [#4](https://github.com/laminas/laminas-zendframework-bridge/pull/4) removes function aliasing. Function aliasing will move to the packages that + provide functions. + +### Fixed + +- Nothing. + +## 0.1.0 - 2019-03-27 + +### Added + +- Adds an autoloader file that registers with `spl_autoload_register` a routine + for aliasing legacy ZF class/interface/trait names to Laminas Project + equivalents. + +- Adds autoloader files for aliasing legacy ZF package functions to Laminas + Project equivalents. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. diff --git a/bundled-libs/laminas/laminas-zendframework-bridge/COPYRIGHT.md b/bundled-libs/laminas/laminas-zendframework-bridge/COPYRIGHT.md new file mode 100644 index 00000000..0a8cccc0 --- /dev/null +++ b/bundled-libs/laminas/laminas-zendframework-bridge/COPYRIGHT.md @@ -0,0 +1 @@ +Copyright (c) 2020 Laminas Project a Series of LF Projects, LLC. (https://getlaminas.org/) diff --git a/bundled-libs/laminas/laminas-zendframework-bridge/LICENSE.md b/bundled-libs/laminas/laminas-zendframework-bridge/LICENSE.md new file mode 100644 index 00000000..10b40f14 --- /dev/null +++ b/bundled-libs/laminas/laminas-zendframework-bridge/LICENSE.md @@ -0,0 +1,26 @@ +Copyright (c) 2020 Laminas Project a Series of LF Projects, LLC. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +- Neither the name of Laminas Foundation nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/bundled-libs/laminas/laminas-zendframework-bridge/README.md b/bundled-libs/laminas/laminas-zendframework-bridge/README.md new file mode 100644 index 00000000..fd795382 --- /dev/null +++ b/bundled-libs/laminas/laminas-zendframework-bridge/README.md @@ -0,0 +1,24 @@ +# laminas-zendframework-bridge + +[![Build Status](https://travis-ci.com/laminas/laminas-zendframework-bridge.svg?branch=master)](https://travis-ci.com/laminas/laminas-zendframework-bridge) +[![Coverage Status](https://coveralls.io/repos/github/laminas/laminas-zendframework-bridge/badge.svg?branch=master)](https://coveralls.io/github/laminas/laminas-zendframework-bridge?branch=master) + +This library provides a custom autoloader that aliases legacy Zend Framework, +Apigility, and Expressive classes to their replacements under the Laminas +Project. + +This package should be installed only if you are also using the composer plugin +that installs Laminas packages to replace ZF/Apigility/Expressive packages. + +## Installation + +Run the following to install this library: + +```bash +$ composer require laminas/laminas-zendframework-bridge +``` + +## Support + +* [Issues](https://github.com/laminas/laminas-zendframework-bridge/issues/) +* [Forum](https://discourse.laminas.dev/) diff --git a/bundled-libs/laminas/laminas-zendframework-bridge/composer.json b/bundled-libs/laminas/laminas-zendframework-bridge/composer.json new file mode 100644 index 00000000..34af15a4 --- /dev/null +++ b/bundled-libs/laminas/laminas-zendframework-bridge/composer.json @@ -0,0 +1,58 @@ +{ + "name": "laminas/laminas-zendframework-bridge", + "description": "Alias legacy ZF class names to Laminas Project equivalents.", + "license": "BSD-3-Clause", + "keywords": [ + "autoloading", + "laminas", + "zf", + "zendframework" + ], + "support": { + "issues": "https://github.com/laminas/laminas-zendframework-bridge/issues", + "source": "https://github.com/laminas/laminas-zendframework-bridge", + "rss": "https://github.com/laminas/laminas-zendframework-bridge/releases.atom", + "forum": "https://discourse.laminas.dev/" + }, + "require": { + "php": "^5.6 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.1 || ^9.3", + "squizlabs/php_codesniffer": "^3.5" + }, + "autoload": { + "files": [ + "src/autoload.php" + ], + "psr-4": { + "Laminas\\ZendFrameworkBridge\\": "src//" + } + }, + "autoload-dev": { + "files": [ + "test/classes.php" + ], + "psr-4": { + "LaminasTest\\ZendFrameworkBridge\\": "test/", + "LaminasTest\\ZendFrameworkBridge\\TestAsset\\": "test/TestAsset/classes/", + "Laminas\\ApiTools\\": "test/TestAsset/LaminasApiTools/", + "Mezzio\\": "test/TestAsset/Mezzio/", + "Laminas\\": "test/TestAsset/Laminas/" + } + }, + "extra": { + "laminas": { + "module": "Laminas\\ZendFrameworkBridge" + } + }, + "config": { + "sort-packages": true + }, + "scripts": { + "cs-check": "phpcs", + "cs-fix": "phpcbf", + "test": "phpunit --colors=always", + "test-coverage": "phpunit --colors=always --coverage-clover clover.xml" + } +} diff --git a/bundled-libs/laminas/laminas-zendframework-bridge/config/replacements.php b/bundled-libs/laminas/laminas-zendframework-bridge/config/replacements.php new file mode 100644 index 00000000..f5344355 --- /dev/null +++ b/bundled-libs/laminas/laminas-zendframework-bridge/config/replacements.php @@ -0,0 +1,372 @@ + 'zendframework/zendframework', + 'zend-developer-tools/toolbar/bjy' => 'zend-developer-tools/toolbar/bjy', + 'zend-developer-tools/toolbar/doctrine' => 'zend-developer-tools/toolbar/doctrine', + + // NAMESPACES + // Zend Framework components + 'Zend\\AuraDi\\Config' => 'Laminas\\AuraDi\\Config', + 'Zend\\Authentication' => 'Laminas\\Authentication', + 'Zend\\Barcode' => 'Laminas\\Barcode', + 'Zend\\Cache' => 'Laminas\\Cache', + 'Zend\\Captcha' => 'Laminas\\Captcha', + 'Zend\\Code' => 'Laminas\\Code', + 'ZendCodingStandard\\Sniffs' => 'LaminasCodingStandard\\Sniffs', + 'ZendCodingStandard\\Utils' => 'LaminasCodingStandard\\Utils', + 'Zend\\ComponentInstaller' => 'Laminas\\ComponentInstaller', + 'Zend\\Config' => 'Laminas\\Config', + 'Zend\\ConfigAggregator' => 'Laminas\\ConfigAggregator', + 'Zend\\ConfigAggregatorModuleManager' => 'Laminas\\ConfigAggregatorModuleManager', + 'Zend\\ConfigAggregatorParameters' => 'Laminas\\ConfigAggregatorParameters', + 'Zend\\Console' => 'Laminas\\Console', + 'Zend\\ContainerConfigTest' => 'Laminas\\ContainerConfigTest', + 'Zend\\Crypt' => 'Laminas\\Crypt', + 'Zend\\Db' => 'Laminas\\Db', + 'ZendDeveloperTools' => 'Laminas\\DeveloperTools', + 'Zend\\Di' => 'Laminas\\Di', + 'Zend\\Diactoros' => 'Laminas\\Diactoros', + 'ZendDiagnostics\\Check' => 'Laminas\\Diagnostics\\Check', + 'ZendDiagnostics\\Result' => 'Laminas\\Diagnostics\\Result', + 'ZendDiagnostics\\Runner' => 'Laminas\\Diagnostics\\Runner', + 'Zend\\Dom' => 'Laminas\\Dom', + 'Zend\\Escaper' => 'Laminas\\Escaper', + 'Zend\\EventManager' => 'Laminas\\EventManager', + 'Zend\\Feed' => 'Laminas\\Feed', + 'Zend\\File' => 'Laminas\\File', + 'Zend\\Filter' => 'Laminas\\Filter', + 'Zend\\Form' => 'Laminas\\Form', + 'Zend\\Http' => 'Laminas\\Http', + 'Zend\\HttpHandlerRunner' => 'Laminas\\HttpHandlerRunner', + 'Zend\\Hydrator' => 'Laminas\\Hydrator', + 'Zend\\I18n' => 'Laminas\\I18n', + 'Zend\\InputFilter' => 'Laminas\\InputFilter', + 'Zend\\Json' => 'Laminas\\Json', + 'Zend\\Ldap' => 'Laminas\\Ldap', + 'Zend\\Loader' => 'Laminas\\Loader', + 'Zend\\Log' => 'Laminas\\Log', + 'Zend\\Mail' => 'Laminas\\Mail', + 'Zend\\Math' => 'Laminas\\Math', + 'Zend\\Memory' => 'Laminas\\Memory', + 'Zend\\Mime' => 'Laminas\\Mime', + 'Zend\\ModuleManager' => 'Laminas\\ModuleManager', + 'Zend\\Mvc' => 'Laminas\\Mvc', + 'Zend\\Navigation' => 'Laminas\\Navigation', + 'Zend\\Paginator' => 'Laminas\\Paginator', + 'Zend\\Permissions' => 'Laminas\\Permissions', + 'Zend\\Pimple\\Config' => 'Laminas\\Pimple\\Config', + 'Zend\\ProblemDetails' => 'Mezzio\\ProblemDetails', + 'Zend\\ProgressBar' => 'Laminas\\ProgressBar', + 'Zend\\Psr7Bridge' => 'Laminas\\Psr7Bridge', + 'Zend\\Router' => 'Laminas\\Router', + 'Zend\\Serializer' => 'Laminas\\Serializer', + 'Zend\\Server' => 'Laminas\\Server', + 'Zend\\ServiceManager' => 'Laminas\\ServiceManager', + 'ZendService\\ReCaptcha' => 'Laminas\\ReCaptcha', + 'ZendService\\Twitter' => 'Laminas\\Twitter', + 'Zend\\Session' => 'Laminas\\Session', + 'Zend\\SkeletonInstaller' => 'Laminas\\SkeletonInstaller', + 'Zend\\Soap' => 'Laminas\\Soap', + 'Zend\\Stdlib' => 'Laminas\\Stdlib', + 'Zend\\Stratigility' => 'Laminas\\Stratigility', + 'Zend\\Tag' => 'Laminas\\Tag', + 'Zend\\Test' => 'Laminas\\Test', + 'Zend\\Text' => 'Laminas\\Text', + 'Zend\\Uri' => 'Laminas\\Uri', + 'Zend\\Validator' => 'Laminas\\Validator', + 'Zend\\View' => 'Laminas\\View', + 'ZendXml' => 'Laminas\\Xml', + 'Zend\\Xml2Json' => 'Laminas\\Xml2Json', + 'Zend\\XmlRpc' => 'Laminas\\XmlRpc', + 'ZendOAuth' => 'Laminas\\OAuth', + + // class ZendAcl in zend-expressive-authorization-acl + 'ZendAcl' => 'LaminasAcl', + 'Zend\\Expressive\\Authorization\\Acl\\ZendAcl' => 'Mezzio\\Authorization\\Acl\\LaminasAcl', + // class ZendHttpClientDecorator in zend-feed + 'ZendHttp' => 'LaminasHttp', + // class ZendModuleProvider in zend-config-aggregator-modulemanager + 'ZendModule' => 'LaminasModule', + // class ZendRbac in zend-expressive-authorization-rbac + 'ZendRbac' => 'LaminasRbac', + 'Zend\\Expressive\\Authorization\\Rbac\\ZendRbac' => 'Mezzio\\Authorization\\Rbac\\LaminasRbac', + // class ZendRouter in zend-expressive-router-zendrouter + 'ZendRouter' => 'LaminasRouter', + 'Zend\\Expressive\\Router\\ZendRouter' => 'Mezzio\\Router\\LaminasRouter', + // class ZendViewRenderer in zend-expressive-zendviewrenderer + 'ZendViewRenderer' => 'LaminasViewRenderer', + 'Zend\\Expressive\\ZendView\\ZendViewRenderer' => 'Mezzio\\LaminasView\\LaminasViewRenderer', + 'a\\Zend' => 'a\\Zend', + 'b\\Zend' => 'b\\Zend', + 'c\\Zend' => 'c\\Zend', + 'd\\Zend' => 'd\\Zend', + 'e\\Zend' => 'e\\Zend', + 'f\\Zend' => 'f\\Zend', + 'g\\Zend' => 'g\\Zend', + 'h\\Zend' => 'h\\Zend', + 'i\\Zend' => 'i\\Zend', + 'j\\Zend' => 'j\\Zend', + 'k\\Zend' => 'k\\Zend', + 'l\\Zend' => 'l\\Zend', + 'm\\Zend' => 'm\\Zend', + 'n\\Zend' => 'n\\Zend', + 'o\\Zend' => 'o\\Zend', + 'p\\Zend' => 'p\\Zend', + 'q\\Zend' => 'q\\Zend', + 'r\\Zend' => 'r\\Zend', + 's\\Zend' => 's\\Zend', + 't\\Zend' => 't\\Zend', + 'u\\Zend' => 'u\\Zend', + 'v\\Zend' => 'v\\Zend', + 'w\\Zend' => 'w\\Zend', + 'x\\Zend' => 'x\\Zend', + 'y\\Zend' => 'y\\Zend', + 'z\\Zend' => 'z\\Zend', + + // Expressive + 'Zend\\Expressive' => 'Mezzio', + 'ZendAuthentication' => 'LaminasAuthentication', + 'ZendAcl' => 'LaminasAcl', + 'ZendRbac' => 'LaminasRbac', + 'ZendRouter' => 'LaminasRouter', + 'ExpressiveUrlGenerator' => 'MezzioUrlGenerator', + 'ExpressiveInstaller' => 'MezzioInstaller', + + // Apigility + 'ZF\\Apigility' => 'Laminas\\ApiTools', + 'ZF\\ApiProblem' => 'Laminas\\ApiTools\\ApiProblem', + 'ZF\\AssetManager' => 'Laminas\\ApiTools\\AssetManager', + 'ZF\\ComposerAutoloading' => 'Laminas\\ComposerAutoloading', + 'ZF\\Configuration' => 'Laminas\\ApiTools\\Configuration', + 'ZF\\ContentNegotiation' => 'Laminas\\ApiTools\\ContentNegotiation', + 'ZF\\ContentValidation' => 'Laminas\\ApiTools\\ContentValidation', + 'ZF\\DevelopmentMode' => 'Laminas\\DevelopmentMode', + 'ZF\\Doctrine\\QueryBuilder' => 'Laminas\\ApiTools\\Doctrine\\QueryBuilder', + 'ZF\\Hal' => 'Laminas\\ApiTools\\Hal', + 'ZF\\HttpCache' => 'Laminas\\ApiTools\\HttpCache', + 'ZF\\MvcAuth' => 'Laminas\\ApiTools\\MvcAuth', + 'ZF\\OAuth2' => 'Laminas\\ApiTools\\OAuth2', + 'ZF\\Rest' => 'Laminas\\ApiTools\\Rest', + 'ZF\\Rpc' => 'Laminas\\ApiTools\\Rpc', + 'ZF\\Versioning' => 'Laminas\\ApiTools\\Versioning', + 'a\\ZF' => 'a\\ZF', + 'b\\ZF' => 'b\\ZF', + 'c\\ZF' => 'c\\ZF', + 'd\\ZF' => 'd\\ZF', + 'e\\ZF' => 'e\\ZF', + 'f\\ZF' => 'f\\ZF', + 'g\\ZF' => 'g\\ZF', + 'h\\ZF' => 'h\\ZF', + 'i\\ZF' => 'i\\ZF', + 'j\\ZF' => 'j\\ZF', + 'k\\ZF' => 'k\\ZF', + 'l\\ZF' => 'l\\ZF', + 'm\\ZF' => 'm\\ZF', + 'n\\ZF' => 'n\\ZF', + 'o\\ZF' => 'o\\ZF', + 'p\\ZF' => 'p\\ZF', + 'q\\ZF' => 'q\\ZF', + 'r\\ZF' => 'r\\ZF', + 's\\ZF' => 's\\ZF', + 't\\ZF' => 't\\ZF', + 'u\\ZF' => 'u\\ZF', + 'v\\ZF' => 'v\\ZF', + 'w\\ZF' => 'w\\ZF', + 'x\\ZF' => 'x\\ZF', + 'y\\ZF' => 'y\\ZF', + 'z\\ZF' => 'z\\ZF', + + 'ApigilityModuleInterface' => 'ApiToolsModuleInterface', + 'ApigilityProviderInterface' => 'ApiToolsProviderInterface', + 'ApigilityVersionController' => 'ApiToolsVersionController', + + // PACKAGES + // ZF components, MVC + 'zendframework/skeleton-application' => 'laminas/skeleton-application', + 'zendframework/zend-auradi-config' => 'laminas/laminas-auradi-config', + 'zendframework/zend-authentication' => 'laminas/laminas-authentication', + 'zendframework/zend-barcode' => 'laminas/laminas-barcode', + 'zendframework/zend-cache' => 'laminas/laminas-cache', + 'zendframework/zend-captcha' => 'laminas/laminas-captcha', + 'zendframework/zend-code' => 'laminas/laminas-code', + 'zendframework/zend-coding-standard' => 'laminas/laminas-coding-standard', + 'zendframework/zend-component-installer' => 'laminas/laminas-component-installer', + 'zendframework/zend-composer-autoloading' => 'laminas/laminas-composer-autoloading', + 'zendframework/zend-config-aggregator' => 'laminas/laminas-config-aggregator', + 'zendframework/zend-config' => 'laminas/laminas-config', + 'zendframework/zend-console' => 'laminas/laminas-console', + 'zendframework/zend-container-config-test' => 'laminas/laminas-container-config-test', + 'zendframework/zend-crypt' => 'laminas/laminas-crypt', + 'zendframework/zend-db' => 'laminas/laminas-db', + 'zendframework/zend-developer-tools' => 'laminas/laminas-developer-tools', + 'zendframework/zend-diactoros' => 'laminas/laminas-diactoros', + 'zendframework/zenddiagnostics' => 'laminas/laminas-diagnostics', + 'zendframework/zend-di' => 'laminas/laminas-di', + 'zendframework/zend-dom' => 'laminas/laminas-dom', + 'zendframework/zend-escaper' => 'laminas/laminas-escaper', + 'zendframework/zend-eventmanager' => 'laminas/laminas-eventmanager', + 'zendframework/zend-feed' => 'laminas/laminas-feed', + 'zendframework/zend-file' => 'laminas/laminas-file', + 'zendframework/zend-filter' => 'laminas/laminas-filter', + 'zendframework/zend-form' => 'laminas/laminas-form', + 'zendframework/zend-httphandlerrunner' => 'laminas/laminas-httphandlerrunner', + 'zendframework/zend-http' => 'laminas/laminas-http', + 'zendframework/zend-hydrator' => 'laminas/laminas-hydrator', + 'zendframework/zend-i18n' => 'laminas/laminas-i18n', + 'zendframework/zend-i18n-resources' => 'laminas/laminas-i18n-resources', + 'zendframework/zend-inputfilter' => 'laminas/laminas-inputfilter', + 'zendframework/zend-json' => 'laminas/laminas-json', + 'zendframework/zend-json-server' => 'laminas/laminas-json-server', + 'zendframework/zend-ldap' => 'laminas/laminas-ldap', + 'zendframework/zend-loader' => 'laminas/laminas-loader', + 'zendframework/zend-log' => 'laminas/laminas-log', + 'zendframework/zend-mail' => 'laminas/laminas-mail', + 'zendframework/zend-math' => 'laminas/laminas-math', + 'zendframework/zend-memory' => 'laminas/laminas-memory', + 'zendframework/zend-mime' => 'laminas/laminas-mime', + 'zendframework/zend-modulemanager' => 'laminas/laminas-modulemanager', + 'zendframework/zend-mvc' => 'laminas/laminas-mvc', + 'zendframework/zend-navigation' => 'laminas/laminas-navigation', + 'zendframework/zend-oauth' => 'laminas/laminas-oauth', + 'zendframework/zend-paginator' => 'laminas/laminas-paginator', + 'zendframework/zend-permissions-acl' => 'laminas/laminas-permissions-acl', + 'zendframework/zend-permissions-rbac' => 'laminas/laminas-permissions-rbac', + 'zendframework/zend-pimple-config' => 'laminas/laminas-pimple-config', + 'zendframework/zend-progressbar' => 'laminas/laminas-progressbar', + 'zendframework/zend-psr7bridge' => 'laminas/laminas-psr7bridge', + 'zendframework/zend-recaptcha' => 'laminas/laminas-recaptcha', + 'zendframework/zend-router' => 'laminas/laminas-router', + 'zendframework/zend-serializer' => 'laminas/laminas-serializer', + 'zendframework/zend-server' => 'laminas/laminas-server', + 'zendframework/zend-servicemanager' => 'laminas/laminas-servicemanager', + 'zendframework/zendservice-recaptcha' => 'laminas/laminas-recaptcha', + 'zendframework/zendservice-twitter' => 'laminas/laminas-twitter', + 'zendframework/zend-session' => 'laminas/laminas-session', + 'zendframework/zend-skeleton-installer' => 'laminas/laminas-skeleton-installer', + 'zendframework/zend-soap' => 'laminas/laminas-soap', + 'zendframework/zend-stdlib' => 'laminas/laminas-stdlib', + 'zendframework/zend-stratigility' => 'laminas/laminas-stratigility', + 'zendframework/zend-tag' => 'laminas/laminas-tag', + 'zendframework/zend-test' => 'laminas/laminas-test', + 'zendframework/zend-text' => 'laminas/laminas-text', + 'zendframework/zend-uri' => 'laminas/laminas-uri', + 'zendframework/zend-validator' => 'laminas/laminas-validator', + 'zendframework/zend-view' => 'laminas/laminas-view', + 'zendframework/zend-xml2json' => 'laminas/laminas-xml2json', + 'zendframework/zend-xml' => 'laminas/laminas-xml', + 'zendframework/zend-xmlrpc' => 'laminas/laminas-xmlrpc', + + // Expressive packages + 'zendframework/zend-expressive' => 'mezzio/mezzio', + 'zendframework/zend-expressive-zendrouter' => 'mezzio/mezzio-laminasrouter', + 'zendframework/zend-problem-details' => 'mezzio/mezzio-problem-details', + 'zendframework/zend-expressive-zendviewrenderer' => 'mezzio/mezzio-laminasviewrenderer', + + // Apigility packages + 'zfcampus/apigility-documentation' => 'laminas-api-tools/documentation', + 'zfcampus/statuslib-example' => 'laminas-api-tools/statuslib-example', + 'zfcampus/zf-apigility' => 'laminas-api-tools/api-tools', + 'zfcampus/zf-api-problem' => 'laminas-api-tools/api-tools-api-problem', + 'zfcampus/zf-asset-manager' => 'laminas-api-tools/api-tools-asset-manager', + 'zfcampus/zf-configuration' => 'laminas-api-tools/api-tools-configuration', + 'zfcampus/zf-content-negotiation' => 'laminas-api-tools/api-tools-content-negotiation', + 'zfcampus/zf-content-validation' => 'laminas-api-tools/api-tools-content-validation', + 'zfcampus/zf-development-mode' => 'laminas/laminas-development-mode', + 'zfcampus/zf-doctrine-querybuilder' => 'laminas-api-tools/api-tools-doctrine-querybuilder', + 'zfcampus/zf-hal' => 'laminas-api-tools/api-tools-hal', + 'zfcampus/zf-http-cache' => 'laminas-api-tools/api-tools-http-cache', + 'zfcampus/zf-mvc-auth' => 'laminas-api-tools/api-tools-mvc-auth', + 'zfcampus/zf-oauth2' => 'laminas-api-tools/api-tools-oauth2', + 'zfcampus/zf-rest' => 'laminas-api-tools/api-tools-rest', + 'zfcampus/zf-rpc' => 'laminas-api-tools/api-tools-rpc', + 'zfcampus/zf-versioning' => 'laminas-api-tools/api-tools-versioning', + + // CONFIG KEYS, SCRIPT NAMES, ETC + // ZF components + '::fromZend' => '::fromLaminas', // psr7bridge + '::toZend' => '::toLaminas', // psr7bridge + 'use_zend_loader' => 'use_laminas_loader', // zend-modulemanager + 'zend-config' => 'laminas-config', + 'zend-developer-tools/' => 'laminas-developer-tools/', + 'zend-tag-cloud' => 'laminas-tag-cloud', + 'zenddevelopertools' => 'laminas-developer-tools', + 'zendbarcode' => 'laminasbarcode', + 'ZendBarcode' => 'LaminasBarcode', + 'zendcache' => 'laminascache', + 'ZendCache' => 'LaminasCache', + 'zendconfig' => 'laminasconfig', + 'ZendConfig' => 'LaminasConfig', + 'zendfeed' => 'laminasfeed', + 'ZendFeed' => 'LaminasFeed', + 'zendfilter' => 'laminasfilter', + 'ZendFilter' => 'LaminasFilter', + 'zendform' => 'laminasform', + 'ZendForm' => 'LaminasForm', + 'zendi18n' => 'laminasi18n', + 'ZendI18n' => 'LaminasI18n', + 'zendinputfilter' => 'laminasinputfilter', + 'ZendInputFilter' => 'LaminasInputFilter', + 'zendlog' => 'laminaslog', + 'ZendLog' => 'LaminasLog', + 'zendmail' => 'laminasmail', + 'ZendMail' => 'LaminasMail', + 'zendmvc' => 'laminasmvc', + 'ZendMvc' => 'LaminasMvc', + 'zendpaginator' => 'laminaspaginator', + 'ZendPaginator' => 'LaminasPaginator', + 'zendserializer' => 'laminasserializer', + 'ZendSerializer' => 'LaminasSerializer', + 'zendtag' => 'laminastag', + 'ZendTag' => 'LaminasTag', + 'zendtext' => 'laminastext', + 'ZendText' => 'LaminasText', + 'zendvalidator' => 'laminasvalidator', + 'ZendValidator' => 'LaminasValidator', + 'zendview' => 'laminasview', + 'ZendView' => 'LaminasView', + 'zend-framework.flf' => 'laminas-project.flf', + + // Expressive-related + "'zend-expressive'" => "'mezzio'", + '"zend-expressive"' => '"mezzio"', + 'zend-expressive.' => 'mezzio.', + 'zend-expressive-authorization' => 'mezzio-authorization', + 'zend-expressive-hal' => 'mezzio-hal', + 'zend-expressive-session' => 'mezzio-session', + 'zend-expressive-swoole' => 'mezzio-swoole', + 'zend-expressive-tooling' => 'mezzio-tooling', + + // Apigility-related + "'zf-apigility'" => "'api-tools'", + '"zf-apigility"' => '"api-tools"', + 'zf-apigility/' => 'api-tools/', + 'zf-apigility-admin' => 'api-tools-admin', + 'zf-content-negotiation' => 'api-tools-content-negotiation', + 'zf-hal' => 'api-tools-hal', + 'zf-rest' => 'api-tools-rest', + 'zf-rpc' => 'api-tools-rpc', + 'zf-content-validation' => 'api-tools-content-validation', + 'zf-apigility-ui' => 'api-tools-ui', + 'zf-apigility-documentation-blueprint' => 'api-tools-documentation-blueprint', + 'zf-apigility-documentation-swagger' => 'api-tools-documentation-swagger', + 'zf-apigility-welcome' => 'api-tools-welcome', + 'zf-api-problem' => 'api-tools-api-problem', + 'zf-configuration' => 'api-tools-configuration', + 'zf-http-cache' => 'api-tools-http-cache', + 'zf-mvc-auth' => 'api-tools-mvc-auth', + 'zf-oauth2' => 'api-tools-oauth2', + 'zf-versioning' => 'api-tools-versioning', + 'ZfApigilityDoctrineQueryProviderManager' => 'LaminasApiToolsDoctrineQueryProviderManager', + 'ZfApigilityDoctrineQueryCreateFilterManager' => 'LaminasApiToolsDoctrineQueryCreateFilterManager', + 'zf-apigility-doctrine' => 'api-tools-doctrine', + 'zf-development-mode' => 'laminas-development-mode', + 'zf-doctrine-querybuilder' => 'api-tools-doctrine-querybuilder', + + // 3rd party Apigility packages + 'api-skeletons/zf-' => 'api-skeletons/zf-', // api-skeletons packages + 'zf-oauth2-' => 'zf-oauth2-', // api-skeletons OAuth2-related packages + 'ZF\\OAuth2\\Client' => 'ZF\\OAuth2\\Client', // api-skeletons/zf-oauth2-client + 'ZF\\OAuth2\\Doctrine' => 'ZF\\OAuth2\\Doctrine', // api-skeletons/zf-oauth2-doctrine +]; diff --git a/bundled-libs/laminas/laminas-zendframework-bridge/src/Autoloader.php b/bundled-libs/laminas/laminas-zendframework-bridge/src/Autoloader.php new file mode 100644 index 00000000..6048766a --- /dev/null +++ b/bundled-libs/laminas/laminas-zendframework-bridge/src/Autoloader.php @@ -0,0 +1,172 @@ +loadClass($class)) { + $legacy = $namespaces[$check] + . strtr(substr($class, strlen($check)), [ + 'ApiTools' => 'Apigility', + 'Mezzio' => 'Expressive', + 'Laminas' => 'Zend', + ]); + class_alias($class, $legacy); + } + }; + } + + /** + * @return callable + */ + private static function createAppendAutoloader(array $namespaces, ArrayObject $loaded) + { + /** + * @param string $class Class name to autoload + * @return void + */ + return static function ($class) use ($namespaces, $loaded) { + $segments = explode('\\', $class); + + if ($segments[0] === 'ZendService' && isset($segments[1])) { + $segments[0] .= '\\' . $segments[1]; + unset($segments[1]); + $segments = array_values($segments); + } + + $i = 0; + $check = ''; + + // We are checking segments of the namespace to match quicker + while (isset($segments[$i + 1], $namespaces[$check . $segments[$i] . '\\'])) { + $check .= $segments[$i] . '\\'; + ++$i; + } + + if ($check === '') { + return; + } + + $alias = $namespaces[$check] + . strtr(substr($class, strlen($check)), [ + 'Apigility' => 'ApiTools', + 'Expressive' => 'Mezzio', + 'Zend' => 'Laminas', + 'AbstractZendServer' => 'AbstractZendServer', + 'ZendServerDisk' => 'ZendServerDisk', + 'ZendServerShm' => 'ZendServerShm', + 'ZendMonitor' => 'ZendMonitor', + ]); + + $loaded[$alias] = true; + if (class_exists($alias) || interface_exists($alias) || trait_exists($alias)) { + class_alias($alias, $class); + } + }; + } +} diff --git a/bundled-libs/laminas/laminas-zendframework-bridge/src/ConfigPostProcessor.php b/bundled-libs/laminas/laminas-zendframework-bridge/src/ConfigPostProcessor.php new file mode 100644 index 00000000..bac7b974 --- /dev/null +++ b/bundled-libs/laminas/laminas-zendframework-bridge/src/ConfigPostProcessor.php @@ -0,0 +1,434 @@ + true, + 'factories' => true, + 'invokables' => true, + 'services' => true, + ]; + + /** @var array String keys => string values */ + private $exactReplacements = [ + 'zend-expressive' => 'mezzio', + 'zf-apigility' => 'api-tools', + ]; + + /** @var Replacements */ + private $replacements; + + /** @var callable[] */ + private $rulesets; + + public function __construct() + { + $this->replacements = new Replacements(); + + /* Define the rulesets for replacements. + * + * Each ruleset has the following signature: + * + * @param mixed $value + * @param string[] $keys Full nested key hierarchy leading to the value + * @return null|callable + * + * If no match is made, a null is returned, allowing it to fallback to + * the next ruleset in the list. If a match is made, a callback is returned, + * and that will be used to perform the replacement on the value. + * + * The callback should have the following signature: + * + * @param mixed $value + * @param string[] $keys + * @return mixed The transformed value + */ + $this->rulesets = [ + // Exact values + function ($value) { + return is_string($value) && isset($this->exactReplacements[$value]) + ? [$this, 'replaceExactValue'] + : null; + }, + + // Router (MVC applications) + // We do not want to rewrite these. + function ($value, array $keys) { + $key = array_pop($keys); + // Only worried about a top-level "router" key. + return $key === 'router' && count($keys) === 0 && is_array($value) + ? [$this, 'noopReplacement'] + : null; + }, + + // service- and pluginmanager handling + function ($value) { + return is_array($value) && array_intersect_key(self::SERVICE_MANAGER_KEYS_OF_INTEREST, $value) !== [] + ? [$this, 'replaceDependencyConfiguration'] + : null; + }, + + // Array values + function ($value, array $keys) { + return 0 !== count($keys) && is_array($value) + ? [$this, '__invoke'] + : null; + }, + ]; + } + + /** + * @param string[] $keys Hierarchy of keys, for determining location in + * nested configuration. + * @return array + */ + public function __invoke(array $config, array $keys = []) + { + $rewritten = []; + + foreach ($config as $key => $value) { + // Determine new key from replacements + $newKey = is_string($key) ? $this->replace($key, $keys) : $key; + + // Keep original values with original key, if the key has changed, but only at the top-level. + if (empty($keys) && $newKey !== $key) { + $rewritten[$key] = $value; + } + + // Perform value replacements, if any + $newValue = $this->replace($value, $keys, $newKey); + + // Key does not already exist and/or is not an array value + if (! array_key_exists($newKey, $rewritten) || ! is_array($rewritten[$newKey])) { + // Do not overwrite existing values with null values + $rewritten[$newKey] = array_key_exists($newKey, $rewritten) && null === $newValue + ? $rewritten[$newKey] + : $newValue; + continue; + } + + // New value is null; nothing to do. + if (null === $newValue) { + continue; + } + + // Key already exists as an array value, but $value is not an array + if (! is_array($newValue)) { + $rewritten[$newKey][] = $newValue; + continue; + } + + // Key already exists as an array value, and $value is also an array + $rewritten[$newKey] = static::merge($rewritten[$newKey], $newValue); + } + + return $rewritten; + } + + /** + * Perform substitutions as needed on an individual value. + * + * The $key is provided to allow fine-grained selection of rewrite rules. + * + * @param mixed $value + * @param string[] $keys Key hierarchy + * @param null|int|string $key + * @return mixed + */ + private function replace($value, array $keys, $key = null) + { + // Add new key to the list of keys. + // We do not need to remove it later, as we are working on a copy of the array. + array_push($keys, $key); + + // Identify rewrite strategy and perform replacements + $rewriteRule = $this->replacementRuleMatch($value, $keys); + return $rewriteRule($value, $keys); + } + + /** + * Merge two arrays together. + * + * If an integer key exists in both arrays, the value from the second array + * will be appended to the first array. If both values are arrays, they are + * merged together, else the value of the second array overwrites the one + * of the first array. + * + * Based on zend-stdlib Zend\Stdlib\ArrayUtils::merge + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) + * + * @return array + */ + public static function merge(array $a, array $b) + { + foreach ($b as $key => $value) { + if (! isset($a[$key]) && ! array_key_exists($key, $a)) { + $a[$key] = $value; + continue; + } + + if (null === $value && array_key_exists($key, $a)) { + // Leave as-is if value from $b is null + continue; + } + + if (is_int($key)) { + $a[] = $value; + continue; + } + + if (is_array($value) && is_array($a[$key])) { + $a[$key] = static::merge($a[$key], $value); + continue; + } + + $a[$key] = $value; + } + + return $a; + } + + /** + * @param mixed $value + * @param null|int|string $key + * @return callable Callable to invoke with value + */ + private function replacementRuleMatch($value, $key = null) + { + foreach ($this->rulesets as $ruleset) { + $result = $ruleset($value, $key); + if (is_callable($result)) { + return $result; + } + } + return [$this, 'fallbackReplacement']; + } + + /** + * Replace a value using the translation table, if the value is a string. + * + * @param mixed $value + * @return mixed + */ + private function fallbackReplacement($value) + { + return is_string($value) + ? $this->replacements->replace($value) + : $value; + } + + /** + * Replace a value matched exactly. + * + * @param mixed $value + * @return mixed + */ + private function replaceExactValue($value) + { + return $this->exactReplacements[$value]; + } + + private function replaceDependencyConfiguration(array $config) + { + $aliases = isset($config['aliases']) && is_array($config['aliases']) + ? $this->replaceDependencyAliases($config['aliases']) + : []; + + if ($aliases) { + $config['aliases'] = $aliases; + } + + $config = $this->replaceDependencyInvokables($config); + $config = $this->replaceDependencyFactories($config); + $config = $this->replaceDependencyServices($config); + + $keys = self::SERVICE_MANAGER_KEYS_OF_INTEREST; + foreach ($config as $key => $data) { + if (isset($keys[$key])) { + continue; + } + + $config[$key] = is_array($data) ? $this->__invoke($data, [$key]) : $data; + } + + return $config; + } + + /** + * Rewrite dependency aliases array + * + * In this case, we want to keep the alias as-is, but rewrite the target. + * + * We need also provide an additional alias if the alias key is a legacy class. + * + * @return array + */ + private function replaceDependencyAliases(array $aliases) + { + foreach ($aliases as $alias => $target) { + if (! is_string($alias) || ! is_string($target)) { + continue; + } + + $newTarget = $this->replacements->replace($target); + $newAlias = $this->replacements->replace($alias); + + $notIn = [$newTarget]; + $name = $newTarget; + while (isset($aliases[$name])) { + $notIn[] = $aliases[$name]; + $name = $aliases[$name]; + } + + if ($newAlias === $alias && ! in_array($alias, $notIn, true)) { + $aliases[$alias] = $newTarget; + continue; + } + + if (isset($aliases[$newAlias])) { + continue; + } + + if (! in_array($newAlias, $notIn, true)) { + $aliases[$alias] = $newAlias; + $aliases[$newAlias] = $newTarget; + } + } + + return $aliases; + } + + /** + * Rewrite dependency invokables array + * + * In this case, we want to keep the alias as-is, but rewrite the target. + * + * We need also provide an additional alias if invokable is defined with + * an alias which is a legacy class. + * + * @return array + */ + private function replaceDependencyInvokables(array $config) + { + if (empty($config['invokables']) || ! is_array($config['invokables'])) { + return $config; + } + + foreach ($config['invokables'] as $alias => $target) { + if (! is_string($alias)) { + continue; + } + + $newTarget = $this->replacements->replace($target); + $newAlias = $this->replacements->replace($alias); + + if ($alias === $target || isset($config['aliases'][$newAlias])) { + $config['invokables'][$alias] = $newTarget; + continue; + } + + $config['invokables'][$newAlias] = $newTarget; + + if ($newAlias === $alias) { + continue; + } + + $config['aliases'][$alias] = $newAlias; + + unset($config['invokables'][$alias]); + } + + return $config; + } + + /** + * @param mixed $value + * @return mixed Returns $value verbatim. + */ + private function noopReplacement($value) + { + return $value; + } + + private function replaceDependencyFactories(array $config) + { + if (empty($config['factories']) || ! is_array($config['factories'])) { + return $config; + } + + foreach ($config['factories'] as $service => $factory) { + if (! is_string($service)) { + continue; + } + + $replacedService = $this->replacements->replace($service); + $factory = is_string($factory) ? $this->replacements->replace($factory) : $factory; + $config['factories'][$replacedService] = $factory; + + if ($replacedService === $service) { + continue; + } + + unset($config['factories'][$service]); + if (isset($config['aliases'][$service])) { + continue; + } + + $config['aliases'][$service] = $replacedService; + } + + return $config; + } + + private function replaceDependencyServices(array $config) + { + if (empty($config['services']) || ! is_array($config['services'])) { + return $config; + } + + foreach ($config['services'] as $service => $serviceInstance) { + if (! is_string($service)) { + continue; + } + + $replacedService = $this->replacements->replace($service); + $serviceInstance = is_array($serviceInstance) ? $this->__invoke($serviceInstance) : $serviceInstance; + + $config['services'][$replacedService] = $serviceInstance; + + if ($service === $replacedService) { + continue; + } + + unset($config['services'][$service]); + + if (isset($config['aliases'][$service])) { + continue; + } + + $config['aliases'][$service] = $replacedService; + } + + return $config; + } +} diff --git a/bundled-libs/laminas/laminas-zendframework-bridge/src/Module.php b/bundled-libs/laminas/laminas-zendframework-bridge/src/Module.php new file mode 100644 index 00000000..d10cb43d --- /dev/null +++ b/bundled-libs/laminas/laminas-zendframework-bridge/src/Module.php @@ -0,0 +1,54 @@ +getEventManager() + ->attach('mergeConfig', [$this, 'onMergeConfig']); + } + + /** + * Perform substitutions in the merged configuration. + * + * Rewrites keys and values matching known ZF classes, namespaces, and + * configuration keys to their Laminas equivalents. + * + * Type-hinting deliberately omitted to allow unit testing + * without dependencies on packages that do not exist yet. + * + * @param ModuleEvent $event + */ + public function onMergeConfig($event) + { + /** @var ConfigMergerInterface */ + $configMerger = $event->getConfigListener(); + $processor = new ConfigPostProcessor(); + $configMerger->setMergedConfig( + $processor( + $configMerger->getMergedConfig($returnAsObject = false) + ) + ); + } +} diff --git a/bundled-libs/laminas/laminas-zendframework-bridge/src/Replacements.php b/bundled-libs/laminas/laminas-zendframework-bridge/src/Replacements.php new file mode 100644 index 00000000..ca445c01 --- /dev/null +++ b/bundled-libs/laminas/laminas-zendframework-bridge/src/Replacements.php @@ -0,0 +1,46 @@ +replacements = array_merge( + require __DIR__ . '/../config/replacements.php', + $additionalReplacements + ); + + // Provide multiple variants of strings containing namespace separators + foreach ($this->replacements as $original => $replacement) { + if (false === strpos($original, '\\')) { + continue; + } + $this->replacements[str_replace('\\', '\\\\', $original)] = str_replace('\\', '\\\\', $replacement); + $this->replacements[str_replace('\\', '\\\\\\\\', $original)] = str_replace('\\', '\\\\\\\\', $replacement); + } + } + + /** + * @param string $value + * @return string + */ + public function replace($value) + { + return strtr($value, $this->replacements); + } +} diff --git a/bundled-libs/laminas/laminas-zendframework-bridge/src/RewriteRules.php b/bundled-libs/laminas/laminas-zendframework-bridge/src/RewriteRules.php new file mode 100644 index 00000000..8dc999f4 --- /dev/null +++ b/bundled-libs/laminas/laminas-zendframework-bridge/src/RewriteRules.php @@ -0,0 +1,79 @@ + 'Mezzio\\ProblemDetails\\', + 'Zend\\Expressive\\' => 'Mezzio\\', + + // Laminas + 'Zend\\' => 'Laminas\\', + 'ZF\\ComposerAutoloading\\' => 'Laminas\\ComposerAutoloading\\', + 'ZF\\DevelopmentMode\\' => 'Laminas\\DevelopmentMode\\', + + // Apigility + 'ZF\\Apigility\\' => 'Laminas\\ApiTools\\', + 'ZF\\' => 'Laminas\\ApiTools\\', + + // ZendXml, API wrappers, zend-http OAuth support, zend-diagnostics, ZendDeveloperTools + 'ZendXml\\' => 'Laminas\\Xml\\', + 'ZendOAuth\\' => 'Laminas\\OAuth\\', + 'ZendDiagnostics\\' => 'Laminas\\Diagnostics\\', + 'ZendService\\ReCaptcha\\' => 'Laminas\\ReCaptcha\\', + 'ZendService\\Twitter\\' => 'Laminas\\Twitter\\', + 'ZendDeveloperTools\\' => 'Laminas\\DeveloperTools\\', + ]; + } + + /** + * @return array + */ + public static function namespaceReverse() + { + return [ + // ZendXml, ZendOAuth, ZendDiagnostics, ZendDeveloperTools + 'Laminas\\Xml\\' => 'ZendXml\\', + 'Laminas\\OAuth\\' => 'ZendOAuth\\', + 'Laminas\\Diagnostics\\' => 'ZendDiagnostics\\', + 'Laminas\\DeveloperTools\\' => 'ZendDeveloperTools\\', + + // Zend Service + 'Laminas\\ReCaptcha\\' => 'ZendService\\ReCaptcha\\', + 'Laminas\\Twitter\\' => 'ZendService\\Twitter\\', + + // Zend + 'Laminas\\' => 'Zend\\', + + // Expressive + 'Mezzio\\ProblemDetails\\' => 'Zend\\ProblemDetails\\', + 'Mezzio\\' => 'Zend\\Expressive\\', + + // Laminas to ZfCampus + 'Laminas\\ComposerAutoloading\\' => 'ZF\\ComposerAutoloading\\', + 'Laminas\\DevelopmentMode\\' => 'ZF\\DevelopmentMode\\', + + // Apigility + 'Laminas\\ApiTools\\Admin\\' => 'ZF\\Apigility\\Admin\\', + 'Laminas\\ApiTools\\Doctrine\\' => 'ZF\\Apigility\\Doctrine\\', + 'Laminas\\ApiTools\\Documentation\\' => 'ZF\\Apigility\\Documentation\\', + 'Laminas\\ApiTools\\Example\\' => 'ZF\\Apigility\\Example\\', + 'Laminas\\ApiTools\\Provider\\' => 'ZF\\Apigility\\Provider\\', + 'Laminas\\ApiTools\\Welcome\\' => 'ZF\\Apiglity\\Welcome\\', + 'Laminas\\ApiTools\\' => 'ZF\\', + ]; + } +} diff --git a/bundled-libs/laminas/laminas-zendframework-bridge/src/autoload.php b/bundled-libs/laminas/laminas-zendframework-bridge/src/autoload.php new file mode 100644 index 00000000..9f2f2adf --- /dev/null +++ b/bundled-libs/laminas/laminas-zendframework-bridge/src/autoload.php @@ -0,0 +1,9 @@ + better performance, because we don't need to serialize the data + + -> but it's optional, because it required PHP >= 7.1 + +# Changelog 4.0.3 (2019-11-18) + +- "iSerializer" -> add "getName()" +- fix usage of "file_put_contents" +- fix errors from php 7.4 +- fix return of "CacheChain" (return true, if one cache-instance was successfully) + + +# Changelog 4.0.2 (2019-04-23) + +- fix errors reported by phpstan (level 7) +- fix for APC(u) + CLI usage +- fix & new tests for "CacheChain" -> now accepts Cache objects instead of "iCache" + + # Changelog 4.0.1 (2019-03-03) - hide "warning" about Zend OPcache API is restricted by "restrict_api" diff --git a/bundled-libs/voku/simple-cache/composer.json b/bundled-libs/voku/simple-cache/composer.json index 2a0c2c5f..999bc24b 100644 --- a/bundled-libs/voku/simple-cache/composer.json +++ b/bundled-libs/voku/simple-cache/composer.json @@ -27,6 +27,10 @@ "require-dev": { "phpunit/phpunit": "~6.0 || ~7.0" }, + "suggest": { + "symfony/var-exporter" : "~3.0 || ~4.0 || ~5.0", + "predis/predis": "~1.1" + }, "autoload": { "psr-4": { "voku\\cache\\": "src/voku/cache/" diff --git a/bundled-libs/voku/simple-cache/phpstan.neon b/bundled-libs/voku/simple-cache/phpstan.neon new file mode 100644 index 00000000..cd25a6a2 --- /dev/null +++ b/bundled-libs/voku/simple-cache/phpstan.neon @@ -0,0 +1,21 @@ +parameters: + level: max + paths: + - %currentWorkingDirectory%/src/ + reportUnmatchedIgnoredErrors: false + checkMissingIterableValueType: false + excludes_analyse: + - %currentWorkingDirectory%/vendor/* + - %currentWorkingDirectory%/tests/* + autoload_files: + - %currentWorkingDirectory%/vendor/autoload.php + ignoreErrors: + - '/always false/' + - '/always true/' + - '/Predis\\Client/' + - '/Symfony\\Component\\VarExporter/' + - '/Memcache(d)*/' + - '/MEMCACHE_COMPRESSED/' + - '/Function checkForDev not found\./' + - '/Function msgpack/' + - '/function unserialize expects array/' diff --git a/bundled-libs/voku/simple-cache/src/voku/cache/AdapterApc.php b/bundled-libs/voku/simple-cache/src/voku/cache/AdapterApc.php index 92a10b29..61c46d0e 100644 --- a/bundled-libs/voku/simple-cache/src/voku/cache/AdapterApc.php +++ b/bundled-libs/voku/simple-cache/src/voku/cache/AdapterApc.php @@ -43,6 +43,8 @@ class AdapterApc implements iAdapter && \ini_get('apc.enable_cli') ) { + \ini_set('apc.use_request_time', '0'); + $this->installed = true; } } @@ -85,12 +87,19 @@ class AdapterApc implements iAdapter * @param bool $limited - If $limited is TRUE, the return value will exclude the individual list of cache * entries. This is useful when trying to optimize calls for statistics gathering * - * @return array|false - *

Array of cached data (and meta-data) or FALSE on failure.

+ * @return array + *

Array of cached data (and meta-data) or empty array on failure.

*/ public function cacheInfo(string $type = '', bool $limited = false): array { - return \apc_cache_info($type, $limited); + /** @var array|false $return */ + $return = \apc_cache_info($type, $limited); + + if ($return === false) { + return []; + } + + return $return; } /** diff --git a/bundled-libs/voku/simple-cache/src/voku/cache/AdapterApcu.php b/bundled-libs/voku/simple-cache/src/voku/cache/AdapterApcu.php index 000074f3..ed2c7d1f 100644 --- a/bundled-libs/voku/simple-cache/src/voku/cache/AdapterApcu.php +++ b/bundled-libs/voku/simple-cache/src/voku/cache/AdapterApcu.php @@ -43,6 +43,8 @@ class AdapterApcu implements iAdapter && \ini_get('apc.enable_cli') ) { + \ini_set('apc.use_request_time', '0'); + $this->installed = true; } } @@ -84,12 +86,19 @@ class AdapterApcu implements iAdapter * @param bool $limited - If $limited is TRUE, the return value will exclude the individual list of cache * entries. This is useful when trying to optimize calls for statistics gathering * - * @return array|false - *

Array of cached data (and meta-data) or FALSE on failure.

+ * @return array + *

Array of cached data (and meta-data) or empty array on failure.

*/ public function cacheInfo(bool $limited = false): array { - return \apcu_cache_info($limited); + /** @var array|false $return */ + $return = \apcu_cache_info($limited); + + if ($return === false) { + return []; + } + + return $return; } /** diff --git a/bundled-libs/voku/simple-cache/src/voku/cache/AdapterArray.php b/bundled-libs/voku/simple-cache/src/voku/cache/AdapterArray.php index 50cdd9ba..7e346d94 100644 --- a/bundled-libs/voku/simple-cache/src/voku/cache/AdapterArray.php +++ b/bundled-libs/voku/simple-cache/src/voku/cache/AdapterArray.php @@ -15,7 +15,7 @@ class AdapterArray implements iAdapter private static $values = []; /** - * @var array + * @var array> */ private static $expired = []; @@ -89,7 +89,7 @@ class AdapterArray implements iAdapter { self::$values[$key] = $value; - if ($ttl !== null) { + if ($ttl !== 0) { self::$expired[$key] = [\time(), $ttl]; } @@ -114,6 +114,8 @@ class AdapterArray implements iAdapter } list($time, $ttl) = self::$expired[$key]; + \assert(\is_int($time)); + \assert(\is_int($ttl)); if (\time() > ($time + $ttl)) { unset(self::$values[$key]); diff --git a/bundled-libs/voku/simple-cache/src/voku/cache/AdapterFileAbstract.php b/bundled-libs/voku/simple-cache/src/voku/cache/AdapterFileAbstract.php index 51d4f10f..b19730ba 100644 --- a/bundled-libs/voku/simple-cache/src/voku/cache/AdapterFileAbstract.php +++ b/bundled-libs/voku/simple-cache/src/voku/cache/AdapterFileAbstract.php @@ -34,7 +34,7 @@ abstract class AdapterFileAbstract implements iAdapter protected $fileMode = '0755'; /** - * @param \callable|string|null $cacheDir + * @param callable|string|null $cacheDir */ public function __construct($cacheDir = null) { @@ -204,6 +204,8 @@ abstract class AdapterFileAbstract implements iAdapter * e.g. '0777', or '0755' ... * * @param string $fileMode + * + * @return void */ public function setFileMode($fileMode) { @@ -243,4 +245,56 @@ abstract class AdapterFileAbstract implements iAdapter return true; } + + /** + * copy&past from https://github.com/webimpress/safe-writer (thx @michalbundyra) + * + * @param string $file + * @param string $content + * @param int|null $chmod + * + * @return bool + */ + protected function writeFile($file, $content, $chmod = null): bool + { + if (!$file) { + return false; + } + + if ($chmod === null) { + $chmod = \intval($this->fileMode, 8); + } + + $dir = \dirname($file); + + $tmp = \tempnam($dir, 'wsw'); + if ($tmp === false) { + throw Exception\RuntimeException::unableToCreateTemporaryFile($dir); + } + + if (\file_put_contents($tmp, $content) === false) { + \unlink($tmp); + + throw Exception\WriteContentException::unableToWriteContent($tmp); + } + + if (\chmod($tmp, $chmod & ~\umask()) === false) { + \unlink($tmp); + + throw Exception\ChmodException::unableToChangeChmod($tmp); + } + + // On windows try again if rename was not successful but target file is writable. + /** @noinspection PhpUsageOfSilenceOperatorInspection */ + while (@\rename($tmp, $file) === false) { + if (\is_writable($file) && \stripos(\PHP_OS, 'WIN') === 0) { + continue; + } + \unlink($tmp); + + throw Exception\RenameException::unableToMoveFile($tmp, $file); + } + + return true; + } } diff --git a/bundled-libs/voku/simple-cache/src/voku/cache/AdapterFileSimple.php b/bundled-libs/voku/simple-cache/src/voku/cache/AdapterFileSimple.php index b9d6ddc9..785da7cc 100644 --- a/bundled-libs/voku/simple-cache/src/voku/cache/AdapterFileSimple.php +++ b/bundled-libs/voku/simple-cache/src/voku/cache/AdapterFileSimple.php @@ -11,6 +11,9 @@ class AdapterFileSimple extends AdapterFileAbstract { const CACHE_FILE_PREFIX = '__simple_'; + /** + * @return resource + */ protected function getContext() { static $CONTEXT_CACHE = null; @@ -74,16 +77,14 @@ class AdapterFileSimple extends AdapterFileAbstract */ public function setExpired(string $key, $value, int $ttl = 0): bool { - return (bool) \file_put_contents( + return $this->writeFile( $this->getFileName($key), $this->serializer->serialize( [ 'value' => $value, 'ttl' => $ttl ? $ttl + \time() : 0, ] - ), - 0, - $this->getContext() + ) ); } } diff --git a/bundled-libs/voku/simple-cache/src/voku/cache/AdapterMemcache.php b/bundled-libs/voku/simple-cache/src/voku/cache/AdapterMemcache.php index a789e1b2..29eec0c5 100644 --- a/bundled-libs/voku/simple-cache/src/voku/cache/AdapterMemcache.php +++ b/bundled-libs/voku/simple-cache/src/voku/cache/AdapterMemcache.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace voku\cache; +use Memcache; use voku\cache\Exception\InvalidArgumentException; /** @@ -17,7 +18,7 @@ class AdapterMemcache implements iAdapter public $installed = false; /** - * @var \Memcache + * @var Memcache */ private $memcache; @@ -29,19 +30,19 @@ class AdapterMemcache implements iAdapter /** * __construct * - * @param \Memcache|null $memcache + * @param Memcache|null $memcache */ public function __construct($memcache = null) { - if ($memcache instanceof \Memcache) { + if ($memcache instanceof Memcache) { $this->setMemcache($memcache); } } /** - * @param \Memcache $memcache + * @param Memcache $memcache */ - public function setMemcache(\Memcache $memcache) + public function setMemcache(Memcache $memcache) { $this->memcache = $memcache; $this->installed = true; diff --git a/bundled-libs/voku/simple-cache/src/voku/cache/AdapterMemcached.php b/bundled-libs/voku/simple-cache/src/voku/cache/AdapterMemcached.php index b42c5f11..eb2e2735 100644 --- a/bundled-libs/voku/simple-cache/src/voku/cache/AdapterMemcached.php +++ b/bundled-libs/voku/simple-cache/src/voku/cache/AdapterMemcached.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace voku\cache; +use Memcached; use voku\cache\Exception\InvalidArgumentException; /** @@ -17,26 +18,26 @@ class AdapterMemcached implements iAdapter public $installed = false; /** - * @var \Memcached + * @var Memcached */ private $memcached; /** * __construct * - * @param \Memcached|null $memcached + * @param Memcached|null $memcached */ public function __construct($memcached = null) { - if ($memcached instanceof \Memcached) { + if ($memcached instanceof Memcached) { $this->setMemcached($memcached); } } /** - * @param \Memcached $memcached + * @param Memcached $memcached */ - public function setMemcached(\Memcached $memcached) + public function setMemcached(Memcached $memcached) { $this->memcached = $memcached; $this->installed = true; @@ -90,7 +91,7 @@ class AdapterMemcached implements iAdapter public function set(string $key, $value): bool { // Make sure we are under the proper limit - if (\strlen($this->memcached->getOption(\Memcached::OPT_PREFIX_KEY) . $key) > 250) { + if (\strlen($this->memcached->getOption(Memcached::OPT_PREFIX_KEY) . $key) > 250) { throw new InvalidArgumentException('The passed cache key is over 250 bytes:' . \print_r($key, true)); } @@ -111,18 +112,22 @@ class AdapterMemcached implements iAdapter /** * Set the MemCached settings. + * + * @noinspection PhpUndefinedClassConstantInspection -> MSGPACK is not added into phpstorm stubs */ private function setSettings() { // Use faster compression if available - if (\Memcached::HAVE_IGBINARY) { - $this->memcached->setOption(\Memcached::OPT_SERIALIZER, \Memcached::SERIALIZER_IGBINARY); + if (Memcached::HAVE_IGBINARY) { + $this->memcached->setOption(Memcached::OPT_SERIALIZER, Memcached::SERIALIZER_IGBINARY); + } elseif (\defined('Memcached::HAVE_MSGPACK') && Memcached::HAVE_MSGPACK) { + $this->memcached->setOption(Memcached::OPT_SERIALIZER, Memcached::SERIALIZER_MSGPACK); } - $this->memcached->setOption(\Memcached::OPT_DISTRIBUTION, \Memcached::DISTRIBUTION_CONSISTENT); - $this->memcached->setOption(\Memcached::OPT_LIBKETAMA_COMPATIBLE, true); - $this->memcached->setOption(\Memcached::OPT_NO_BLOCK, true); - $this->memcached->setOption(\Memcached::OPT_TCP_NODELAY, true); - $this->memcached->setOption(\Memcached::OPT_COMPRESSION, false); - $this->memcached->setOption(\Memcached::OPT_CONNECT_TIMEOUT, 2); + $this->memcached->setOption(Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT); + $this->memcached->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true); + $this->memcached->setOption(Memcached::OPT_NO_BLOCK, true); + $this->memcached->setOption(Memcached::OPT_TCP_NODELAY, true); + $this->memcached->setOption(Memcached::OPT_COMPRESSION, false); + $this->memcached->setOption(Memcached::OPT_CONNECT_TIMEOUT, 2); } } diff --git a/bundled-libs/voku/simple-cache/src/voku/cache/AdapterOpCache.php b/bundled-libs/voku/simple-cache/src/voku/cache/AdapterOpCache.php index 9996b31e..16855874 100644 --- a/bundled-libs/voku/simple-cache/src/voku/cache/AdapterOpCache.php +++ b/bundled-libs/voku/simple-cache/src/voku/cache/AdapterOpCache.php @@ -79,6 +79,10 @@ class AdapterOpCache extends AdapterFileSimple /** * {@inheritdoc} + * + * @noinspection PhpUndefinedClassInspection + * @noinspection PhpUndefinedNamespaceInspection + * @noinspection BadExceptionsProcessingInspection */ public function setExpired(string $key, $value, int $ttl = 0): bool { @@ -86,17 +90,23 @@ class AdapterOpCache extends AdapterFileSimple 'value' => $value, 'ttl' => $ttl ? $ttl + \time() : 0, ]; - $content = \var_export($item, true); + if (\class_exists('\Symfony\Component\VarExporter\VarExporter')) { + try { + $content = \Symfony\Component\VarExporter\VarExporter::export($item); + } catch (\Symfony\Component\VarExporter\Exception\ExceptionInterface $e) { + $content = \var_export($item, true); + } + } else { + $content = \var_export($item, true); + } $content = 'getFileName($key); - $result = (bool) \file_put_contents( + $result = $this->writeFile( $cacheFile, - $content, - 0, - $this->getContext() + $content ); if ( diff --git a/bundled-libs/voku/simple-cache/src/voku/cache/AdapterPredis.php b/bundled-libs/voku/simple-cache/src/voku/cache/AdapterPredis.php index 03e50877..2cdcb757 100644 --- a/bundled-libs/voku/simple-cache/src/voku/cache/AdapterPredis.php +++ b/bundled-libs/voku/simple-cache/src/voku/cache/AdapterPredis.php @@ -33,6 +33,8 @@ class AdapterPredis implements iAdapter /** * @param Client $client + * + * @return void */ public function setPredisClient(Client $client) { @@ -45,7 +47,7 @@ class AdapterPredis implements iAdapter */ public function exists(string $key): bool { - return $this->client->exists($key); + return (bool) $this->client->exists($key); } /** @@ -69,7 +71,7 @@ class AdapterPredis implements iAdapter */ public function remove(string $key): bool { - return $this->client->del($key); + return (bool) $this->client->del($key); } /** @@ -93,6 +95,6 @@ class AdapterPredis implements iAdapter */ public function setExpired(string $key, $value, int $ttl = 0): bool { - return $this->client->setex($key, $ttl, $value); + return (bool) $this->client->setex($key, $ttl, $value); } } diff --git a/bundled-libs/voku/simple-cache/src/voku/cache/AdapterXcache.php b/bundled-libs/voku/simple-cache/src/voku/cache/AdapterXcache.php index 4513bb12..4ea1e830 100644 --- a/bundled-libs/voku/simple-cache/src/voku/cache/AdapterXcache.php +++ b/bundled-libs/voku/simple-cache/src/voku/cache/AdapterXcache.php @@ -9,6 +9,9 @@ namespace voku\cache; */ class AdapterXcache implements iAdapter { + /** + * @var bool + */ public $installed = false; /** diff --git a/bundled-libs/voku/simple-cache/src/voku/cache/Cache.php b/bundled-libs/voku/simple-cache/src/voku/cache/Cache.php index 3919d912..888aa56b 100644 --- a/bundled-libs/voku/simple-cache/src/voku/cache/Cache.php +++ b/bundled-libs/voku/simple-cache/src/voku/cache/Cache.php @@ -44,6 +44,11 @@ class Cache implements iCache */ protected $serializer; + /** + * @var array + */ + protected $unserialize_options = ['allowed_classes' => true]; + /** * @var string */ @@ -92,27 +97,30 @@ class Cache implements iCache /** * __construct * - * @param iAdapter|null $adapter - * @param iSerializer|null $serializer - * @param bool $checkForUsage

check for admin-session && check for - * server-ip == client-ip - * && check for dev

- * @param bool $cacheEnabled

false === disable the cache (use it - * e.g. for global settings)

- * @param bool $isAdminSession

true === disable cache for this user - * (use it e.g. for admin user settings) - * @param bool $useCheckForAdminSession

use $isAdminSession flag or not

- * @param bool $useCheckForDev

use checkForDev() or not

- * @param bool $useCheckForServerIpIsClientIp

use check for server-ip == client-ip - * or - * not

- * @param string $disableCacheGetParameter

set the _GET parameter for disabling - * the cache, disable this check via empty - * string

- * @param CacheAdapterAutoManager $cacheAdapterManagerForAutoConnect

Overwrite some Adapters for the - * auto-connect-function.

- * @param bool $cacheAdapterManagerForAutoConnectOverwrite

true === Use only Adapters from your - * "CacheAdapterManager".

+ * @param iAdapter|null $adapter + * @param iSerializer|null $serializer + * @param bool $checkForUsage

check for admin-session && check + * for server-ip == client-ip + * && check for dev

+ * @param bool $cacheEnabled

false === disable the cache (use + * it + * e.g. for global settings)

+ * @param bool $isAdminSession

true === disable cache for this + * user + * (use it e.g. for admin user settings) + * @param bool $useCheckForAdminSession

use $isAdminSession flag or + * not

+ * @param bool $useCheckForDev

use checkForDev() or not

+ * @param bool $useCheckForServerIpIsClientIp

use check for server-ip == + * client-ip or not

+ * @param string $disableCacheGetParameter

set the _GET parameter for + * disabling the cache, disable this + * check via empty string

+ * @param CacheAdapterAutoManager $cacheAdapterManagerForAutoConnect

Overwrite some Adapters for the + * auto-connect-function.

+ * @param bool $cacheAdapterManagerForAutoConnectOverwrite

true === Use only Adapters from + * your + * "CacheAdapterManager".

*/ public function __construct( iAdapter $adapter = null, @@ -153,13 +161,20 @@ class Cache implements iCache $adapter = $this->autoConnectToAvailableCacheSystem($cacheAdapterManagerForAutoConnect, $cacheAdapterManagerForAutoConnectOverwrite); } - // INFO: Memcache(d) has his own "serializer", so don't use it twice if (!\is_object($serializer) && $serializer === null) { if ( $adapter instanceof AdapterMemcached || $adapter instanceof AdapterMemcache ) { + // INFO: Memcache(d) has his own "serializer", so don't use it twice + $serializer = new SerializerNo(); + } elseif ( + $adapter instanceof AdapterOpCache + && + \class_exists('\Symfony\Component\VarExporter\VarExporter') + ) { + // INFO: opcache + Symfony-VarExporter don't need any "serializer" $serializer = new SerializerNo(); } else { // set default serializer @@ -177,17 +192,31 @@ class Cache implements iCache $this->setCacheIsReady(true); $this->adapter = $adapter; + $this->serializer = $serializer; + + $this->serializer->setUnserializeOptions($this->unserialize_options); } } + /** + * @param array $array + * + * @return void + */ + public function setUnserializeOptions(array $array = []) + { + $this->unserialize_options = $array; + } + /** * Auto-connect to the available cache-system on the server. * * @param CacheAdapterAutoManager $cacheAdapterManagerForAutoConnect

Overwrite some Adapters for the - * auto-connect-function.

- * @param bool $cacheAdapterManagerForAutoConnectOverwrite

true === Use only Adapters from your - * "CacheAdapterManager".

+ * auto-connect-function.

+ * @param bool $cacheAdapterManagerForAutoConnectOverwrite

true === Use only Adapters from + * your + * "CacheAdapterManager".

* * @return iAdapter */ @@ -381,7 +410,11 @@ class Cache implements iCache } $serialized = $this->adapter->get($storeKey); - $value = $serialized && $this->serializer ? $this->serializer->unserialize($serialized) : null; + if ($this->serializer && $this->serializer instanceof SerializerNo) { + $value = $serialized; + } else { + $value = $serialized && $this->serializer ? $this->serializer->unserialize($serialized) : null; + } self::$STATIC_CACHE_COUNTER[$storeKey]++; @@ -468,7 +501,7 @@ class Cache implements iCache * @param mixed $value * @param \DateInterval|int|null $ttl * - * @throws InvalidArgumentException + * @throws \InvalidArgumentException * * @return bool */ @@ -493,7 +526,6 @@ class Cache implements iCache if ($ttl) { if ($ttl instanceof \DateInterval) { // Converting to a TTL in seconds - /** @noinspection PhpUnhandledExceptionInspection */ $ttl = (new \DateTimeImmutable('now'))->add($ttl)->getTimestamp() - \time(); } @@ -593,6 +625,8 @@ class Cache implements iCache /** * Set the default-prefix via "SERVER"-var + "SESSION"-language. + * + * @return string */ protected function getTheDefaultPrefix(): string { @@ -600,18 +634,21 @@ class Cache implements iCache ($_SERVER['THEME'] ?? '') . '_' . ($_SERVER['STAGE'] ?? '') . '_' . ($_SESSION['language'] ?? '') . '_' . - ($_SESSION['language_extra'] ?? ''); + ($_SESSION['language_extra'] ?? '') . '_' . + \PHP_VERSION_ID . '_' . + ($this->serializer ? $this->serializer->getName() : ''); } /** * Get the current adapter class-name. * * @return string + * + * @psalm-return class-string|string */ public function getUsedAdapterClassName(): string { if ($this->adapter) { - /** @noinspection GetClassUsageInspection */ return \get_class($this->adapter); } @@ -622,11 +659,12 @@ class Cache implements iCache * Get the current serializer class-name. * * @return string + * + * @psalm-return class-string|string */ public function getUsedSerializerClassName(): string { if ($this->serializer) { - /** @noinspection GetClassUsageInspection */ return \get_class($this->serializer); } @@ -640,6 +678,7 @@ class Cache implements iCache */ public function isCacheActiveForTheCurrentUser(): bool { + // init $active = true; // test the cache, with this GET-parameter @@ -685,6 +724,8 @@ class Cache implements iCache * enable / disable the cache * * @param bool $isActive + * + * @return void */ public function setActive(bool $isActive) { @@ -695,6 +736,8 @@ class Cache implements iCache * Set "isReady" state. * * @param bool $isReady + * + * @return void */ protected function setCacheIsReady(bool $isReady) { @@ -707,6 +750,8 @@ class Cache implements iCache * WARNING: Do not use if you don't know what you do. Because this will overwrite the default prefix. * * @param string $prefix + * + * @return void */ public function setPrefix(string $prefix) { @@ -717,6 +762,8 @@ class Cache implements iCache * Set the static-hit-counter: Who often do we hit the cache, before we use static cache? * * @param int $staticCacheHitCounter + * + * @return void */ public function setStaticCacheHitCounter(int $staticCacheHitCounter) { diff --git a/bundled-libs/voku/simple-cache/src/voku/cache/CacheAdapterAutoManager.php b/bundled-libs/voku/simple-cache/src/voku/cache/CacheAdapterAutoManager.php index 42b0847f..cf078811 100644 --- a/bundled-libs/voku/simple-cache/src/voku/cache/CacheAdapterAutoManager.php +++ b/bundled-libs/voku/simple-cache/src/voku/cache/CacheAdapterAutoManager.php @@ -22,6 +22,8 @@ class CacheAdapterAutoManager * @param string $adapter * @param callable|null $callableFunction * + * @psalm-param class-string $adapter + * * @throws InvalidArgumentException * * @return $this @@ -29,8 +31,7 @@ class CacheAdapterAutoManager public function addAdapter( string $adapter, callable $callableFunction = null - ): self - { + ): self { $this->validateAdapter($adapter); $this->validateCallable($callableFunction); @@ -55,7 +56,7 @@ class CacheAdapterAutoManager * * @throws InvalidArgumentException * - * @return CacheAdapterAutoManager + * @return self */ public function merge(self $adapterManager): self { @@ -80,7 +81,11 @@ class CacheAdapterAutoManager /** * @param string $replaceAdapter * + * @psalm-param class-string $replaceAdapter + * * @throws InvalidArgumentException + * + * @return void */ private function validateAdapter(string $replaceAdapter) { @@ -95,6 +100,8 @@ class CacheAdapterAutoManager * @param callable $callableFunction * * @throws InvalidArgumentException + * + * @return void */ private function validateCallable(callable $callableFunction = null) { @@ -170,6 +177,7 @@ class CacheAdapterAutoManager ) { /** @noinspection PhpUndefinedNamespaceInspection */ /** @noinspection PhpUndefinedClassInspection */ + /** @noinspection PhpFullyQualifiedNameUsageInspection */ $redis = new \Predis\Client( [ 'scheme' => 'tcp', diff --git a/bundled-libs/voku/simple-cache/src/voku/cache/CacheChain.php b/bundled-libs/voku/simple-cache/src/voku/cache/CacheChain.php index ff1d883f..a084d362 100644 --- a/bundled-libs/voku/simple-cache/src/voku/cache/CacheChain.php +++ b/bundled-libs/voku/simple-cache/src/voku/cache/CacheChain.php @@ -7,7 +7,7 @@ namespace voku\cache; class CacheChain implements iCache { /** - * @var array|iCache[] + * @var Cache[] */ private $caches = []; @@ -40,17 +40,13 @@ class CacheChain implements iCache /** * add cache * - * @param iCache $cache - * @param bool $prepend + * @param Cache $cache + * @param bool $prepend * - * @throws \InvalidArgumentException + * @return void */ - public function addCache(iCache $cache, $prepend = true) + public function addCache(Cache $cache, $prepend = true) { - if ($this === $cache) { - throw new \InvalidArgumentException('loop-error, put into other cache'); - } - if ($prepend) { \array_unshift($this->caches, $cache); } else { @@ -72,6 +68,22 @@ class CacheChain implements iCache return null; } + /** + * Get the "isReady" state. + * + * @return bool + */ + public function getCacheIsReady(): bool + { + foreach ($this->caches as $cache) { + if (!$cache->getCacheIsReady()) { + return false; + } + } + + return true; + } + /** * {@inheritdoc} */ @@ -84,7 +96,7 @@ class CacheChain implements iCache $results[] = $cache->setItem($key, $value, $ttl); } - return !\in_array(false, $results, true); + return \in_array(true, $results, true); } /** @@ -95,12 +107,27 @@ class CacheChain implements iCache // init $results = []; - /* @var $cache iCache */ foreach ($this->caches as $cache) { $results[] = $cache->setItemToDate($key, $value, $date); } - return !\in_array(false, $results, true); + return \in_array(true, $results, true); + } + + /** + * !!! Set the prefix. !!! + * + * WARNING: Do not use if you don't know what you do. Because this will overwrite the default prefix. + * + * @param string $prefix + * + * @return void + */ + public function setPrefix(string $prefix) + { + foreach ($this->caches as $cache) { + $cache->setPrefix($prefix); + } } /** @@ -115,7 +142,7 @@ class CacheChain implements iCache $results[] = $cache->removeItem($key); } - return !\in_array(false, $results, true); + return \in_array(true, $results, true); } /** @@ -144,6 +171,6 @@ class CacheChain implements iCache $results[] = $cache->removeAll(); } - return !\in_array(false, $results, true); + return \in_array(true, $results, true); } } diff --git a/bundled-libs/voku/simple-cache/src/voku/cache/Exception/ChmodException.php b/bundled-libs/voku/simple-cache/src/voku/cache/Exception/ChmodException.php new file mode 100644 index 00000000..82b8809a --- /dev/null +++ b/bundled-libs/voku/simple-cache/src/voku/cache/Exception/ChmodException.php @@ -0,0 +1,18 @@ +unserialize_options !== null) { + return \unserialize($value, $this->unserialize_options); + } + + /** @noinspection UnserializeExploitsInspection */ return \unserialize($value); } + + /** + * @param array $options + * + * @return void + */ + public function setUnserializeOptions(array $options) + { + $this->unserialize_options = $options; + } } diff --git a/bundled-libs/voku/simple-cache/src/voku/cache/SerializerIgbinary.php b/bundled-libs/voku/simple-cache/src/voku/cache/SerializerIgbinary.php index 7cab22d7..c0c6dead 100644 --- a/bundled-libs/voku/simple-cache/src/voku/cache/SerializerIgbinary.php +++ b/bundled-libs/voku/simple-cache/src/voku/cache/SerializerIgbinary.php @@ -14,16 +14,42 @@ class SerializerIgbinary implements iSerializer */ public static $_exists_igbinary; + /** + * @var array|null + */ + private $unserialize_options; + + /** + * @var string + */ + private $name = ''; + /** * SerializerIgbinary constructor. */ public function __construct() { - self::$_exists_igbinary = ( - \function_exists('igbinary_serialize') - && - \function_exists('igbinary_unserialize') - ); + if (self::$_exists_igbinary === null) { + self::$_exists_igbinary = ( + \function_exists('igbinary_serialize') + && + \function_exists('igbinary_unserialize') + ); + } + + if (self::$_exists_igbinary) { + $this->name = 'igbinary'; + } else { + $this->name = 'default'; + } + } + + /** + * @return string + */ + public function getName(): string + { + return $this->name; } /** @@ -33,6 +59,7 @@ class SerializerIgbinary implements iSerializer { if (self::$_exists_igbinary === true) { /** @noinspection PhpUndefinedFunctionInspection */ + /** @noinspection PhpComposerExtensionStubsInspection */ return \igbinary_serialize($value); } @@ -47,10 +74,26 @@ class SerializerIgbinary implements iSerializer { if (self::$_exists_igbinary === true) { /** @noinspection PhpUndefinedFunctionInspection */ + /** @noinspection PhpComposerExtensionStubsInspection */ return \igbinary_unserialize($value); } // fallback + if ($this->unserialize_options !== null) { + return \unserialize($value, $this->unserialize_options); + } + + /** @noinspection UnserializeExploitsInspection */ return \unserialize($value); } + + /** + * @param array $options + * + * @return void + */ + public function setUnserializeOptions(array $options) + { + $this->unserialize_options = $options; + } } diff --git a/bundled-libs/voku/simple-cache/src/voku/cache/SerializerMsgpack.php b/bundled-libs/voku/simple-cache/src/voku/cache/SerializerMsgpack.php new file mode 100644 index 00000000..3c9a48da --- /dev/null +++ b/bundled-libs/voku/simple-cache/src/voku/cache/SerializerMsgpack.php @@ -0,0 +1,97 @@ +name = 'msgpack'; + } else { + $this->name = 'default'; + } + } + + /** + * @return string + */ + public function getName(): string + { + return $this->name; + } + + /** + * {@inheritdoc} + */ + public function serialize($value) + { + if (self::$_exists_msgpack === true) { + /** @noinspection PhpUndefinedFunctionInspection */ + return \msgpack_pack($value); + } + + // fallback + return \serialize($value); + } + + /** + * {@inheritdoc} + */ + public function unserialize($value) + { + if (self::$_exists_msgpack === true) { + /** @noinspection PhpUndefinedFunctionInspection */ + return \msgpack_unpack($value); + } + + // fallback + if ($this->unserialize_options !== null) { + return \unserialize($value, $this->unserialize_options); + } + + /** @noinspection UnserializeExploitsInspection */ + return \unserialize($value); + } + + /** + * @param array $options + * + * @return void + */ + public function setUnserializeOptions(array $options) + { + $this->unserialize_options = $options; + } +} diff --git a/bundled-libs/voku/simple-cache/src/voku/cache/SerializerNo.php b/bundled-libs/voku/simple-cache/src/voku/cache/SerializerNo.php index 1e9e17b5..54e9f8a8 100644 --- a/bundled-libs/voku/simple-cache/src/voku/cache/SerializerNo.php +++ b/bundled-libs/voku/simple-cache/src/voku/cache/SerializerNo.php @@ -24,4 +24,22 @@ class SerializerNo implements iSerializer { return $value; } + + /** + * @return string + */ + public function getName(): string + { + return 'no'; + } + + /** + * @param array $options + * + * @return void + */ + public function setUnserializeOptions(array $options) + { + // nothing to do here + } } diff --git a/bundled-libs/voku/simple-cache/src/voku/cache/iAdapter.php b/bundled-libs/voku/simple-cache/src/voku/cache/iAdapter.php index 20a0a8b0..7d6f7982 100644 --- a/bundled-libs/voku/simple-cache/src/voku/cache/iAdapter.php +++ b/bundled-libs/voku/simple-cache/src/voku/cache/iAdapter.php @@ -14,7 +14,8 @@ interface iAdapter * * @param string $key * - * @return mixed|null

will return NULL if the key not exists

+ * @return mixed|null + *

will return NULL if the key not exists

*/ public function get(string $key); diff --git a/bundled-libs/voku/simple-cache/src/voku/cache/iCache.php b/bundled-libs/voku/simple-cache/src/voku/cache/iCache.php index 5b01746f..6ae918e6 100644 --- a/bundled-libs/voku/simple-cache/src/voku/cache/iCache.php +++ b/bundled-libs/voku/simple-cache/src/voku/cache/iCache.php @@ -4,6 +4,8 @@ declare(strict_types=1); namespace voku\cache; +use DateTimeInterface; + /** * iCache: cache-global interface */ @@ -34,11 +36,11 @@ interface iCache * * @param string $key * @param mixed $value - * @param \DateTimeInterface $date + * @param DateTimeInterface $date * * @return bool */ - public function setItemToDate(string $key, $value, \DateTimeInterface $date): bool; + public function setItemToDate(string $key, $value, DateTimeInterface $date): bool; /** * remove item diff --git a/bundled-libs/voku/simple-cache/src/voku/cache/iSerializer.php b/bundled-libs/voku/simple-cache/src/voku/cache/iSerializer.php index 8dfd8337..78f5e5a9 100644 --- a/bundled-libs/voku/simple-cache/src/voku/cache/iSerializer.php +++ b/bundled-libs/voku/simple-cache/src/voku/cache/iSerializer.php @@ -10,16 +10,28 @@ namespace voku\cache; interface iSerializer { /** - * serialize - * * @param mixed $value + * + * @return string */ public function serialize($value); /** - * unserialize - * * @param string $value + * + * @return mixed */ public function unserialize($value); + + /** + * @param array $options + * + * @return void + */ + public function setUnserializeOptions(array $options); + + /** + * @return string + */ + public function getName(): string; }