Further modules included.
[yaffs-website] / web / modules / contrib / drupalmoduleupgrader / src / Plugin / DMU / Fixer / NodeCollectorTrait.php
1 <?php
2
3 /**
4  * @file
5  * Contains \Drupal\drupalmoduleupgrader\Plugin\DMU\Fixer\NodeCollectorTrait.
6  */
7
8 namespace Drupal\drupalmoduleupgrader\Plugin\DMU\Fixer;
9
10 /**
11  * Trait used by fixers which loop through existing indexer objects and do
12  * things with them.
13  */
14 trait NodeCollectorTrait {
15
16   protected function getObjects() {
17     /** @var \Pharborist\NodeCollection $objects */
18     $objects = $this->target->getIndexer($this->configuration['type'])->get($this->configuration['id']);
19
20     if (isset($this->configuration['where'])) {
21       $where = $this->configuration['where'];
22       // If the first character of the filter is an exclamation point, negate it.
23       return ($where{0} == '!' ? $objects->not(subStr($where, 1)) : $objects->filter($where));
24     }
25     else {
26       return $objects;
27     }
28   }
29
30 }