Apply fixes from StyleCI

This commit is contained in:
StyleCI Bot 2023-10-18 12:26:10 +00:00
parent 54148ab1ad
commit 69003373a9
No known key found for this signature in database
GPG Key ID: E4A5316DFBB23575
14 changed files with 148 additions and 38 deletions

View File

@ -22,7 +22,7 @@ return [
(new Flarum\Frontend('admin'))
->js(__DIR__.'/js/dist/admin.js'),
(new Flarum\Locales(__DIR__.'/resources/locale')),
new Flarum\Locales(__DIR__.'/resources/locale'),
(new Flarum\ServiceProvider())
->register(Provider::class),

View File

@ -12,6 +12,7 @@
namespace Blomstra\Search\Api\Controllers;
use Blomstra\Search\Elasticsearch\Builder;
use Blomstra\Search\Elasticsearch\MatchPhraseQuery;
use Blomstra\Search\Elasticsearch\MatchQuery;
use Blomstra\Search\Elasticsearch\TermsQuery;
@ -32,7 +33,6 @@ use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Psr\Http\Message\ServerRequestInterface;
use Blomstra\Search\Elasticsearch\Builder;
use Spatie\ElasticsearchQueryBuilder\Queries\BoolQuery;
use Spatie\ElasticsearchQueryBuilder\Queries\Query;
use Spatie\ElasticsearchQueryBuilder\Queries\TermQuery;

View File

@ -13,6 +13,7 @@
namespace Blomstra\Search\Commands;
use Blomstra\Search\Discussion\DiscussionIndexer;
use Blomstra\Search\Elasticsearch\Builder;
use Blomstra\Search\Post\CommentPostIndexer;
use Elasticsearch\Client;
use Flarum\Discussion\Discussion;
@ -24,7 +25,6 @@ use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\Queue\Queue;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Arr;
use Blomstra\Search\Elasticsearch\Builder;
use Spatie\ElasticsearchQueryBuilder\Queries\BoolQuery;
use Spatie\ElasticsearchQueryBuilder\Queries\RangeQuery;

View File

@ -1,5 +1,15 @@
<?php
/*
* This file is part of blomstra/search.
*
* Copyright (c) 2022 Blomstra Ltd.
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*
*/
namespace Blomstra\Search\Discussion;
use Blomstra\Search\Save\Document;
@ -34,12 +44,12 @@ class DiscussionIndexer implements IndexerInterface
$this->elastic->delete(self::index(), $models);
}
function build(): void
public function build(): void
{
$this->elastic->build(self::index(), $this->properties());
}
function flush(): void
public function flush(): void
{
$this->elastic->flush(self::index());
}

View File

@ -1,5 +1,15 @@
<?php
/*
* This file is part of blomstra/search.
*
* Copyright (c) 2022 Blomstra Ltd.
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*
*/
namespace Blomstra\Search\Discussion;
use Blomstra\Search\Post\CommentPostIndexer;
@ -15,7 +25,7 @@ class DiscussionSearcher extends Searcher
return DiscussionIndexer::index().','.CommentPostIndexer::index();
}
function getQuery(User $actor): Builder
public function getQuery(User $actor): Builder
{
return Discussion::whereVisibleTo($actor)->select('discussions.*');
}

View File

@ -1,7 +1,18 @@
<?php
/*
* This file is part of blomstra/search.
*
* Copyright (c) 2022 Blomstra Ltd.
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*
*/
namespace Blomstra\Search\Discussion;
use Blomstra\Search\Elasticsearch\Builder;
use Blomstra\Search\Elasticsearch\MatchPhraseQuery;
use Blomstra\Search\Elasticsearch\MatchQuery;
use Blomstra\Search\Elasticsearch\TermsQuery;
@ -19,7 +30,6 @@ use Illuminate\Support\Collection;
use Spatie\ElasticsearchQueryBuilder\Aggregations\FilterAggregation;
use Spatie\ElasticsearchQueryBuilder\Aggregations\TermsAggregation;
use Spatie\ElasticsearchQueryBuilder\Aggregations\TopHitsAggregation;
use Blomstra\Search\Elasticsearch\Builder;
use Spatie\ElasticsearchQueryBuilder\Queries\BoolQuery;
use Spatie\ElasticsearchQueryBuilder\Queries\Query;
use Spatie\ElasticsearchQueryBuilder\Sorts\Sort;

