public function __construct(array $data) { parent::__construct($data); foreach (array('refresh_token') as $key) { if (!array_key_exists($key, $data)) { throw new TokenException(sprintf("missing field '%s'", $key)); } } $this->setRefreshToken($data['refresh_token']); }
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); }