You are here

protected function CompilerContext::createIteratorForInputs in Compiler 1.0.x

Create a filtered input iterator using the supplied compiler inputs.

The resulting iterator will contain a copy of the inputs at the time when this method was invoked.

Parameters

array $inputs: An (optionally nested) array of compiler inputs.

Return value

\RecursiveCallbackFilterIterator A filtered input iterator using the supplied compiler inputs.

1 call to CompilerContext::createIteratorForInputs()
CompilerContext::getInputs in src/CompilerContext.php
Get an interator containing the compiler inputs.

File

src/CompilerContext.php, line 81

Class

CompilerContext
A compiler context used to define a compilation.

Namespace

Drupal\compiler

Code

protected function createIteratorForInputs(array $inputs) : \RecursiveCallbackFilterIterator {
  $iterator = new \RecursiveArrayIterator($inputs, \RecursiveArrayIterator::CHILD_ARRAYS_ONLY);
  $iterator = new \RecursiveCallbackFilterIterator($iterator, function ($value, $key, $iterator) {
    return $iterator
      ->hasChildren() || $value instanceof CompilerInputInterface;
  });
  return $iterator;
}