Example #1
0
 /**
  * Adds a Token under the composition
  * @param AbstractToken $token
  */
 public function addToken(AbstractToken $token)
 {
     if ($token->isDataStream() and $token->getStream() === '') {
         return;
     }
     $this->processed .= (string) $token;
     $this->tokens[] = $token;
 }
Example #2
0
 public function isSameType(AbstractToken $that)
 {
     if (T_CURLY_OPEN === $this->type && $that instanceof LiteralToken && '{' === $that->getValue()) {
         return true;
     }
     if (!$that instanceof PhpToken) {
         return false;
     }
     return $this->type === $that->type;
 }
 public function isClosing(AbstractToken $token)
 {
     if ($token instanceof PhpToken && $token->getType() === T_CURLY_OPEN && $this->value === '}') {
         return true;
     }
     if (!$token instanceof LiteralToken) {
         return false;
     }
     switch ($this->value) {
         case '}':
             return '{' === $token->value;
         case ')':
             return '(' === $token->value;
         case ']':
             return '[' === $token->value;
         default:
             return false;
     }
 }
Example #4
0
 /**
  * @param $tokenValue
  * @param null $tokenType
  * @param null $expiresIn
  * @param null $scope
  * @param null $state
  */
 public function __construct($tokenValue, $tokenType = null, $expiresIn = null, $scope = null, $state = null)
 {
     parent::__construct($tokenValue);
     if (is_null($tokenType)) {
         $tokenType = self::TOKEN_TYPE_BEARER;
     }
     $tokenTypeLCase = strtolower($tokenType);
     if (!$this->verifyTokenType($tokenTypeLCase)) {
         throw new \InvalidArgumentException("'{$tokenType}' is not a valid Token Type");
     }
     if (!is_null($expiresIn) && !is_int($expiresIn)) {
         throw new \InvalidArgumentException("'{$expiresIn}' is not a valid time value for 'expiresIn' property");
     }
     if (!is_null($scope) && !$this->isAValidStringType($scope)) {
         throw new \InvalidArgumentException("'{$scope}' is not a valid scope value, it must be a string");
     }
     $this->tokenType = $tokenTypeLCase;
     $this->expiresIn = $expiresIn;
     $this->scope = $scope;
     $this->state = $state;
 }
 public function unserialize($str)
 {
     list($this->credentials, $this->providerKey, $parentStr) = unserialize($str);
     parent::unserialize($parentStr);
 }
Example #6
0
 public function __construct($start, $length, \DateTime $date)
 {
     parent::__construct($start, $length);
     $this->date = $date;
 }
Example #7
0
 public function isExpired() : bool
 {
     return null !== $this->expiresAt && parent::isExpired();
 }
 /**
  * {@inheritDoc}
  */
 public function isExpired() : bool
 {
     return parent::isExpired() && $this->expiresAt !== null;
 }
 /**
  * {@inheritdoc}
  *
  * @param string $redirectUri
  */
 public function __construct($uuid = null, $token, Client $client, UserInterface $user = null, $scopes = null, $redirectUri)
 {
     parent::__construct($uuid, $token, $client, $user, $scopes);
     $this->setRedirectUri($redirectUri);
 }
Example #10
0
 /**
  * {@inheritDoc}
  */
 public function unserialize($serialized)
 {
     list($this->key, $parentStr) = unserialize($serialized);
     parent::unserialize($parentStr);
 }
Example #11
0
 public function __construct($start, $length, $amount)
 {
     parent::__construct($start, $length);
     $this->amount = $amount;
 }
Example #12
0
 public function __construct($start, $word)
 {
     parent::__construct($start, strlen($word));
     $this->word = $word;
     $this->ascii = iconv('UTF-8', 'ASCII//TRANSLIT', $word);
 }
 public static function reconstitute(array $data) : self
 {
     $token = parent::reconstitute($data);
     $token->redirectUri = $data['redirectUri'];
     return $token;
 }
 public function toArray()
 {
     $arrayData = parent::toArray();
     return $this->_arrayDateObjectToTimeString($arrayData, array(static::FIELD_ISSUE_TIME, static::FIELD_EXPIRATION_TIME));
 }
Example #15
0
 public function generateRandomToken() : string
 {
     $token = parent::generateRandomToken();
     $this->storage[$this->key] = $token;
     return $token;
 }
Example #16
0
 public function __construct($start, $id)
 {
     parent::__construct($start, strlen($id));
     $this->id = $id;
 }