Compare commits
4 commits
c43c6eb334
...
b4ff61ad96
Author | SHA1 | Date | |
---|---|---|---|
b4ff61ad96 | |||
bc407f4a8a | |||
c43b3b56b0 | |||
23ba13138e |
6 changed files with 53 additions and 79 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
0.2410.51409
|
||||
0.2410.160124
|
||||
|
|
68
composer.lock
generated
68
composer.lock
generated
|
@ -767,16 +767,16 @@
|
|||
},
|
||||
{
|
||||
"name": "nikic/php-parser",
|
||||
"version": "v5.3.0",
|
||||
"version": "v5.3.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nikic/PHP-Parser.git",
|
||||
"reference": "3abf7425cd284141dc5d8d14a9ee444de3345d1a"
|
||||
"reference": "8eea230464783aa9671db8eea6f8c6ac5285794b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/3abf7425cd284141dc5d8d14a9ee444de3345d1a",
|
||||
"reference": "3abf7425cd284141dc5d8d14a9ee444de3345d1a",
|
||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b",
|
||||
"reference": "8eea230464783aa9671db8eea6f8c6ac5285794b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -819,9 +819,9 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/nikic/PHP-Parser/issues",
|
||||
"source": "https://github.com/nikic/PHP-Parser/tree/v5.3.0"
|
||||
"source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1"
|
||||
},
|
||||
"time": "2024-09-29T13:56:26+00:00"
|
||||
"time": "2024-10-08T18:51:32+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phar-io/manifest",
|
||||
|
@ -943,16 +943,16 @@
|
|||
},
|
||||
{
|
||||
"name": "phpstan/phpstan",
|
||||
"version": "1.12.5",
|
||||
"version": "1.12.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan.git",
|
||||
"reference": "7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17"
|
||||
"reference": "dc4d2f145a88ea7141ae698effd64d9df46527ae"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17",
|
||||
"reference": "7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/dc4d2f145a88ea7141ae698effd64d9df46527ae",
|
||||
"reference": "dc4d2f145a88ea7141ae698effd64d9df46527ae",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -997,39 +997,39 @@
|
|||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2024-09-26T12:45:22+00:00"
|
||||
"time": "2024-10-06T15:03:59+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
"version": "11.0.6",
|
||||
"version": "11.0.7",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
|
||||
"reference": "ebdffc9e09585dafa71b9bffcdb0a229d4704c45"
|
||||
"reference": "f7f08030e8811582cc459871d28d6f5a1a4d35ca"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ebdffc9e09585dafa71b9bffcdb0a229d4704c45",
|
||||
"reference": "ebdffc9e09585dafa71b9bffcdb0a229d4704c45",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f7f08030e8811582cc459871d28d6f5a1a4d35ca",
|
||||
"reference": "f7f08030e8811582cc459871d28d6f5a1a4d35ca",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-dom": "*",
|
||||
"ext-libxml": "*",
|
||||
"ext-xmlwriter": "*",
|
||||
"nikic/php-parser": "^5.1.0",
|
||||
"nikic/php-parser": "^5.3.1",
|
||||
"php": ">=8.2",
|
||||
"phpunit/php-file-iterator": "^5.0.1",
|
||||
"phpunit/php-file-iterator": "^5.1.0",
|
||||
"phpunit/php-text-template": "^4.0.1",
|
||||
"sebastian/code-unit-reverse-lookup": "^4.0.1",
|
||||
"sebastian/complexity": "^4.0.1",
|
||||
"sebastian/environment": "^7.2.0",
|
||||
"sebastian/lines-of-code": "^3.0.1",
|
||||
"sebastian/version": "^5.0.1",
|
||||
"sebastian/version": "^5.0.2",
|
||||
"theseer/tokenizer": "^1.2.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^11.0"
|
||||
"phpunit/phpunit": "^11.4.1"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-pcov": "PHP extension that provides line coverage",
|
||||
|
@ -1067,7 +1067,7 @@
|
|||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
|
||||
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
|
||||
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.6"
|
||||
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.7"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -1075,7 +1075,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2024-08-22T04:37:56+00:00"
|
||||
"time": "2024-10-09T06:21:38+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-file-iterator",
|
||||
|
@ -1324,16 +1324,16 @@
|
|||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "11.3.6",
|
||||
"version": "11.4.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "d62c45a19c665bb872c2a47023a0baf41a98bb2b"
|
||||
"reference": "7875627f15f4da7e7f0823d1f323f7295a77334e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d62c45a19c665bb872c2a47023a0baf41a98bb2b",
|
||||
"reference": "d62c45a19c665bb872c2a47023a0baf41a98bb2b",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7875627f15f4da7e7f0823d1f323f7295a77334e",
|
||||
"reference": "7875627f15f4da7e7f0823d1f323f7295a77334e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1372,7 +1372,7 @@
|
|||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "11.3-dev"
|
||||
"dev-main": "11.4-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
|
@ -1404,7 +1404,7 @@
|
|||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/11.3.6"
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/11.4.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -1420,7 +1420,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-09-19T10:54:28+00:00"
|
||||
"time": "2024-10-08T15:38:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/cli-parser",
|
||||
|
@ -2293,16 +2293,16 @@
|
|||
},
|
||||
{
|
||||
"name": "sebastian/version",
|
||||
"version": "5.0.1",
|
||||
"version": "5.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/version.git",
|
||||
"reference": "45c9debb7d039ce9b97de2f749c2cf5832a06ac4"
|
||||
"reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/45c9debb7d039ce9b97de2f749c2cf5832a06ac4",
|
||||
"reference": "45c9debb7d039ce9b97de2f749c2cf5832a06ac4",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c687e3387b99f5b03b6caa64c74b63e2936ff874",
|
||||
"reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2335,7 +2335,7 @@
|
|||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/version/issues",
|
||||
"security": "https://github.com/sebastianbergmann/version/security/policy",
|
||||
"source": "https://github.com/sebastianbergmann/version/tree/5.0.1"
|
||||
"source": "https://github.com/sebastianbergmann/version/tree/5.0.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -2343,7 +2343,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2024-07-03T05:13:08+00:00"
|
||||
"time": "2024-10-09T05:16:32+00:00"
|
||||
},
|
||||
{
|
||||
"name": "theseer/tokenizer",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
// CacheTools.php
|
||||
// Created: 2024-04-10
|
||||
// Updated: 2024-10-02
|
||||
// Updated: 2024-10-16
|
||||
|
||||
namespace Index\Cache;
|
||||
|
||||
|
@ -17,9 +17,9 @@ use RuntimeException;
|
|||
* the rest of the URL is described in the documentation of the parseDsn implementation of the respective backend.
|
||||
*
|
||||
* The scheme can be a PHP classpath to an implementation of CacheBackend, or any of these aliases:
|
||||
* - `array`, `null`: maps to `ArrayCache\ArrayCacheBackend` or `Index-Cache-ArrayCache-ArrayCacheBackend`, uses a simple array backed cache that doesn't get saved.
|
||||
* - `memcached`, `memcache`: maps to `Memcached\MemcachedBackend` or `Index-Cache-Memcached-MemcachedBackend`, provides a backend based on the memcached or memcache extension.
|
||||
* - `valkey`, `keydb`, `redis`: maps to `Valkey\ValkeyBackend` or `Index-Cache-Valkey-ValkeyBackend`, provides a backend based on the phpredis extension.
|
||||
* - `array`, `null`: maps to `ArrayCache\ArrayCacheBackend`, uses a simple array backed cache that doesn't get saved.
|
||||
* - `memcached`, `memcache`: maps to `Memcached\MemcachedBackend`, provides a backend based on the memcached or memcache extension.
|
||||
* - `valkey`, `keydb`, `redis`: maps to `Valkey\ValkeyBackend`, provides a backend based on the phpredis extension.
|
||||
*
|
||||
* Short names are currently hardcoded and cannot be expanded.
|
||||
*/
|
||||
|
@ -52,24 +52,14 @@ final class CacheTools {
|
|||
$backend = $backends[$scheme] ?? null;
|
||||
|
||||
if(!($backend instanceof CacheBackend)) {
|
||||
$backend = null;
|
||||
|
||||
if(array_key_exists($scheme, self::CACHE_PROTOS))
|
||||
$name = self::CACHE_PROTOS[$scheme];
|
||||
else
|
||||
$name = str_replace('-', '\\', (string)$scheme);
|
||||
|
||||
if(class_exists($name) && is_subclass_of($name, CacheBackend::class)) {
|
||||
$backend = new $name;
|
||||
$name = get_class($backend);
|
||||
}
|
||||
|
||||
if($backend === null)
|
||||
if(!array_key_exists($scheme, self::CACHE_PROTOS))
|
||||
throw new RuntimeException('No implementation is available for the specified scheme.');
|
||||
|
||||
$backend = new (self::CACHE_PROTOS[$scheme]);
|
||||
if(!$backend->isAvailable())
|
||||
throw new RuntimeException('Requested cache backend is not available, likely due to missing dependencies.');
|
||||
|
||||
$backends[$name] = $backend;
|
||||
$backends[$scheme] = $backend;
|
||||
}
|
||||
|
||||
return $backend;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
// DbTools.php
|
||||
// Created: 2021-05-02
|
||||
// Updated: 2024-10-04
|
||||
// Updated: 2024-10-16
|
||||
|
||||
namespace Index\Db;
|
||||
|
||||
|
@ -18,9 +18,9 @@ use RuntimeException;
|
|||
* the rest of the URL is described in the documentation of the parseDsn implementation of the respective backend.
|
||||
*
|
||||
* The scheme can be a PHP classpath to an implementation of DbBackend, or any of these aliases:
|
||||
* - `null`: maps to `NullDb\NullDbBackend` or `Index-Db-NullDb-NullDbBackend`, provides a fallback blackhole database backend.
|
||||
* - `mariadb`, `mysql`: maps to `MariaDb\MariaDbBackend` or `Index-Db-MariaDb-MariaDbBackend`, provides a backend based on the mysqli extension.
|
||||
* - `sqlite`, `sqlite3`: maps to `Sqlite\SqliteBackend` or `Index-Db-Sqlite-SqliteBackend`, provides a backend based on the sqlite3 extension.
|
||||
* - `null`: maps to `NullDb\NullDbBackend`, provides a fallback blackhole database backend.
|
||||
* - `mariadb`, `mysql`: maps to `MariaDb\MariaDbBackend`, provides a backend based on the mysqli extension.
|
||||
* - `sqlite`, `sqlite3`: maps to `Sqlite\SqliteBackend`, provides a backend based on the sqlite3 extension.
|
||||
*
|
||||
* Short names are currently hardcoded and cannot be expanded.
|
||||
*/
|
||||
|
@ -51,24 +51,14 @@ final class DbTools {
|
|||
$backend = $backends[$scheme] ?? null;
|
||||
|
||||
if(!($backend instanceof DbBackend)) {
|
||||
$backend = null;
|
||||
|
||||
if(array_key_exists($scheme, self::DB_PROTOS))
|
||||
$name = self::DB_PROTOS[$scheme];
|
||||
else
|
||||
$name = str_replace('-', '\\', (string)$scheme);
|
||||
|
||||
if(class_exists($name) && is_subclass_of($name, DbBackend::class)) {
|
||||
$backend = new $name;
|
||||
$name = get_class($backend);
|
||||
}
|
||||
|
||||
if($backend === null)
|
||||
if(!array_key_exists($scheme, self::DB_PROTOS))
|
||||
throw new RuntimeException('No implementation is available for the specified scheme.');
|
||||
|
||||
$backend = new (self::DB_PROTOS[$scheme]);
|
||||
if(!$backend->isAvailable())
|
||||
throw new RuntimeException('Requested database backend is not available, likely due to missing dependencies.');
|
||||
|
||||
$backends[$name] = $backend;
|
||||
$backends[$scheme] = $backend;
|
||||
}
|
||||
|
||||
return $backend;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
// CacheToolsTest.php
|
||||
// Created: 2024-04-10
|
||||
// Updated: 2024-10-02
|
||||
// Updated: 2024-10-16
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
@ -25,9 +25,6 @@ final class CacheToolsTest extends TestCase {
|
|||
public function testBasicDSN(): void {
|
||||
$arrayCache = CacheTools::create('array:');
|
||||
$this->assertInstanceOf(ArrayCacheProvider::class, $arrayCache);
|
||||
|
||||
$arrayCache = CacheTools::create('Index-Cache-ArrayCache-ArrayCacheBackend:');
|
||||
$this->assertInstanceOf(ArrayCacheProvider::class, $arrayCache);
|
||||
}
|
||||
|
||||
public function testMemcachedDSN(): void {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
// DbToolsTest.php
|
||||
// Created: 2021-04-28
|
||||
// Updated: 2024-10-04
|
||||
// Updated: 2024-10-16
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
@ -38,9 +38,6 @@ final class DbToolsTest extends TestCase {
|
|||
$nullDbConn1 = DbTools::create('null:');
|
||||
$this->assertInstanceOf(NullDbConnection::class, $nullDbConn1);
|
||||
|
||||
$nullDbConn2 = DbTools::create('Index-Db-NullDb-NullDbBackend:');
|
||||
$this->assertInstanceOf(NullDbConnection::class, $nullDbConn2);
|
||||
|
||||
$maria = new MariaDbBackend;
|
||||
$sqlite = new SqliteBackend;
|
||||
|
||||
|
|
Loading…
Reference in a new issue