public function create($data = [])
    {
        // Create a random hash
        $hash = $this->hash();

        // Store the file in the tokens storage
        $data = array_merge($data, ['token' => $hash, 'timestamp' => time()]);
        $stored = file_put_contents($this->path($hash), json_encode($data));

        // Return the data or false in case of failure
        return ($stored)? $data : false;
    }
public function create($data = [])
    {
        // Create a random hash
        $hash = $this->hash();

        // Store the file in the tokens storage
        $data = array_merge($data, ['token' => $hash, 'timestamp' => time()]);
        $stored = file_put_contents($this->path($hash), json_encode($data));

        // Return the data or false in case of failure
        return ($stored)? $data : false;
    }
public function create ( $ data = [ ] ) { // Create a random hash $ hash = $ this -> hash ( ) ; // Store the file in the tokens storage $ data = array_merge ( $ data , [ 'token' => $ hash , 'timestamp' => time ( ) ] ) ; $ stored = file_put_contents ( $ this -> path ( $ hash ) , json_encode ( $ data ) ) ; // Return the data or false in case of failure return ( $ stored ) ? $ data : false ; }
Creates a token

@param array $data Data to store
@return Token data
Creates a token