]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/Entity.php
Missed a variable when updating LdapService.
[bookstack] / app / Entities / Entity.php
index 5013c39cfcf2bf309f1931594ebe702dd00dc44c..cc7df46d4f653e201f9ba17c72a09c0b45046577 100644 (file)
@@ -201,12 +201,10 @@ class Entity extends Ownable
     }
 
     /**
-     * Allows checking of the exact class, Used to check entity type.
-     * Cleaner method for is_a.
-     * @param $type
-     * @return bool
+     * Check if this instance or class is a certain type of entity.
+     * Examples of $type are 'page', 'book', 'chapter'
      */
-    public static function isA($type)
+    public static function isA(string $type): bool
     {
         return static::getType() === strtolower($type);
     }
@@ -238,10 +236,8 @@ class Entity extends Ownable
 
     /**
      * Gets a limited-length version of the entities name.
-     * @param int $length
-     * @return string
      */
-    public function getShortName($length = 25)
+    public function getShortName(int $length = 25): string
     {
         if (mb_strlen($this->name) <= $length) {
             return $this->name;
@@ -288,7 +284,7 @@ class Entity extends Ownable
     public function rebuildPermissions()
     {
         /** @noinspection PhpUnhandledExceptionInspection */
-        Permissions::buildJointPermissionsForEntity($this);
+        Permissions::buildJointPermissionsForEntity(clone $this);
     }
 
     /**
@@ -297,7 +293,7 @@ class Entity extends Ownable
     public function indexForSearch()
     {
         $searchService = app()->make(SearchService::class);
-        $searchService->indexEntity($this);
+        $searchService->indexEntity(clone $this);
     }
 
     /**