You are here

interface DebuggerInterface in Acquia Purge 8

Describes a centralized debugger for Acquia purger plugins.

Hierarchy

Expanded class hierarchy of DebuggerInterface

All classes that implement DebuggerInterface

4 files declare their use of DebuggerInterface
BackendBase.php in src/AcquiaPlatformCdn/BackendBase.php
BackendFactory.php in src/AcquiaPlatformCdn/BackendFactory.php
BackendInterface.php in src/AcquiaPlatformCdn/BackendInterface.php
FastlyBackend.php in src/AcquiaPlatformCdn/FastlyBackend.php

File

src/Plugin/Purge/Purger/DebuggerInterface.php, line 13

Namespace

Drupal\acquia_purge\Plugin\Purge\Purger
View source
interface DebuggerInterface extends PurgeLoggerAwareInterface {

  /**
   * Construct a debugger.
   *
   * @param \Drupal\purge\Logger\LoggerChannelPartInterface $logger
   *   The logger passed to the Platform CDN purger.
   */
  public function __construct(LoggerChannelPartInterface $logger);

  /**
   * Register the current caller to the callgraph.
   *
   * @param string|object $caller
   *   Fully namespaced class string or instantiated object.
   */
  public function callerAdd($caller);

  /**
   * Remove the current caller from the callgraph.
   *
   * @param string|object $caller
   *   Fully namespaced class string or instantiated object.
   */
  public function callerRemove($caller);

  /**
   * Check whether the debugger is enabled or not.
   *
   * The debugger is enabled when both the logging channel passed to the
   * purger instantiating this debugger, yields true on ::isDebuggingEnabled()
   * and when php_sapi_name() returns 'cli'. Under other conditions debugging
   * is considered disabled.
   *
   * @return bool
   *   TRUE when debugging is considered enabled, FALSE otherwise.
   */
  public function enabled();

  /**
   * Generate a short and readable class name.
   *
   * @param string|object $caller
   *   Fully namespaced class string or instantiated object.
   *
   * @return string
   *   String describing the class name to the user.
   */
  public function extractClassName($caller);

  /**
   * Extract information from a request.
   *
   * @param \Psr\Http\Message\RequestInterface $request
   *   The HTTP request object.
   * @param bool $body_title
   *   Whether the request body should be a titled array key.
   *
   * @return string[]
   *   Tabular information which could be fed to ::writeTable().
   */
  public function extractRequestInfo(RequestInterface $request, $body_title = FALSE);

  /**
   * Extract information from a response.
   *
   * @param \Psr\Http\Message\ResponseInterface $response
   *   The HTTP response object.
   * @param bool $body_title
   *   Whether the respone body should be a titled array key.
   *
   * @return string[]
   *   Tabular information which could be fed to ::writeTable().
   */
  public function extractResponseInfo(ResponseInterface $response, $body_title = FALSE);

  /**
   * Log the given failure with as much info as possible.
   *
   * @param \Exception $exception
   *   The exception thrown in the request execution code path.
   */
  public function logFailedRequest(\Exception $exception);

  /**
   * Write to Drupal's debug output.
   *
   * @param string $line
   *   Arbitrary log output, without prefix.
   *
   * @throws \LogicException
   *   Thrown when the debugger isn't enabled.
   */
  public function write($line);

  /**
   * Write out a separator line to Drupal's debug output.
   *
   * @param string $separator
   *   The separation character to use.
   *
   * @throws \LogicException
   *   Thrown when the debugger isn't enabled.
   */
  public function writeSeparator($separator = '-');

  /**
   * Write tabular data rendered as table to Drupal's debug output.
   *
   * @param mixed[] $table
   *   Associative array with each key being the row title, when the array key
   *   is an integer, the row will be fully used. Non-string data will be
   *   rendered using json_encode().
   * @param string $title
   *   Optional title to render above the table content.
   *
   * @throws \LogicException
   *   Thrown when the debugger isn't enabled.
   */
  public function writeTable(array $table, $title = NULL);

  /**
   * Write a header title.
   *
   * @param string $title
   *   Title to render in the center of the string buffer.
   * @param bool $top
   *   Whether to include a top separator line.
   * @param bool $bottom
   *   Whether to include a bottom separator line.
   *
   * @throws \LogicException
   *   Thrown when the debugger isn't enabled.
   */
  public function writeTitle($title, $top = TRUE, $bottom = TRUE);

}

Members

Namesort descending Modifiers Type Description Overrides
DebuggerInterface::callerAdd public function Register the current caller to the callgraph. 1
DebuggerInterface::callerRemove public function Remove the current caller from the callgraph. 1
DebuggerInterface::enabled public function Check whether the debugger is enabled or not. 1
DebuggerInterface::extractClassName public function Generate a short and readable class name. 1
DebuggerInterface::extractRequestInfo public function Extract information from a request. 1
DebuggerInterface::extractResponseInfo public function Extract information from a response. 1
DebuggerInterface::logFailedRequest public function Log the given failure with as much info as possible. 1
DebuggerInterface::write public function Write to Drupal's debug output. 1
DebuggerInterface::writeSeparator public function Write out a separator line to Drupal's debug output. 1
DebuggerInterface::writeTable public function Write tabular data rendered as table to Drupal's debug output. 1
DebuggerInterface::writeTitle public function Write a header title. 1
DebuggerInterface::__construct public function Construct a debugger. 1
PurgeLoggerAwareInterface::logger public function Return the part logger.