@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function boot() |
| 24 | 24 | { |
| 25 | - $this->mergeConfigFrom(__DIR__ . '/../../../config/search.php', 'search'); |
|
| 25 | + $this->mergeConfigFrom(__DIR__.'/../../../config/search.php', 'search'); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | $reflection = new \ReflectionClass($command); |
| 34 | 34 | $this->app->singleton( |
| 35 | - 'command.search.' . strtolower($reflection->getShortName()), |
|
| 35 | + 'command.search.'.strtolower($reflection->getShortName()), |
|
| 36 | 36 | function() use ($command) { |
| 37 | 37 | return new $command; |
| 38 | 38 | } |
@@ -47,13 +47,13 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function register() |
| 49 | 49 | { |
| 50 | - $this->publishes([ __DIR__ . '/../../../config/search.php' => config_path('search.php'), ]); |
|
| 50 | + $this->publishes([__DIR__.'/../../../config/search.php' => config_path('search.php'), ]); |
|
| 51 | 51 | |
| 52 | 52 | $this->registerCommand(Rebuild::class); |
| 53 | 53 | $this->registerCommand(Destroy::class); |
| 54 | 54 | $this->registerCommand(Optimise::class); |
| 55 | 55 | |
| 56 | - $this->commands([ 'command.search.rebuild', 'command.search.optimise', 'command.search.destroy' ]); |
|
| 56 | + $this->commands(['command.search.rebuild', 'command.search.optimise', 'command.search.destroy']); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | |
@@ -62,6 +62,6 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function provides() |
| 64 | 64 | { |
| 65 | - return [ 'search', 'command.search.rebuild', 'command.search.optimise', 'command.search.destroy' ]; |
|
| 65 | + return ['search', 'command.search.rebuild', 'command.search.optimise', 'command.search.destroy']; |
|
| 66 | 66 | } |
| 67 | 67 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | /** |
| 32 | 32 | * @var array $models |
| 33 | 33 | */ |
| 34 | - private $models = [ ]; |
|
| 34 | + private $models = []; |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * RebuildModels constructor. |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | foreach (get_declared_classes() as $class) { |
| 58 | 58 | // Ignoring PHP bug #53727 here, Eloquent Models implement several interfaces. |
| 59 | 59 | if (is_subclass_of($class, Model::class) && method_exists($class, 'searchFields')) { |
| 60 | - $models[ ] = $class; |
|
| 60 | + $models[] = $class; |
|
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | /** |
| 68 | 68 | * @param array $models |
| 69 | 69 | */ |
| 70 | - public function setModels(array $models = [ ]) |
|
| 70 | + public function setModels(array $models = []) |
|
| 71 | 71 | { |
| 72 | 72 | $this->models = $models; |
| 73 | 73 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | $this->loopModels(); |
| 93 | 93 | |
| 94 | - $this->output('comment', PHP_EOL . 'Search engine rebuild complete.'); |
|
| 94 | + $this->output('comment', PHP_EOL.'Search engine rebuild complete.'); |
|
| 95 | 95 | return $this->output; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -112,12 +112,12 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | private function rebuildModel(Model $model) |
| 114 | 114 | { |
| 115 | - $this->output('comment', 'Creating index for model [' . $model->getTable() . ']'); |
|
| 115 | + $this->output('comment', 'Creating index for model ['.$model->getTable().']'); |
|
| 116 | 116 | |
| 117 | 117 | if ($model->count() === 0) { |
| 118 | 118 | $this->output( |
| 119 | 119 | 'comment', |
| 120 | - 'No records for model [' . $model->getTable() . '].' |
|
| 120 | + 'No records for model ['.$model->getTable().'].' |
|
| 121 | 121 | ); |
| 122 | 122 | return; |
| 123 | 123 | } |
@@ -14,12 +14,12 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * @var array $searchFields |
| 16 | 16 | */ |
| 17 | - private static $searchFields = [ ]; |
|
| 17 | + private static $searchFields = []; |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * @var array $boostFeilds |
| 21 | 21 | */ |
| 22 | - private static $boostFeilds = [ ]; |
|
| 22 | + private static $boostFeilds = []; |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * Set up |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | // Ignoring PHP bug #53727 here, Eloquent Models implement several interfaces. |
| 33 | 33 | if (!is_subclass_of(static::class, Model::class)) { |
| 34 | 34 | throw new \Exception( |
| 35 | - 'SearchTrait must only be used with Eloquent models, [' . get_called_class() . '] used.' |
|
| 35 | + 'SearchTrait must only be used with Eloquent models, ['.get_called_class().'] used.' |
|
| 36 | 36 | ); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public static function setBoostFields(array $fields) |
| 76 | 76 | { |
| 77 | - if (! array_filter($fields, function($value) { |
|
| 77 | + if (!array_filter($fields, function($value) { |
|
| 78 | 78 | return is_int($value) || is_float($value); |
| 79 | 79 | })) { |
| 80 | 80 | throw new \Exception('Boost field values must be integers or floats.'); |