protected function validateTokenScopes(array $scopes)
    {
        $scopes = array_map(function ($scope) {
            return (string) $scope;
        }, $scopes);

        $registeredScopes = $this->scopeService->getAll();

        $registeredScopes = array_map(function ($scope) {
            return (string) $scope;
        }, $registeredScopes);

        $diff = array_diff($scopes, $registeredScopes);

        if (count($diff) > 0) {
            throw OAuth2Exception::invalidScope(sprintf(
                'Some scope(s) do not exist: %s',
                implode(', ', $diff)
            ));
        }
    }
protected function validateTokenScopes(array $scopes)
    {
        $scopes = array_map(function ($scope) {
            return (string) $scope;
        }, $scopes);

        $registeredScopes = $this->scopeService->getAll();

        $registeredScopes = array_map(function ($scope) {
            return (string) $scope;
        }, $registeredScopes);

        $diff = array_diff($scopes, $registeredScopes);

        if (count($diff) > 0) {
            throw OAuth2Exception::invalidScope(sprintf(
                'Some scope(s) do not exist: %s',
                implode(', ', $diff)
            ));
        }
    }
protected function validateTokenScopes ( array $ scopes ) { $ scopes = array_map ( function ( $ scope ) { return ( string ) $ scope ; } , $ scopes ) ; $ registeredScopes = $ this -> scopeService -> getAll ( ) ; $ registeredScopes = array_map ( function ( $ scope ) { return ( string ) $ scope ; } , $ registeredScopes ) ; $ diff = array_diff ( $ scopes , $ registeredScopes ) ; if ( count ( $ diff ) > 0 ) { throw OAuth2Exception :: invalidScope ( sprintf ( 'Some scope(s) do not exist: %s' , implode ( ', ' , $ diff ) ) ) ; } }
Validate the token scopes against the registered scope

@param string[]|Scope[] $scopes

@throws OAuth2Exception (invalid_scope) When one or more of the given scopes where not registered
Validate the token scopes against the registered scope