You are here

class RefineableCompilerContext in Compiler 1.0.x

A refineable compiler context used to define a compilation.

Inputs can be modified using array access functionality provided by PHP.

Copyright (C) 2021 Library Solutions, LLC (et al.).

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Hierarchy

Expanded class hierarchy of RefineableCompilerContext

File

src/RefineableCompilerContext.php, line 17

Namespace

Drupal\compiler
View source
class RefineableCompilerContext extends CompilerContext implements RefineableCompilerContextInterface {

  /**
   * {@inheritdoc}
   */
  public function offsetExists($offset) : bool {
    return isset($this->inputs[$offset]);
  }

  /**
   * {@inheritdoc}
   */
  public function &offsetGet($offset) {
    if (isset($this->inputs[$offset])) {
      return $this->inputs[$offset];
    }
  }

  /**
   * {@inheritdoc}
   */
  public function offsetSet($offset, $value) : void {
    if (!is_null($offset)) {
      $this->inputs[$offset] = $value;
    }
    else {
      $this->inputs[] = $value;
    }
  }

  /**
   * {@inheritdoc}
   */
  public function offsetUnset($offset) : void {
    unset($this->inputs[$offset]);
  }

  /**
   * {@inheritdoc}
   */
  public function setCompiler(string $compiler) : self {
    $this->compiler = $compiler;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function setData($data) : self {
    $this->data = $data;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function setOption(string $name, $value) : self {
    $this->options[$name] = $value;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function setOptions(array $options) : self {
    $this->options = $options;
    return $this;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CompilerContext::$compiler protected property The machine name of the compiler plugin to use.
CompilerContext::$data protected property Arbitrary user-defined data to provide to the compiler.
CompilerContext::$inputs protected property An array of compiler inputs.
CompilerContext::$options protected property An associative array of compiler plugin configuration options.
CompilerContext::createIteratorForInputs protected function Create a filtered input iterator using the supplied compiler inputs.
CompilerContext::getCompiler public function Get the machine name of the compiler plugin to use. Overrides CompilerContextInterface::getCompiler
CompilerContext::getData public function Get arbitrary user-defined data to provide to the compiler. Overrides CompilerContextInterface::getData
CompilerContext::getInputs public function Get an interator containing the compiler inputs. Overrides CompilerContextInterface::getInputs
CompilerContext::getOption public function Get a specific compiler plugin configuration option. Overrides CompilerContextInterface::getOption
CompilerContext::getOptions public function Get an associative array of compiler plugin configuration options. Overrides CompilerContextInterface::getOptions
CompilerContext::__construct public function Constructs a CompilerContext object.
RefineableCompilerContext::offsetExists public function
RefineableCompilerContext::offsetGet public function
RefineableCompilerContext::offsetSet public function
RefineableCompilerContext::offsetUnset public function
RefineableCompilerContext::setCompiler public function Set the machine name of the compiler plugin to use for this context. Overrides RefineableCompilerContextInterface::setCompiler
RefineableCompilerContext::setData public function Set the user-defined data to use for this context. Overrides RefineableCompilerContextInterface::setData
RefineableCompilerContext::setOption public function Set a specific option to use for this context. Overrides RefineableCompilerContextInterface::setOption
RefineableCompilerContext::setOptions public function Set the options to use for this context. Overrides RefineableCompilerContextInterface::setOptions