| @@ 306-317 (lines=12) @@ | ||
| 303 | /** |
|
| 304 | * @param string|null $refreshToken |
|
| 305 | */ |
|
| 306 | private function setRefreshToken($refreshToken) |
|
| 307 | { |
|
| 308 | if (!is_null($refreshToken)) { |
|
| 309 | self::requireString('refresh_token', $refreshToken); |
|
| 310 | // refresh-token = 1*VSCHAR |
|
| 311 | // VSCHAR = %x20-7E |
|
| 312 | if (1 !== preg_match('/^[\x20-\x7E]+$/', $refreshToken)) { |
|
| 313 | throw new AccessTokenException('invalid "refresh_token"'); |
|
| 314 | } |
|
| 315 | } |
|
| 316 | $this->refreshToken = $refreshToken; |
|
| 317 | } |
|
| 318 | ||
| 319 | /** |
|
| 320 | * @param string|null $scope |
|
| @@ 322-336 (lines=15) @@ | ||
| 319 | /** |
|
| 320 | * @param string|null $scope |
|
| 321 | */ |
|
| 322 | private function setScope($scope) |
|
| 323 | { |
|
| 324 | if (!is_null($scope)) { |
|
| 325 | self::requireString('scope', $scope); |
|
| 326 | // scope = scope-token *( SP scope-token ) |
|
| 327 | // scope-token = 1*NQCHAR |
|
| 328 | // NQCHAR = %x21 / %x23-5B / %x5D-7E |
|
| 329 | foreach (explode(' ', $scope) as $scopeToken) { |
|
| 330 | if (1 !== preg_match('/^[\x21\x23-\x5B\x5D-\x7E]+$/', $scopeToken)) { |
|
| 331 | throw new AccessTokenException('invalid "scope"'); |
|
| 332 | } |
|
| 333 | } |
|
| 334 | } |
|
| 335 | $this->scope = $scope; |
|
| 336 | } |
|
| 337 | ||
| 338 | /** |
|
| 339 | * @param string $k |
|