fkooman\OAuth\Client\Scope::hasOnlyScope PHP Method

hasOnlyScope() public method

public hasOnlyScope ( Scope $that )
$that Scope
    public function hasOnlyScope(Scope $that)
    {
        if ($this->isEmpty()) {
            return true;
        }
        foreach ($this->toArray() as $s) {
            if (!in_array($s, $that->toArray())) {
                return false;
            }
        }
        return true;
    }

Usage Example

Esempio n. 1
0
 public function testHasOnlyScope()
 {
     $scope = new Scope(array('foo', 'bar'));
     $this->assertTrue($scope->hasOnlyScope(new Scope(array('foo', 'bar', 'baz'))));
     $this->assertFalse($scope->hasOnlyScope(new Scope(array('foo'))));
     $this->assertFalse($scope->hasOnlyScope(new Scope()));
     $scopeTwo = new Scope();
     $this->assertTrue($scopeTwo->hasOnlyScope(new Scope(array('foo'))));
 }