Exemplo n.º 1
0
 /**
  * Constructor.
  *
  * @param string $key   The key shared with the authentication provider
  * @param string $user  The user
  * @param Role[] $roles An array of roles
  */
 public function __construct($key, $user, array $roles = array())
 {
     parent::__construct($roles);
     $this->key = $key;
     $this->user = $user;
     parent::setAuthenticated(true);
 }
Exemplo n.º 2
0
 public function __construct($tokenURL, $redirectURL, $clientID, $clientSecret)
 {
     parent::__construct($tokenURL, $redirectURL);
     // Google OAuth2 has the addition of 'client id' and 'client secret'
     $this->clientID = $clientID;
     $this->clientSecret = $clientSecret;
 }
Exemplo n.º 3
0
 /**
  * Constructs a new conditional token.
  * 
  * @param Token $condition The condition to check
  * @param Token $resultTrue The token to use when the condition returns true
  * @param Token $resultFalse The token to use when the condition returns false
  */
 public function __construct(Token $condition, Token $resultTrue, Token $resultFalse)
 {
     parent::__construct(static::PREC_TERNARY_IF);
     $this->condition = $condition;
     $this->resultTrue = $resultTrue;
     $this->resultFalse = $resultFalse;
 }
Exemplo n.º 4
0
 public function __construct($lexeme)
 {
     parent::__construct('STRING', $lexeme);
     // if there's a comment in the literal string, it needs to go
     $lexeme = preg_replace('/^\\{!--.*?--\\}$/', '', $lexeme);
     $this->value = preg_replace('/\\s+/', ' ', $lexeme);
 }
Exemplo n.º 5
0
 /**
  * Constructor.
  */
 public function __construct($user, $credentials, array $roles = array())
 {
     parent::__construct($roles);
     $this->setUser($user);
     $this->credentials = $credentials;
     parent::setAuthenticated((bool) count($roles));
 }
Exemplo n.º 6
0
 /**
  * Constructor.
  */
 public function __construct($user, $credentials, array $roles = null)
 {
     parent::__construct(null === $roles ? array() : $roles);
     if (null !== $roles) {
         $this->setAuthenticated(true);
     }
     $this->user = $user;
     $this->credentials = $credentials;
 }
Exemplo n.º 7
0
 /**
  * Create new "Value object" which represent one mathematical operator.
  * 
  * @param string $value string representation of this operator
  * @param integer $priority priority value of this token
  * @param integer $associativity one of Operator associative constants
  * @throws \InvalidArgumentException
  */
 public function __construct($value, $priority, $associativity)
 {
     if (!in_array($associativity, array(self::O_LEFT_ASSOCIATIVE, self::O_NONE_ASSOCIATIVE, self::O_RIGHT_ASSOCIATIVE))) {
         throw new \InvalidArgumentException(sprintf('Invalid associativity: %s', $associativity));
     }
     $this->priority = (int) $priority;
     $this->associativity = (int) $associativity;
     parent::__construct($value, Token::T_OPERATOR);
 }
Exemplo n.º 8
0
 public function __construct(array $data)
 {
     parent::__construct($data);
     foreach (array('state') as $key) {
         if (!array_key_exists($key, $data)) {
             throw new TokenException(sprintf("missing field '%s'", $key));
         }
     }
     $this->setState($data['state']);
 }
Exemplo n.º 9
0
 public function __construct($dir, $type, $uid = '', $sid = '', $key = '')
 {
     if (empty($dir)) {
         trigger_error('未指定类目录', E_USER_ERROR);
     }
     if (empty($type)) {
         trigger_error('未指定接口类型', E_USER_ERROR);
     }
     $this->dir = $dir;
     parent::__construct($type, $uid, $sid, $key);
 }
Exemplo n.º 10
0
 /**
  * {@inheritdoc}
  */
 public function __construct($id, $rawContent, $context)
 {
     parent::__construct($id, $rawContent, $context);
     foreach (preg_split('/\\s+/', trim($rawContent)) as $tag) {
         $tag = trim($tag);
         if (!$tag) {
             continue;
         }
         $this->tagList[] = new Tag($tag);
     }
 }
Exemplo n.º 11
0
 public function __construct(array $data)
 {
     parent::__construct($data);
     foreach (array('token_type', 'access_token') as $key) {
         if (!array_key_exists($key, $data)) {
             throw new TokenException(sprintf("missing field '%s'", $key));
         }
     }
     $this->setAccessToken($data['access_token']);
     $this->setTokenType($data['token_type']);
     $expiresIn = array_key_exists('expires_in', $data) ? $data['expires_in'] : null;
     $this->setExpiresIn($expiresIn);
 }
