]> BookStack Code Mirror - bookstack/blobdiff - app/Entity.php
Updated 'Spanish Argentina' translation.
[bookstack] / app / Entity.php
index df8e4d38b241e9928ca951697b6da392744a39e2..5d4449f2bd7817e38db5eb0284baa781c7e0858e 100644 (file)
@@ -1,13 +1,20 @@
 <?php namespace BookStack;
 
-
 use Illuminate\Database\Eloquent\Relations\MorphMany;
 
 class Entity extends Ownable
 {
 
+    /**
+     * @var string - Name of property where the main text content is found
+     */
     public $textField = 'description';
 
+    /**
+     * @var float - Multiplier for search indexing.
+     */
+    public $searchFactor = 1.0;
+
     /**
      * Compares this entity to another given entity.
      * Matches by comparing class and id.
@@ -28,7 +35,9 @@ class Entity extends Ownable
     {
         $matches = [get_class($this), $this->id] === [get_class($entity), $entity->id];
 
-        if ($matches) return true;
+        if ($matches) {
+            return true;
+        }
 
         if (($entity->isA('chapter') || $entity->isA('page')) && $this->isA('book')) {
             return $entity->book_id === $this->id;
@@ -159,7 +168,9 @@ class Entity extends Ownable
      */
     public function getShortName($length = 25)
     {
-        if (strlen($this->name) <= $length) return $this->name;
+        if (strlen($this->name) <= $length) {
+            return $this->name;
+        }
         return substr($this->name, 0, $length - 3) . '...';
     }
 
@@ -176,13 +187,18 @@ class Entity extends Ownable
      * Return a generalised, common raw query that can be 'unioned' across entities.
      * @return string
      */
-    public function entityRawQuery(){return '';}
+    public function entityRawQuery()
+    {
+        return '';
+    }
 
     /**
      * Get the url of this entity
      * @param $path
      * @return string
      */
-    public function getUrl($path){return '/';}
-
+    public function getUrl($path = '/')
+    {
+        return $path;
+    }
 }