You are here

private function Context::containsArray in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/sebastian/recursion-context/src/Context.php \SebastianBergmann\RecursionContext\Context::containsArray()

Parameters

array $array:

Return value

int|false

2 calls to Context::containsArray()
Context::addArray in vendor/sebastian/recursion-context/src/Context.php
Context::contains in vendor/sebastian/recursion-context/src/Context.php
Checks if the given value exists within the context.

File

vendor/sebastian/recursion-context/src/Context.php, line 121

Class

Context
A context containing previously processed arrays and objects when recursively processing a value.

Namespace

SebastianBergmann\RecursionContext

Code

private function containsArray(array &$array) {
  $keys = array_keys($this->arrays, $array, true);
  $hash = '_Key_' . hash('sha512', microtime(true));
  foreach ($keys as $key) {
    $this->arrays[$key][$hash] = $hash;
    if (isset($array[$hash]) && $array[$hash] === $hash) {
      unset($this->arrays[$key][$hash]);
      return $key;
    }
    unset($this->arrays[$key][$hash]);
  }
  return false;
}