]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/Tools/SearchOptions.php
Reverted shift change to old migration
[bookstack] / app / Entities / Tools / SearchOptions.php
index 60e3a9b7876d971edd29c681643ec58a0fbab09d..5ce64cc65048c38cc142665165bf3073e7a0c3a0 100644 (file)
@@ -1,10 +1,11 @@
-<?php namespace BookStack\Entities\Tools;
+<?php
+
+namespace BookStack\Entities\Tools;
 
 use Illuminate\Http\Request;
 
 class SearchOptions
 {
-
     /**
      * @var array
      */
@@ -28,13 +29,14 @@ class SearchOptions
     /**
      * Create a new instance from a search string.
      */
-    public static function fromString(string $search): SearchOptions
+    public static function fromString(string $search): self
     {
         $decoded = static::decode($search);
         $instance = new static();
         foreach ($decoded as $type => $value) {
             $instance->$type = $value;
         }
+
         return $instance;
     }
 
@@ -43,7 +45,7 @@ class SearchOptions
      * Will look for a classic string term and use that
      * Otherwise we'll use the details from an advanced search form.
      */
-    public static function fromRequest(Request $request): SearchOptions
+    public static function fromRequest(Request $request): self
     {
         if (!$request->has('search') && !$request->has('term')) {
             return static::fromString('');
@@ -67,6 +69,7 @@ class SearchOptions
         if (isset($inputs['types']) && count($inputs['types']) < 4) {
             $instance->filters['type'] = implode('|', $inputs['types']);
         }
+
         return $instance;
     }
 
@@ -77,15 +80,15 @@ class SearchOptions
     {
         $terms = [
             'searches' => [],
-            'exacts' => [],
-            'tags' => [],
-            'filters' => []
+            'exacts'   => [],
+            'tags'     => [],
+            'filters'  => [],
         ];
 
         $patterns = [
-            'exacts' => '/"(.*?)"/',
-            'tags' => '/\[(.*?)\]/',
-            'filters' => '/\{(.*?)\}/'
+            'exacts'  => '/"(.*?)"/',
+            'tags'    => '/\[(.*?)\]/',
+            'filters' => '/\{(.*?)\}/',
         ];
 
         // Parse special terms
@@ -137,5 +140,4 @@ class SearchOptions
 
         return $string;
     }
-
-}
\ No newline at end of file
+}