Firesphere /
silverstripe-fluent-solr
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Class FluentDocumentExtension|Firesphere\SolrFluent\Extensions\FluentDocumentExtension Add Fluent filtering |
||
| 4 | * to queries |
||
| 5 | * |
||
| 6 | * @package Firesphere\Solr\Fluent |
||
| 7 | * @author Simon `Firesphere` Erkelens; Marco `Sheepy` Hermo |
||
| 8 | * @copyright Copyright (c) 2018 - now() Firesphere & Sheepy |
||
| 9 | */ |
||
| 10 | |||
| 11 | namespace Firesphere\SolrFluent\Extensions; |
||
| 12 | |||
| 13 | use Firesphere\SolrSearch\Factories\DocumentFactory; |
||
| 14 | use SilverStripe\Core\Extension; |
||
| 15 | use TractorCow\Fluent\State\FluentState; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Class Firesphere\SolrFluent\Extensions\FluentDocumentExtension |
||
| 19 | * |
||
| 20 | * Update Documents per locale |
||
| 21 | * |
||
| 22 | * @package Firesphere\Solr\Fluent |
||
| 23 | * @property DocumentFactory|FluentDocumentExtension $owner |
||
| 24 | */ |
||
| 25 | class FluentDocumentExtension extends Extension |
||
| 26 | { |
||
| 27 | /** |
||
| 28 | * Update the Solr field for the value to use the locale name |
||
| 29 | * |
||
| 30 | * @param array $field |
||
| 31 | * @param string $value |
||
| 32 | */ |
||
| 33 | 1 | public function onBeforeAddDoc(&$field, &$value): void |
|
|
0 ignored issues
–
show
|
|||
| 34 | { |
||
| 35 | 1 | $fluentState = FluentState::singleton(); |
|
| 36 | /** @var string $locale */ |
||
| 37 | 1 | $locale = $fluentState->getLocale(); |
|
| 38 | 1 | if ($locale) { |
|
| 39 | 1 | $field['name'] .= '_' . $locale; |
|
| 40 | } |
||
| 41 | 1 | } |
|
| 42 | } |
||
| 43 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.