feat(core): implement tenant-scoped system store manager

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-08-28 20:47:27 -04:00
parent a1413db12f
commit e137de1183
5 changed files with 383 additions and 2 deletions
@@ -0,0 +1,14 @@
<?php
declare(strict_types=1);
namespace KTXF\SystemStore;
use InvalidArgumentException;
/**
* Raised when a logical system-store key is not safely normalized.
*/
final class InvalidKeyException extends InvalidArgumentException
{
}
+11 -2
View File
@@ -24,8 +24,17 @@ final readonly class StoreReference
throw new InvalidArgumentException('System-store service cannot be empty');
}
if ($this->namespace === '') {
throw new InvalidArgumentException('System-store namespace cannot be empty');
if (
$this->namespace === ''
|| str_starts_with($this->namespace, '/')
|| str_ends_with($this->namespace, '/')
|| str_contains($this->namespace, '\\')
|| str_contains($this->namespace, "\0")
|| in_array('', explode('/', $this->namespace), true)
|| in_array('.', explode('/', $this->namespace), true)
|| in_array('..', explode('/', $this->namespace), true)
) {
throw new InvalidArgumentException('System-store namespace must be a normalized relative key');
}
}
@@ -0,0 +1,14 @@
<?php
declare(strict_types=1);
namespace KTXF\SystemStore;
use RuntimeException;
/**
* Raised when a tenant system store cannot be resolved or trusted.
*/
final class SystemStoreException extends RuntimeException
{
}