diff options
Diffstat (limited to 'vendor/bshaffer/oauth2-server-php/src/OAuth2/Scope.php')
-rw-r--r-- | vendor/bshaffer/oauth2-server-php/src/OAuth2/Scope.php | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/vendor/bshaffer/oauth2-server-php/src/OAuth2/Scope.php b/vendor/bshaffer/oauth2-server-php/src/OAuth2/Scope.php index c44350bfd..3ba6e5328 100644 --- a/vendor/bshaffer/oauth2-server-php/src/OAuth2/Scope.php +++ b/vendor/bshaffer/oauth2-server-php/src/OAuth2/Scope.php @@ -2,19 +2,23 @@ namespace OAuth2; +use InvalidArgumentException; use OAuth2\Storage\Memory; use OAuth2\Storage\ScopeInterface as ScopeStorageInterface; /** -* @see OAuth2\ScopeInterface +* @see ScopeInterface */ class Scope implements ScopeInterface { protected $storage; /** - * @param mixed @storage - * Either an array of supported scopes, or an instance of OAuth2\Storage\ScopeInterface + * Constructor + * + * @param mixed $storage - Either an array of supported scopes, or an instance of OAuth2\Storage\ScopeInterface + * + * @throws InvalidArgumentException */ public function __construct($storage = null) { @@ -23,7 +27,7 @@ class Scope implements ScopeInterface } if (!$storage instanceof ScopeStorageInterface) { - throw new \InvalidArgumentException("Argument 1 to OAuth2\Scope must be null, an array, or instance of OAuth2\Storage\ScopeInterface"); + throw new InvalidArgumentException("Argument 1 to OAuth2\Scope must be null, an array, or instance of OAuth2\Storage\ScopeInterface"); } $this->storage = $storage; @@ -32,12 +36,10 @@ class Scope implements ScopeInterface /** * Check if everything in required scope is contained in available scope. * - * @param $required_scope - * A space-separated string of scopes. - * - * @return - * TRUE if everything in required scope is contained in available scope, - * and FALSE if it isn't. + * @param string $required_scope - A space-separated string of scopes. + * @param string $available_scope - A space-separated string of scopes. + * @return bool - TRUE if everything in required scope is contained in available scope and FALSE + * if it isn't. * * @see http://tools.ietf.org/html/rfc6749#section-7 * @@ -54,11 +56,8 @@ class Scope implements ScopeInterface /** * Check if the provided scope exists in storage. * - * @param $scope - * A space-separated string of scopes. - * - * @return - * TRUE if it exists, FALSE otherwise. + * @param string $scope - A space-separated string of scopes. + * @return bool - TRUE if it exists, FALSE otherwise. */ public function scopeExists($scope) { @@ -76,12 +75,20 @@ class Scope implements ScopeInterface } } + /** + * @param RequestInterface $request + * @return string + */ public function getScopeFromRequest(RequestInterface $request) { // "scope" is valid if passed in either POST or QUERY return $request->request('scope', $request->query('scope')); } + /** + * @param null $client_id + * @return mixed + */ public function getDefaultScope($client_id = null) { return $this->storage->getDefaultScope($client_id); @@ -93,8 +100,7 @@ class Scope implements ScopeInterface * In case OpenID Connect is used, these scopes must include: * 'openid', offline_access'. * - * @return - * An array of reserved scopes. + * @return array - An array of reserved scopes. */ public function getReservedScopes() { |