Compare commits

..

4 commits

Author SHA1 Message Date
Benjamin Renard
a4e21e6046
Auth\Db: add edit_user CLI command 2024-09-15 09:39:22 +02:00
Benjamin Renard
a74c23fcd0
Auth\Db: implement update_user() 2024-09-15 09:39:21 +02:00
Benjamin Renard
d42a864901
Auth\Db::add_user(): add check of username uniqueness 2024-09-15 09:39:19 +02:00
Benjamin Renard
b33a3e8205
Auth\User: implement array access interface 2024-09-15 09:39:18 +02:00

View file

@ -7,7 +7,7 @@ use EesyPHP\Log;
use function EesyPHP\ensure_is_array;
use function EesyPHP\vardump;
class User {
class User implements \ArrayAccess {
/**
* Username
@ -111,10 +111,47 @@ class User {
/**
* ArrayAccess interface
*/
public function offsetExists($offset) { return self :: __isset($offset); }
public function offsetGet($offset){ return self :: __get($offset); }
public function offsetSet($offset, $value) { self :: __set($offset, $value); }
public function offsetUnset($offset) { self :: __set($offset, null); }
#[\ReturnTypeWillChange]
/**
* Magic method to check if an dynamic property exist when object is used as an array
* @param string $offset The property
* @return bool
*/
public function offsetExists($offset) {
return $this -> __isset($offset);
}
#[\ReturnTypeWillChange]
/**
* Magic method to get a dynamic property when object is used as an array
* @param string $offset The property
* @return mixed
*/
public function offsetGet($offset){
return $this -> __get($offset);
}
#[\ReturnTypeWillChange]
/**
* Magic method to set a dynamic property when object is used as an array
* @param string $offset The property
* @param mixed $value The value
* @return void
*/
public function offsetSet($offset, $value) {
$this -> __set($offset, $value);
}
#[\ReturnTypeWillChange]
/**
* Magic method to unset (=set as null) a dynamic property when object is used as an array
* @param string $offset The property
* @return void
*/
public function offsetUnset($offset) {
$this -> __set($offset, null);
}
/**
* Check user password