modifs.mineures sans commentaires

This commit is contained in:
Jephté Clain 2024-06-13 10:55:26 +04:00
parent f82c847ec2
commit 43952bb4a9
5 changed files with 16 additions and 12 deletions

View File

@ -1,9 +1,14 @@
<?php <?php
namespace nur\b\authnz; namespace nur\b\authnz;
use ArrayAccess;
use nur\A; use nur\A;
use nur\b\coll\TBaseArray;
use nur\b\coll\TGenericArray;
class InvalidUser implements IAuthzUser, ArrayAccess {
use TBaseArray, TGenericArray;
class InvalidUser implements IAuthzUser {
/** @var self */ /** @var self */
private static $instance; private static $instance;
@ -15,6 +20,7 @@ class InvalidUser implements IAuthzUser {
function __construct(?string $username=null) { function __construct(?string $username=null) {
$this->username = $username; $this->username = $username;
$this->data = [];
} }
function isValid(): bool { function isValid(): bool {
@ -59,8 +65,4 @@ class InvalidUser implements IAuthzUser {
function has($key): bool { function has($key): bool {
return false; return false;
} }
function get($key, $default=null) {
return $default;
}
} }

View File

@ -42,8 +42,8 @@ class Capacitor {
$this->storage->_ensureExists($this->channel); $this->storage->_ensureExists($this->channel);
} }
function reset(): void { function reset(bool $ensureExists=false): void {
$this->storage->_reset($this->channel); $this->storage->_reset($this->channel, $ensureExists);
} }
function charge($item, $func=null, ?array $args=null): int { function charge($item, $func=null, ?array $args=null): int {

View File

@ -127,11 +127,11 @@ abstract class CapacitorStorage {
$this->_ensureExists($this->getChannel($channel)); $this->_ensureExists($this->getChannel($channel));
} }
abstract function _reset(CapacitorChannel $channel): void; abstract function _reset(CapacitorChannel $channel, bool $ensureExists=false): void;
/** supprimer le canal spécifié */ /** supprimer le canal spécifié */
function reset(?string $channel): void { function reset(?string $channel, bool $ensureExists=false): void {
$this->_reset($this->getChannel($channel)); $this->_reset($this->getChannel($channel), $ensureExists);
} }
function _charge(CapacitorChannel $channel, $item, $func, ?array $args): int { function _charge(CapacitorChannel $channel, $item, $func, ?array $args): int {

View File

@ -54,12 +54,13 @@ class MysqlStorage extends CapacitorStorage {
$this->_create($channel); $this->_create($channel);
} }
function _reset(CapacitorChannel $channel): void { function _reset(CapacitorChannel $channel, bool $ensureExists=false): void {
$this->db->exec([ $this->db->exec([
"drop table if exists", "drop table if exists",
$channel->getTableName(), $channel->getTableName(),
]); ]);
$channel->setCreated(false); $channel->setCreated(false);
if ($ensureExists) $this->_ensureExists($channel);
} }
function close(): void { function close(): void {

View File

@ -52,12 +52,13 @@ class SqliteStorage extends CapacitorStorage {
$this->_create($channel); $this->_create($channel);
} }
function _reset(CapacitorChannel $channel): void { function _reset(CapacitorChannel $channel, bool $ensureExists=false): void {
$this->db->exec([ $this->db->exec([
"drop table if exists", "drop table if exists",
$channel->getTableName(), $channel->getTableName(),
]); ]);
$channel->setCreated(false); $channel->setCreated(false);
if ($ensureExists) $this->_ensureExists($channel);
} }
function close(): void { function close(): void {