src/Client.php
public static function verifyScopes($scopes, $accessToken=null)
    {
        // Check access_token
        if (!$tokenInfo = self::verifyAccessToken($accessToken)) return false;

        $scopeString = $tokenInfo['scope'];

        // Check scope for each
        foreach ($scopes as $key => $scope) {
            
            if (stripos($scopeString, $scope) === false) return false;
        }

        return true;
    }
public static function verifyScopes($scopes, $accessToken=null)
    {
        // Check access_token
        if (!$tokenInfo = self::verifyAccessToken($accessToken)) return false;

        $scopeString = $tokenInfo['scope'];

        // Check scope for each
        foreach ($scopes as $key => $scope) {
            
            if (stripos($scopeString, $scope) === false) return false;
        }

        return true;
    }
public static function verifyScopes ( $ scopes , $ accessToken = null ) { // Check access_token
 if ( ! $ tokenInfo = self :: verifyAccessToken ( $ accessToken ) ) return false ; $ scopeString = $ tokenInfo [ 'scope' ] ; // Check scope for each
 foreach ( $ scopes as $ key => $ scope ) { if ( stripos ( $ scopeString , $ scope ) === false ) return false ; } return true ; }
Verify scopes of tokenInfo by access_token. This method will verify the current access_token
by Google API, if one isn't provided.

@param array $scopes Google client scope list, ex: ['https://www.googleapis.com/auth/userinfo.profile']
@param string|null $accessToken The token (access_token) that should be verified.
@return array|false Returns the token payload as an array if the verification was
successful, false otherwise.
@example
$result = \yidas\google\apiHelper\Client::verifyScopes([
'https://www.googleapis.com/auth/userinfo.profile',
]);
Verify scopes of tokenInfo by access_token . This method will verify the current access_token by Google API if one isn t provided .