Skip to content

Commit 2b79c9e

Browse files
authored
Merge pull request #3 from Aryan-R-Patel/fix/linting-errors
fix: use phpcbf to fix linting errors
2 parents 58f749f + 2376947 commit 2b79c9e

2 files changed

Lines changed: 14 additions & 19 deletions

File tree

islandora_iiif_hocr_extend.module

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* Contains hello_world.module.
66
*/
77

8-
use Drupal\Core\Routing\RouteMatchInterface;
98
use Drupal\views\ViewExecutable;
9+
1010
/**
1111
* Implements hook_page_attachments().
1212
*/
@@ -23,14 +23,15 @@ function islandora_iiif_hocr_extend_views_pre_view(ViewExecutable $view, $displa
2323
$paramList = \Drupal::request()->query->all();
2424
if (array_key_exists('a', $paramList)) {
2525
$filters = $view->getHandlers('filter');
26-
foreach (array_keys($filters) as $key => $filter) {
27-
if (strpos($filter, "model") !== false
28-
&& isset($filters[$filter]["value"]["value"])
29-
&& $filters[$filter]["value"]["value"] === "Page" ) {
26+
// phpcs:ignore -- Unused variable $key.
27+
foreach (array_keys($filters) as $key => $filter) {
28+
if (strpos($filter, "model") !== FALSE
29+
&& isset($filters[$filter]["value"]["value"])
30+
&& $filters[$filter]["value"]["value"] === "Page") {
3031
unset($filters[$filter]);
31-
}
32+
}
3233
}
3334
$view->display_handler->overrideOption('filters', $filters);
3435
}
35-
}
36+
}
3637
}

src/Plugin/search_api/processor/HOCRFieldExtracted.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,9 @@
33
namespace Drupal\islandora_iiif_hocr_extend\Plugin\search_api\processor;
44

55
use Drupal\Core\Entity\EntityTypeManagerInterface;
6-
use Drupal\Core\Session\AnonymousUserSession;
7-
use Drupal\file\FileInterface;
8-
use Drupal\islandora_hocr\Plugin\search_api\processor\Property\HOCRFieldProperty;
9-
use Drupal\media\Plugin\media\Source\File;
106
use Drupal\node\NodeInterface;
11-
use Drupal\search_api\Datasource\DatasourceInterface;
127
use Drupal\search_api\Item\ItemInterface;
138
use Drupal\search_api\Plugin\PluginFormTrait;
14-
use Drupal\search_api\Processor\ProcessorPluginBase;
159
use Drupal\search_api\SearchApiException;
1610
use Drupal\islandora_hocr\Plugin\search_api\processor\HOCRField;
1711
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -56,7 +50,6 @@ public static function create(ContainerInterface $container, array $configuratio
5650

5751
/**
5852
* {@inheritDoc}
59-
*
6053
*/
6154
public function addFieldValues(ItemInterface $item) {
6255
try {
@@ -109,20 +102,21 @@ public function addFieldValues(ItemInterface $item) {
109102
// populated.
110103
$content = $info['callable']();
111104

112-
// Null check to only process if content is not NULL
113-
if($content !== NULL) {
114-
// strip all tags of xml
105+
// Null check to only process if content is not NULL.
106+
if ($content !== NULL) {
107+
// Strip all tags of xml.
115108
$cleaned = \strip_tags($content);
116109

117-
// remove white space and new line after strip_tags
110+
// Remove white space and new line after strip_tags.
118111
$cleaned = preg_replace('/\s+/', ' ', $cleaned);
119112

120-
// remove if any "- ", if there is
113+
// Remove if any "- ", if there is.
121114
$cleaned = str_replace('- ', '', $cleaned);
122115
$field->addValue($cleaned);
123116
}
124117
}
125118
}
126119
}
127120
}
121+
128122
}

0 commit comments

Comments
 (0)