ArrayIndexer.php in Drupal 7 to 8/9 Module Upgrader 8
File
src/ArrayIndexer.php
View source
<?php
namespace Drupal\drupalmoduleupgrader;
abstract class ArrayIndexer extends IndexerBase {
protected $elements = [];
public final function hasAny(array $keys) {
foreach ($keys as $key) {
if ($this
->count($key)) {
return TRUE;
}
}
return FALSE;
}
public final function hasAll(array $keys) {
foreach ($keys as $key) {
if ($this
->count($key) == 0) {
return FALSE;
}
}
return TRUE;
}
public final function get($key) {
return $this->elements[$key];
}
public final function getMultiple(array $keys) {
$values = [];
foreach ($keys as $key) {
if (array_key_exists($key, $this->elements)) {
$values[$key] = $this
->get($key);
}
}
return $values;
}
public final function getAll() {
return $this->elements;
}
}