22 $token= \bin2hex(\random_bytes($this->length));
23 }
while (\array_search($token, $this->tokens,
true)===
true);
36 if(isset($this->tokens[$key]))
37 return $this->tokens[$key];
50 $this->tokens[$key]=[
"creationTime"=>\time()];
60 foreach (
$tokens as $key=>$value){
62 unset($this->tokens[$key]);
67 public function remove($key){
68 if(isset($this->tokens[$key])){
69 unset($this->tokens[$key]);
88 if(!isset(self::$cache)){
89 self::$cache=
new ArrayCache($folder.
"rest/tokens",
".rest");
92 if(self::$cache->exists($key)){
93 $filecontent=self::$cache->fetch($key);
94 if(isset($filecontent[
"tokens"])){
97 if(isset($filecontent[
"length"])){
100 if(isset($filecontent[
"duration"])){
storeToCache($key="_apiTokens")
static getFromCache($folder, $key="_apiTokens", $length=10, $duration=3600)
This class is responsible for storing Arrays in PHP files.
__construct($length=10, $duration=3600, $tokens=[])
static asPhpArray($array, $prefix="", $depth=1, $format=false)