modifs.mineures sans commentaires
This commit is contained in:
parent
f82c847ec2
commit
43952bb4a9
|
@ -1,9 +1,14 @@
|
|||
<?php
|
||||
namespace nur\b\authnz;
|
||||
|
||||
use ArrayAccess;
|
||||
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 */
|
||||
private static $instance;
|
||||
|
||||
|
@ -15,6 +20,7 @@ class InvalidUser implements IAuthzUser {
|
|||
|
||||
function __construct(?string $username=null) {
|
||||
$this->username = $username;
|
||||
$this->data = [];
|
||||
}
|
||||
|
||||
function isValid(): bool {
|
||||
|
@ -59,8 +65,4 @@ class InvalidUser implements IAuthzUser {
|
|||
function has($key): bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
function get($key, $default=null) {
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,8 +42,8 @@ class Capacitor {
|
|||
$this->storage->_ensureExists($this->channel);
|
||||
}
|
||||
|
||||
function reset(): void {
|
||||
$this->storage->_reset($this->channel);
|
||||
function reset(bool $ensureExists=false): void {
|
||||
$this->storage->_reset($this->channel, $ensureExists);
|
||||
}
|
||||
|
||||
function charge($item, $func=null, ?array $args=null): int {
|
||||
|
|
|
@ -127,11 +127,11 @@ abstract class CapacitorStorage {
|
|||
$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é */
|
||||
function reset(?string $channel): void {
|
||||
$this->_reset($this->getChannel($channel));
|
||||
function reset(?string $channel, bool $ensureExists=false): void {
|
||||
$this->_reset($this->getChannel($channel), $ensureExists);
|
||||
}
|
||||
|
||||
function _charge(CapacitorChannel $channel, $item, $func, ?array $args): int {
|
||||
|
|
|
@ -54,12 +54,13 @@ class MysqlStorage extends CapacitorStorage {
|
|||
$this->_create($channel);
|
||||
}
|
||||
|
||||
function _reset(CapacitorChannel $channel): void {
|
||||
function _reset(CapacitorChannel $channel, bool $ensureExists=false): void {
|
||||
$this->db->exec([
|
||||
"drop table if exists",
|
||||
$channel->getTableName(),
|
||||
]);
|
||||
$channel->setCreated(false);
|
||||
if ($ensureExists) $this->_ensureExists($channel);
|
||||
}
|
||||
|
||||
function close(): void {
|
||||
|
|
|
@ -52,12 +52,13 @@ class SqliteStorage extends CapacitorStorage {
|
|||
$this->_create($channel);
|
||||
}
|
||||
|
||||
function _reset(CapacitorChannel $channel): void {
|
||||
function _reset(CapacitorChannel $channel, bool $ensureExists=false): void {
|
||||
$this->db->exec([
|
||||
"drop table if exists",
|
||||
$channel->getTableName(),
|
||||
]);
|
||||
$channel->setCreated(false);
|
||||
if ($ensureExists) $this->_ensureExists($channel);
|
||||
}
|
||||
|
||||
function close(): void {
|
||||
|
|
Loading…
Reference in New Issue