Example #1
0
File: Role.php Project: gobline/acl
 /**
  * {@inheritdoc}
  */
 public function inherits($role)
 {
     if (!$this->parents) {
         return false;
     }
     if (is_scalar($role)) {
         $role = new self($role);
     } elseif (!$role instanceof self) {
         throw new \InvalidArgumentException('$role is expected to be of type string or Gobline\\Acl\\Role');
     }
     foreach ($this->parents as $parent) {
         if ($role->equals($parent)) {
             return true;
         }
         if ($parent->inherits($role)) {
             return true;
         }
     }
     return false;
 }