You are here

trait DebuggerAwareTrait in Acquia Purge 8

Provides a Acquia purger which is debugging aware.

Hierarchy

2 files declare their use of DebuggerAwareTrait
BackendBase.php in src/AcquiaPlatformCdn/BackendBase.php
DebuggerMiddleware.php in src/Http/DebuggerMiddleware.php

File

src/Plugin/Purge/Purger/DebuggerAwareTrait.php, line 10

Namespace

Drupal\acquia_purge\Plugin\Purge\Purger
View source
trait DebuggerAwareTrait {
  use PurgeLoggerAwareTrait;

  /**
   * The debugger instance.
   *
   * @var null|\Drupal\acquia_purge\Plugin\Purge\Purger\DebuggerInterface
   */
  private $debuggerInstance = NULL;

  /**
   * {@inheritdoc}
   */
  public function debugger() {
    if (is_null($this->debuggerInstance)) {
      $this->debuggerInstance = new Debugger($this
        ->logger());
    }
    return $this->debuggerInstance;
  }

  /**
   * {@inheritdoc}
   */
  public function setDebugger(DebuggerInterface $debugger, $throw = TRUE) {
    if ($throw && !is_null($this->debuggerInstance)) {
      throw new \RuntimeException("Debugger already instantiated!");
    }
    $this->debuggerInstance = $debugger;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DebuggerAwareTrait::$debuggerInstance private property The debugger instance.
DebuggerAwareTrait::debugger public function
DebuggerAwareTrait::setDebugger public function
PurgeLoggerAwareTrait::$logger protected property Channel logger.
PurgeLoggerAwareTrait::logger public function