BookStack\Entity::isA PHP Méthode

isA() public static méthode

Cleaner method for is_a.
public static isA ( $type ) : boolean
$type
Résultat boolean
    public static function isA($type)
    {
        return static::getType() === strtolower($type);
    }

Usage Example

 /**
  * Check if an entity has restrictions set on itself or its
  * parent tree.
  * @param Entity $entity
  * @param $action
  * @return bool|mixed
  */
 public function checkIfRestrictionsSet(Entity $entity, $action)
 {
     $this->currentAction = $action;
     if ($entity->isA('page')) {
         return $entity->restricted || $entity->chapter && $entity->chapter->restricted || $entity->book->restricted;
     } elseif ($entity->isA('chapter')) {
         return $entity->restricted || $entity->book->restricted;
     } elseif ($entity->isA('book')) {
         return $entity->restricted;
     }
 }
All Usage Examples Of BookStack\Entity::isA