Further modules included.
[yaffs-website] / web / modules / contrib / drupalmoduleupgrader / src / ArrayIndexer.php
1 <?php
2
3 namespace Drupal\drupalmoduleupgrader;
4
5 abstract class ArrayIndexer extends IndexerBase {
6
7   protected $elements = [];
8
9   /**
10    * {@inheritdoc}
11    */
12   final public function hasAny(array $keys) {
13     foreach ($keys as $key) {
14       if ($this->count($key)) {
15         return TRUE;
16       }
17     }
18     return FALSE;
19   }
20
21   /**
22    * {@inheritdoc}
23    */
24   final public function hasAll(array $keys) {
25     foreach ($keys as $key) {
26       if ($this->count($key) == 0) {
27         return FALSE;
28       }
29     }
30     return TRUE;
31   }
32
33   /**
34    * {@inheritdoc}
35    */
36   final public function get($key) {
37     return $this->elements[$key];
38   }
39
40   /**
41    * {@inheritdoc}
42    */
43   final public function getMultiple(array $keys) {
44     $values = array();
45
46     foreach ($keys as $key) {
47       if (array_key_exists($key, $this->elements)) {
48         $values[$key] = $this->get($key);
49       }
50     }
51
52     return $values;
53   }
54
55   /**
56    * {@inheritdoc}
57    */
58   final public function getAll() {
59     return $this->elements;
60   }
61
62 }