View File

@ -1,5 +1,15 @@
<?php
/*
* This file is part of blomstra/search.
*
* Copyright (c) 2022 Blomstra Ltd.
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*
*/
namespace Blomstra\Search\Discussion;
use Blomstra\Search\Elasticsearch\TermsQuery;

View File

@ -1,5 +1,15 @@
<?php
/*
* This file is part of blomstra/search.
*
* Copyright (c) 2022 Blomstra Ltd.
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*
*/
namespace Blomstra\Search\Elasticsearch;
class Builder extends \Spatie\ElasticsearchQueryBuilder\Builder

View File

@ -1,5 +1,15 @@
<?php
/*
* This file is part of blomstra/search.
*
* Copyright (c) 2022 Blomstra Ltd.
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*
*/
namespace Blomstra\Search\Post;
use Blomstra\Search\Save\Document;
@ -25,7 +35,7 @@ class CommentPostIndexer implements IndexerInterface
return 'posts';
}
function save(array $models): void
public function save(array $models): void
{
$this->elastic->save(
self::index(),
@ -34,7 +44,7 @@ class CommentPostIndexer implements IndexerInterface
);
}
function delete(array $models): void
public function delete(array $models): void
{
$this->elastic->delete(
self::index(),

View File

@ -1,5 +1,15 @@
<?php
/*
* This file is part of blomstra/search.
*
* Copyright (c) 2022 Blomstra Ltd.
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*
*/
namespace Blomstra\Search\Search\Concerns;
use Flarum\Discussion\Discussion;

View File

@ -1,5 +1,15 @@
<?php
/*
* This file is part of blomstra/search.
*
* Copyright (c) 2022 Blomstra Ltd.
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*
*/
namespace Blomstra\Search\Search;
use Blomstra\Search\Exceptions\IndexingException;
@ -29,8 +39,8 @@ class ElasticIndex
[
'index' => [
'_index' => $index,
'_id' => $document->id
]
'_id' => $document->id,
],
],
$document->toArray(),
];
@ -55,8 +65,8 @@ class ElasticIndex
[
'delete' => [
'_index' => $index(),
'_id' => $model->id
]
'_id' => $model->id,
],
],
];
})->flatten(1);

View File

@ -1,5 +1,15 @@
<?php
/*
* This file is part of blomstra/search.
*
* Copyright (c) 2022 Blomstra Ltd.
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*
*/
namespace Blomstra\Search\Search;
use Flarum\Search\AbstractDriver;

View File

@ -1,10 +1,20 @@
<?php
/*
* This file is part of blomstra/search.
*
* Copyright (c) 2022 Blomstra Ltd.
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*
*/
namespace Blomstra\Search\Search;
use Blomstra\Search\Elasticsearch\Builder;
use Closure;
use Flarum\Search\SearchState;
use Blomstra\Search\Elasticsearch\Builder;
class ElasticSearchState extends SearchState
{

View File

@ -1,7 +1,18 @@
<?php
/*
* This file is part of blomstra/search.
*
* Copyright (c) 2022 Blomstra Ltd.
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*
*/
namespace Blomstra\Search\Search;
use Blomstra\Search\Elasticsearch\Builder;
use Elasticsearch\Client;
use Flarum\Search\Filter\FilterManager;
use Flarum\Search\SearchCriteria;
@ -10,7 +21,6 @@ use Flarum\Search\SearchResults;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Blomstra\Search\Elasticsearch\Builder;
use Spatie\ElasticsearchQueryBuilder\Sorts\Sort;
abstract class Searcher implements SearcherInterface