Skip to content

Commit dfb32d1

Browse files
Fix coding standards
1 parent f680fd8 commit dfb32d1

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

src/Plugin/GraphQL/Derivers/SearchAPIDocumentTypeDeriver.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
class SearchAPIDocumentTypeDeriver extends DeriverBase implements ContainerDeriverInterface {
1414

1515
/**
16+
* The entity type manager service.
17+
*
1618
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
1719
*/
1820
protected $entityTypeManager;

src/Plugin/GraphQL/Derivers/SearchAPIFieldDeriver.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
class SearchAPIFieldDeriver extends DeriverBase implements ContainerDeriverInterface {
1616

1717
/**
18+
* The entity type manager service.
19+
*
1820
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
1921
*/
2022
protected $entityTypeManager;

src/Plugin/GraphQL/Fields/SearchAPIFacetValues.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ class SearchAPIFacetValues extends FieldPluginBase {
2525
public function resolveValues($value, array $args, ResolveContext $context, ResolveInfo $info) {
2626
if (isset($value['solrFacetValues'])) {
2727
foreach ($value['solrFacetValues'] as $facet_value) {
28-
yield $facet_value;
28+
yield $facet_value;
2929
}
3030
}
3131
}
32+
3233
}

src/Plugin/GraphQL/Fields/SearchAPISearch.php

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use Drupal\Core\Entity\EntityTypeManagerInterface;
77
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
88
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
9-
use Drupal\graphql\GraphQL\Cache\CacheableValue;
109
use Drupal\graphql\Plugin\GraphQL\Fields\FieldPluginBase;
1110
use Drupal\graphql\GraphQL\Execution\ResolveContext;
1211
use GraphQL\Type\Definition\ResolveInfo;
@@ -39,16 +38,31 @@
3938
class SearchAPISearch extends FieldPluginBase implements ContainerFactoryPluginInterface {
4039

4140
/**
41+
* The entity type manager service.
42+
*
4243
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
4344
*/
4445
protected $entityTypeManager;
4546

4647
/**
48+
* The logger service.
49+
*
4750
* @var \Drupal\Core\Logger\LoggerChannelFactoryInterface
4851
*/
4952
protected $logger;
5053

54+
/**
55+
* The query object.
56+
*
57+
* @var \Drupal\views\Plugin\views\query\QueryPluginBase
58+
*/
5159
private $query;
60+
61+
/**
62+
* The search index.
63+
*
64+
* @var \Drupal\search_api\IndexInterface
65+
*/
5266
private $index;
5367

5468
/**
@@ -152,7 +166,7 @@ private function addConditionGroup($condition_group_arg) {
152166

153167
// Set default conjunction and tags.
154168
$group_conjunction = 'AND';
155-
$group_tags = array();
169+
$group_tags = [];
156170

157171
// Set conjunction from args.
158172
if (isset($group['conjunction'])) {
@@ -256,10 +270,10 @@ private function setFacets($facets) {
256270
/**
257271
* Sets MLT in the Search API query.
258272
*
259-
* @facets
273+
* @mlt_params
260274
* The MLT params to be added to the query.
261275
*/
262-
private function setMLT($mlt_params) {
276+
private function setMlt($mlt_params) {
263277

264278
// Retrieve this index server details.
265279
$server = $this->index->getServerInstance();
@@ -321,7 +335,7 @@ private function prepareSearchQuery($args) {
321335
}
322336
// Adding more like this parameters to the query.
323337
if ($args['more_like_this']) {
324-
$this->setMLT($args['more_like_this']);
338+
$this->setMlt($args['more_like_this']);
325339
}
326340
}
327341

@@ -339,7 +353,7 @@ private function getSearchResponse($results) {
339353
$search_response = [];
340354

341355
// Loop through each item in the result set.
342-
foreach ($result_items as $id => &$item) {
356+
foreach ($result_items as &$item) {
343357
// Load the response document into the search response array.
344358
$document['item'] = $item;
345359
$document['index_id'] = $this->index->id();

0 commit comments

Comments
 (0)