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

toString() public method

public toString ( $separator = ' ' )
    public function toString($separator = ' ')
    {
        if (!is_string($separator)) {
            throw new ScopeException('separator must be string');
        }
        return implode($separator, $this->scope);
    }

Usage Example

Example #1
0
 public function testScope()
 {
     $s = new Scope(array('read', 'write', 'foo'));
     $this->assertFalse($s->isEmpty());
     $this->assertTrue($s->hasScope(new Scope(array('read'))));
     $this->assertTrue($s->hasScope(new Scope(array('write'))));
     $this->assertTrue($s->hasScope(new Scope(array('foo'))));
     $this->assertTrue($s->hasAnyScope(new Scope(array('foo', 'bar'))));
     $this->assertTrue($s->equals(new Scope(array('foo', 'write', 'read'))));
     $this->assertFalse($s->equals(new Scope(array('read', 'write'))));
     $this->assertFalse($s->equals(new Scope(array('bar', 'foo', 'read', 'write'))));
     $this->assertFalse($s->hasAnyScope(new Scope(array('bar', 'baz'))));
     $this->assertEquals('foo read write', $s->toString());
     $this->assertEquals('foo read write', $s->__toString());
     $this->assertEquals('foo,read,write', $s->toString(','));
 }