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

equals() public method

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

Usage Example

Example #1
0
 public function testSerialize()
 {
     $s = new Scope(array('foo', 'bar', 'baz'));
     $t = new Scope($s->toArray());
     $this->assertTrue($t->equals($s));
 }