本文整理汇总了PHP中Token::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Token::__construct方法的具体用法?PHP Token::__construct怎么用?PHP Token::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Token
的用法示例。
在下文中一共展示了Token::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* 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);
}
示例2: __construct
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;
}
示例3: __construct
/**
* 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;
}
示例4: __construct
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);
}
示例5: __construct
/**
* Constructor.
*/
public function __construct($user, $credentials, array $roles = array())
{
parent::__construct($roles);
$this->setUser($user);
$this->credentials = $credentials;
parent::setAuthenticated((bool) count($roles));
}
示例6: __construct
/**
* 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;
}
示例7: __construct
/**
* 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);
}
示例8: __construct
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']);
}
示例9: __construct
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);
}
示例10: __construct
/**
* {@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);
}
}
示例11: __construct
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);
}
示例12: __construct
public function __construct($lexeme)
{
parent::__construct('MISC', $lexeme);
// always encode misc
$this->value = str_replace(array('{', '}'), array('{', '}'), $lexeme);
}
示例13: __construct
/**
* @param mixed|null $value
* @param int|null $lineNumber
*/
public function __construct($value = 'try', $lineNumber = null)
{
parent::__construct(T_TRY, $value, $lineNumber);
}
示例14: __construct
/**
* @param mixed|null $value
* @param int|null $lineNumber
*/
public function __construct($value = 'endif', $lineNumber = null)
{
parent::__construct(T_ENDIF, $value, $lineNumber);
}
示例15: __construct
/**
* @param mixed|null $value
* @param int|null $lineNumber
*/
public function __construct($value = '>=', $lineNumber = null)
{
parent::__construct(T_IS_GREATER_OR_EQUAL, $value, $lineNumber);
}