Exemplo n.º 12
0
 public function __construct($lexeme)
 {
     parent::__construct('MISC', $lexeme);
     // always encode misc
     $this->value = str_replace(array('{', '}'), array('{', '}'), $lexeme);
 }
Exemplo n.º 13
0
 /**
  * @param mixed|null $value
  * @param int|null $lineNumber
  */
 public function __construct($value = 'try', $lineNumber = null)
 {
     parent::__construct(T_TRY, $value, $lineNumber);
 }
Exemplo n.º 14
0
 /**
  * @param mixed|null $value
  * @param int|null $lineNumber
  */
 public function __construct($value = 'endif', $lineNumber = null)
 {
     parent::__construct(T_ENDIF, $value, $lineNumber);
 }
 /**
  * @param mixed|null $value
  * @param int|null $lineNumber
  */
 public function __construct($value = '>=', $lineNumber = null)
 {
     parent::__construct(T_IS_GREATER_OR_EQUAL, $value, $lineNumber);
 }
 /**
  * @param mixed|null $value
  * @param int|null $lineNumber
  */
 public function __construct($value = null, $lineNumber = null)
 {
     parent::__construct(T_ENCAPSED_AND_WHITESPACE, $value, $lineNumber);
 }
 function __construct($opt1, $opt2)
 {
     parent::__construct('option', array($opt1, $opt2));
 }
 /**
  * @param mixed|null $value
  * @param int|null $lineNumber
  */
 public function __construct($value = 'xor', $lineNumber = null)
 {
     parent::__construct(T_LOGICAL_XOR, $value, $lineNumber);
 }
Exemplo n.º 19
0
 /**
  * @param mixed|null $value
  * @param int|null $lineNumber
  */
 public function __construct($value = '0.0', $lineNumber = null)
 {
     parent::__construct(T_DNUMBER, $value, $lineNumber);
 }
Exemplo n.º 20
0
 /**
  * @param mixed|null $value
  * @param int|null $lineNumber
  */
 public function __construct($value = 'empty', $lineNumber = null)
 {
     parent::__construct(T_EMPTY, $value, $lineNumber);
 }
 /**
  * @param mixed|null $value
  * @param int|null $lineNumber
  */
 public function __construct($value = null, $lineNumber = null)
 {
     parent::__construct(T_CHARACTER, $value, $lineNumber);
 }
 /**
  * @param mixed|null $value
  * @param int|null $lineNumber
  */
 public function __construct($value = '!=', $lineNumber = null)
 {
     parent::__construct(T_IS_NOT_EQUAL, $value, $lineNumber);
 }
Exemplo n.º 23
0
 protected function __construct()
 {
     parent::__construct();
 }
 /**
  * @param mixed|null $value
  * @param int|null $lineNumber
  */
 public function __construct($value = ' ', $lineNumber = null)
 {
     parent::__construct(T_WHITESPACE, $value, $lineNumber);
 }
Exemplo n.º 25
0
 /**
  * @param mixed|null $value
  * @param int|null $lineNumber
  */
 public function __construct($value = 'finally', $lineNumber = null)
 {
     parent::__construct(T_FINALLY, $value, $lineNumber);
 }
Exemplo n.º 26
0
 /**
  * @param mixed|null $value
  * @param int|null $lineNumber
  */
 public function __construct($value = 'as', $lineNumber = null)
 {
     parent::__construct(T_AS, $value, $lineNumber);
 }
 /**
  * @param mixed|null $value
  * @param int|null $lineNumber
  */
 public function __construct($value = '(double)', $lineNumber = null)
 {
     parent::__construct(T_DOUBLE_CAST, $value, $lineNumber);
 }
Exemplo n.º 28
0
 public function __construct($lexeme)
 {
     parent::__construct('VARIABLE', $lexeme);
 }
 /**
  * @param mixed|null $value
  * @param int|null $lineNumber
  */
 public function __construct($value = 'endforeach', $lineNumber = null)
 {
     parent::__construct(T_ENDFOREACH, $value, $lineNumber);
 }
Exemplo n.º 30
0
 /**
  * @param mixed|null $value
  * @param int|null $lineNumber
  */
 public function __construct($value = '(int)', $lineNumber = null)
 {
     parent::__construct(T_INT_CAST, $value, $lineNumber);
 }