- SettingsRepository::allSettings() — inicjalizacja $settings = [] przed pętlą (bug: false ?? [] zwracało false gdy cache pusty a DB null) - Stuby wydzielone do tests/stubs/CacheHandler.php + S.php - phpunit.xml zmigurowany do schematu PHPUnit 10 (coverage → source) - composer.lock dodany do repozytorium Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
25 lines
498 B
PHP
25 lines
498 B
PHP
<?php
|
|
namespace Shared\Cache;
|
|
|
|
class CacheHandler
|
|
{
|
|
private static array $store = [];
|
|
|
|
public static function reset(): void { self::$store = []; }
|
|
|
|
public static function fetch(string $key): mixed
|
|
{
|
|
return self::$store[$key] ?? false;
|
|
}
|
|
|
|
public static function store(string $key, mixed $value, int $ttl = 0): void
|
|
{
|
|
self::$store[$key] = $value;
|
|
}
|
|
|
|
public static function delete(string $key): void
|
|
{
|
|
unset(self::$store[$key]);
|
|
}
|
|
}
|