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