21 if (is_null($storage) || is_array($storage)) {
22 $storage =
new Memory((array) $storage);
25 if (!$storage instanceof ScopeStorageInterface) {
26 throw new \InvalidArgumentException(
"Argument 1 to OAuth2\Scope must be null, an array, or instance of OAuth2\Storage\ScopeInterface");
29 $this->storage = $storage;
46 public function checkScope($required_scope, $available_scope)
48 $required_scope = explode(
' ', trim($required_scope));
49 $available_scope = explode(
' ', trim($available_scope));
51 return (count(array_diff($required_scope, $available_scope)) == 0);
66 $scope = explode(
' ', trim($scope));
67 $reservedScope = $this->getReservedScopes();
68 $nonReservedScopes = array_diff($scope, $reservedScope);
69 if (count($nonReservedScopes) == 0) {
73 $nonReservedScopes = implode(
' ', $nonReservedScopes);
75 return $this->storage->scopeExists($nonReservedScopes);
82 return $request->
request(
'scope', $request->
query(
'scope'));
87 return $this->storage->getDefaultScope($client_id);
101 return array(
'openid',
'offline_access');