@@ -472,7 +472,7 @@ |
||
| 472 | 472 | if ($field instanceof Fluent && !is_null($field->type)) { |
| 473 | 473 | $method = 'compile' . ucfirst($this->camelize($field->type)); |
| 474 | 474 | if (method_exists($this, $method)) { |
| 475 | - $statements[$field->name] = (array)$this->$method($field); |
|
| 475 | + $statements[$field->name] = (array) $this->$method($field); |
|
| 476 | 476 | } |
| 477 | 477 | } |
| 478 | 478 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $this->filesystem = $filesystem; |
| 26 | 26 | $this->mappingLogRepository = $mappingLogRepository; |
| 27 | 27 | |
| 28 | - $this->mappingLogs = array_map(function ($log) { |
|
| 28 | + $this->mappingLogs = array_map(function($log) { |
|
| 29 | 29 | return $log['mapping']; |
| 30 | 30 | }, $this->mappingLogRepository->all()); |
| 31 | 31 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | { |
| 74 | 74 | $files = $this->filesystem->glob($path . DIRECTORY_SEPARATOR . '*.php'); |
| 75 | 75 | |
| 76 | - return array_map(function (string $file) { |
|
| 76 | + return array_map(function(string $file) { |
|
| 77 | 77 | return str_replace('.php', '', basename($file)); |
| 78 | 78 | }, $files); |
| 79 | 79 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | public function fill(Model $model, SearchResult $searchResult) |
| 20 | 20 | { |
| 21 | 21 | $searchResult->setHits( |
| 22 | - $searchResult->getHits()->map(function (array $hit) use ($model) { |
|
| 22 | + $searchResult->getHits()->map(function(array $hit) use ($model) { |
|
| 23 | 23 | return $this->fillModel($model, $hit); |
| 24 | 24 | }) |
| 25 | 25 | ); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | protected function hydrateRecursive(Model $model, array $items) |
| 126 | 126 | { |
| 127 | - return $model->newCollection(array_map(function ($item) use ($model) { |
|
| 127 | + return $model->newCollection(array_map(function($item) use ($model) { |
|
| 128 | 128 | return $this->newFromBuilderRecursive($model, $item); |
| 129 | 129 | }, $items)); |
| 130 | 130 | } |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | $traits = class_uses_recursive(get_class($model)); |
| 20 | 20 | |
| 21 | 21 | if (!isset($traits[Searchable::class])) { |
| 22 | - throw new \InvalidArgumentException(get_class($model).' does not use the searchable trait.'); |
|
| 22 | + throw new \InvalidArgumentException(get_class($model) . ' does not use the searchable trait.'); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | return true; |
@@ -39,14 +39,14 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public static function bootSearchable() |
| 41 | 41 | { |
| 42 | - static::saved(function (Model $model) { |
|
| 42 | + static::saved(function(Model $model) { |
|
| 43 | 43 | /** @var Model|Searchable $model */ |
| 44 | 44 | if ($model->shouldSyncDocument()) { |
| 45 | 45 | $model->repository()->save(/** @scrutinizer ignore-type */$model); |
| 46 | 46 | } |
| 47 | 47 | }); |
| 48 | 48 | |
| 49 | - static::deleted(function (Model $model) { |
|
| 49 | + static::deleted(function(Model $model) { |
|
| 50 | 50 | /** @var Model|Searchable $model */ |
| 51 | 51 | if ($model->shouldSyncDocument()) { |
| 52 | 52 | $model->repository()->delete(/** @scrutinizer ignore-type */$model); |
@@ -86,10 +86,10 @@ discard block |
||
| 86 | 86 | public function getDocumentType(): string |
| 87 | 87 | { |
| 88 | 88 | if (property_exists($this, 'documentType')) { |
| 89 | - return (string)$this->documentType; |
|
| 89 | + return (string) $this->documentType; |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - return (string)$this->getTable(); |
|
| 92 | + return (string) $this->getTable(); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | public function shouldSyncDocument() : bool |
| 101 | 101 | { |
| 102 | 102 | if (property_exists($this, 'syncDocument')) { |
| 103 | - return (bool)$this->syncDocument; |
|
| 103 | + return (bool) $this->syncDocument; |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | return true; |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | $this->loadMigrationsFrom(__DIR__ . '/../Resources/database/migrations'); |
| 56 | 56 | |
| 57 | 57 | $this->publishes([ |
| 58 | - __DIR__.'/Resources/database' => database_path(), |
|
| 58 | + __DIR__ . '/Resources/database' => database_path(), |
|
| 59 | 59 | ], 'database'); |
| 60 | 60 | |
| 61 | 61 | $this->commands([ |
@@ -32,12 +32,12 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | public function __construct(array $result) |
| 34 | 34 | { |
| 35 | - $this->took = (int)array_get($result, 'took'); |
|
| 36 | - $this->timedOut = (bool)array_get($result, 'timed_out'); |
|
| 37 | - $this->shards = (array)array_get($result, '_shards'); |
|
| 35 | + $this->took = (int) array_get($result, 'took'); |
|
| 36 | + $this->timedOut = (bool) array_get($result, 'timed_out'); |
|
| 37 | + $this->shards = (array) array_get($result, '_shards'); |
|
| 38 | 38 | $this->hits = new Collection(array_get($result, 'hits.hits')); |
| 39 | - $this->totalHits = (int)array_get($result, 'hits.total'); |
|
| 40 | - $this->maxScore = (float)array_get($result, 'hits.max_score'); |
|
| 39 | + $this->totalHits = (int) array_get($result, 'hits.total'); |
|
| 40 | + $this->maxScore = (float) array_get($result, 'hits.max_score'); |
|
| 41 | 41 | $this->aggregation = array_get($result, 'aggregations', null); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -48,11 +48,10 @@ |
||
| 48 | 48 | */ |
| 49 | 49 | public function handle() |
| 50 | 50 | { |
| 51 | - $mapping = $this->formatMappingName((string)$this->argument('mapping')); |
|
| 51 | + $mapping = $this->formatMappingName((string) $this->argument('mapping')); |
|
| 52 | 52 | |
| 53 | 53 | $model = $this->option('model') ? |
| 54 | - $this->formatModelName($this->option('model')) : |
|
| 55 | - null; |
|
| 54 | + $this->formatModelName($this->option('model')) : null; |
|
| 56 | 55 | |
| 57 | 56 | $this->filesystem->put( |
| 58 | 57 | $this->buildMappingFilePath($mapping), |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | foreach ($this->getModelsToSync($index) as $modelClass => $model) { |
| 44 | 44 | $this->line(sprintf('Sync index with model: %s', $modelClass)); |
| 45 | 45 | |
| 46 | - $model::chunk($chunkSize, function ($models) { |
|
| 46 | + $model::chunk($chunkSize, function($models) { |
|
| 47 | 47 | /** @var Collection $models */ |
| 48 | 48 | Leopard::repository()->bulkSave($models); |
| 49 | 49 | $this->line(sprintf('Indexing a chunk of %s documents ...', count($models))); |