for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php namespace nyx\auth;
/**
* Token
*
* @package Nyx\Auth
* @version 0.1.0
* @author Michal Chojnacki <[email protected]>
* @copyright 2012-2017 Nyx Dev Team
* @link https://github.com/unyx/nyx
*/
class Token implements interfaces\Token
{
* @var string The Token's identifier.
protected $id;
* Creates a new Token instance.
* @param string $id The Token's identifier.
public function __construct(string $id)
$this->id = $id;
}
* {@inheritDoc}
public function getId() : string
return $this->id;
public function matches(interfaces\Token $that) : bool
return $this->id === $that->getId();
public function serialize() : string
return serialize($this->id);
public function unserialize($data)
$this->id = unserialize($data);
public function jsonSerialize()
public function toJson(int $options = 0) : string
return json_encode($this->jsonSerialize(), $options);
public function toString() : string
public function __toString() : string
return $this->toString();
public function toArray() : array
return [
'id' => $this->id
];