You are here

public function CompilerContext::__construct in Compiler 1.0.x

Constructs a CompilerContext object.

Parameters

string $compiler: The machine name of the compiler plugin to use.

array $options: An associative array of compiler plugin configuration options.

\Drupal\compiler\CompilerInputInterface[] $inputs: An array of compiler inputs.

mixed $data: Arbitrary user-defined data to provide to the compiler.

File

src/CompilerContext.php, line 57

Class

CompilerContext
A compiler context used to define a compilation.

Namespace

Drupal\compiler

Code

public function __construct(string $compiler, array $options = [], array $inputs = [], $data = NULL) {

  // Store scalar/arbitrary data directly in instance properties.
  $this->compiler = $compiler;
  $this->data = $data;
  $this->inputs = $inputs;

  // Only allow associative keys for the outer-most level of options.
  $this->options = array_filter($options, function ($key) {
    return is_string($key);
  }, ARRAY_FILTER_USE_KEY);
}