37     public function __construct($key, callable $comparator, $data, $algo = 
'sha256') {
 
   39         $this->comparator = $comparator;
 
   41             throw new \InvalidArgumentException(
'$data cannot be empty');
 
   43         if (!is_string($data)) {
 
   44             $data = serialize($data);
 
   56         $bytes = hash_hmac($this->algo, $this->data, $this->key, 
true);
 
   57         return strtr(rtrim(base64_encode($bytes), 
'='), 
'+/', 
'-_');
 
   68         return call_user_func($this->comparator, $expected_token, 
$token);
 
Component for creating HMAC tokens.
 
__construct($key, callable $comparator, $data, $algo='sha256')
Constructor.
 
getToken()
Get the HMAC token in Base64URL encoding.
 
matchesToken($token)
Does the MAC match the given token?