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;
}
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')))); }