You are here

class PassConfig in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dependency-injection/Compiler/PassConfig.php \Symfony\Component\DependencyInjection\Compiler\PassConfig

Compiler Pass Configuration.

This class has a default configuration embedded.

@author Johannes M. Schmitt <schmittjoh@gmail.com>

Hierarchy

  • class \Symfony\Component\DependencyInjection\Compiler\PassConfig

Expanded class hierarchy of PassConfig

2 files declare their use of PassConfig
ContainerBuilder.php in vendor/symfony/dependency-injection/ContainerBuilder.php
CoreServiceProvider.php in core/lib/Drupal/Core/CoreServiceProvider.php
Contains \Drupal\Core\CoreServiceProvider.

File

vendor/symfony/dependency-injection/Compiler/PassConfig.php, line 23

Namespace

Symfony\Component\DependencyInjection\Compiler
View source
class PassConfig {
  const TYPE_AFTER_REMOVING = 'afterRemoving';
  const TYPE_BEFORE_OPTIMIZATION = 'beforeOptimization';
  const TYPE_BEFORE_REMOVING = 'beforeRemoving';
  const TYPE_OPTIMIZE = 'optimization';
  const TYPE_REMOVE = 'removing';
  private $mergePass;
  private $afterRemovingPasses = array();
  private $beforeOptimizationPasses = array();
  private $beforeRemovingPasses = array();
  private $optimizationPasses;
  private $removingPasses;

  /**
   * Constructor.
   */
  public function __construct() {
    $this->mergePass = new MergeExtensionConfigurationPass();
    $this->optimizationPasses = array(
      new ExtensionCompilerPass(),
      new ResolveDefinitionTemplatesPass(),
      new DecoratorServicePass(),
      new ResolveParameterPlaceHoldersPass(),
      new CheckDefinitionValidityPass(),
      new ResolveReferencesToAliasesPass(),
      new ResolveInvalidReferencesPass(),
      new AnalyzeServiceReferencesPass(true),
      new CheckCircularReferencesPass(),
      new CheckReferenceValidityPass(),
    );
    $this->removingPasses = array(
      new RemovePrivateAliasesPass(),
      new RemoveAbstractDefinitionsPass(),
      new ReplaceAliasByActualDefinitionPass(),
      new RepeatedPass(array(
        new AnalyzeServiceReferencesPass(),
        new InlineServiceDefinitionsPass(),
        new AnalyzeServiceReferencesPass(),
        new RemoveUnusedDefinitionsPass(),
      )),
      new CheckExceptionOnInvalidReferenceBehaviorPass(),
    );
  }

  /**
   * Returns all passes in order to be processed.
   *
   * @return array An array of all passes to process
   */
  public function getPasses() {
    return array_merge(array(
      $this->mergePass,
    ), $this->beforeOptimizationPasses, $this->optimizationPasses, $this->beforeRemovingPasses, $this->removingPasses, $this->afterRemovingPasses);
  }

  /**
   * Adds a pass.
   *
   * @param CompilerPassInterface $pass A Compiler pass
   * @param string                $type The pass type
   *
   * @throws InvalidArgumentException when a pass type doesn't exist
   */
  public function addPass(CompilerPassInterface $pass, $type = self::TYPE_BEFORE_OPTIMIZATION) {
    $property = $type . 'Passes';
    if (!isset($this->{$property})) {
      throw new InvalidArgumentException(sprintf('Invalid type "%s".', $type));
    }
    $passes =& $this->{$property};
    $passes[] = $pass;
  }

  /**
   * Gets all passes for the AfterRemoving pass.
   *
   * @return array An array of passes
   */
  public function getAfterRemovingPasses() {
    return $this->afterRemovingPasses;
  }

  /**
   * Gets all passes for the BeforeOptimization pass.
   *
   * @return array An array of passes
   */
  public function getBeforeOptimizationPasses() {
    return $this->beforeOptimizationPasses;
  }

  /**
   * Gets all passes for the BeforeRemoving pass.
   *
   * @return array An array of passes
   */
  public function getBeforeRemovingPasses() {
    return $this->beforeRemovingPasses;
  }

  /**
   * Gets all passes for the Optimization pass.
   *
   * @return array An array of passes
   */
  public function getOptimizationPasses() {
    return $this->optimizationPasses;
  }

  /**
   * Gets all passes for the Removing pass.
   *
   * @return array An array of passes
   */
  public function getRemovingPasses() {
    return $this->removingPasses;
  }

  /**
   * Gets all passes for the Merge pass.
   *
   * @return array An array of passes
   */
  public function getMergePass() {
    return $this->mergePass;
  }

  /**
   * Sets the Merge Pass.
   *
   * @param CompilerPassInterface $pass The merge pass
   */
  public function setMergePass(CompilerPassInterface $pass) {
    $this->mergePass = $pass;
  }

  /**
   * Sets the AfterRemoving passes.
   *
   * @param array $passes An array of passes
   */
  public function setAfterRemovingPasses(array $passes) {
    $this->afterRemovingPasses = $passes;
  }

  /**
   * Sets the BeforeOptimization passes.
   *
   * @param array $passes An array of passes
   */
  public function setBeforeOptimizationPasses(array $passes) {
    $this->beforeOptimizationPasses = $passes;
  }

  /**
   * Sets the BeforeRemoving passes.
   *
   * @param array $passes An array of passes
   */
  public function setBeforeRemovingPasses(array $passes) {
    $this->beforeRemovingPasses = $passes;
  }

  /**
   * Sets the Optimization passes.
   *
   * @param array $passes An array of passes
   */
  public function setOptimizationPasses(array $passes) {
    $this->optimizationPasses = $passes;
  }

  /**
   * Sets the Removing passes.
   *
   * @param array $passes An array of passes
   */
  public function setRemovingPasses(array $passes) {
    $this->removingPasses = $passes;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PassConfig::$afterRemovingPasses private property
PassConfig::$beforeOptimizationPasses private property
PassConfig::$beforeRemovingPasses private property
PassConfig::$mergePass private property
PassConfig::$optimizationPasses private property
PassConfig::$removingPasses private property
PassConfig::addPass public function Adds a pass.
PassConfig::getAfterRemovingPasses public function Gets all passes for the AfterRemoving pass.
PassConfig::getBeforeOptimizationPasses public function Gets all passes for the BeforeOptimization pass.
PassConfig::getBeforeRemovingPasses public function Gets all passes for the BeforeRemoving pass.
PassConfig::getMergePass public function Gets all passes for the Merge pass.
PassConfig::getOptimizationPasses public function Gets all passes for the Optimization pass.
PassConfig::getPasses public function Returns all passes in order to be processed.
PassConfig::getRemovingPasses public function Gets all passes for the Removing pass.
PassConfig::setAfterRemovingPasses public function Sets the AfterRemoving passes.
PassConfig::setBeforeOptimizationPasses public function Sets the BeforeOptimization passes.
PassConfig::setBeforeRemovingPasses public function Sets the BeforeRemoving passes.
PassConfig::setMergePass public function Sets the Merge Pass.
PassConfig::setOptimizationPasses public function Sets the Optimization passes.
PassConfig::setRemovingPasses public function Sets the Removing passes.
PassConfig::TYPE_AFTER_REMOVING constant
PassConfig::TYPE_BEFORE_OPTIMIZATION constant
PassConfig::TYPE_BEFORE_REMOVING constant
PassConfig::TYPE_OPTIMIZE constant
PassConfig::TYPE_REMOVE constant
PassConfig::__construct public function Constructor.