You are here

class EnforcedResponseException in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Form/EnforcedResponseException.php \Drupal\Core\Form\EnforcedResponseException

Custom exception to break out of the main request and enforce a response.

Hierarchy

Expanded class hierarchy of EnforcedResponseException

2 files declare their use of EnforcedResponseException
FormBuilderTest.php in core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php
Contains \Drupal\Tests\Core\Form\FormBuilderTest.
HtmlResponseAttachmentsProcessor.php in core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php
Contains \Drupal\Core\Render\HtmlResponseAttachmentsProcessor.

File

core/lib/Drupal/Core/Form/EnforcedResponseException.php, line 15
Contains \Drupal\Core\Form\EnforcedResponseException.

Namespace

Drupal\Core\Form
View source
class EnforcedResponseException extends \Exception {

  /**
   * The response to be enforced.
   *
   * @var \Symfony\Component\HttpFoundation\Response
   */
  protected $response;

  /**
   * Constructs a new enforced response exception.
   *
   * @param \Symfony\Component\HttpFoundation\Response $response
   *   The response to be enforced.
   * @param string $message
   *   (optional) The exception message.
   * @param int $code
   *   (optional) A user defined exception code.
   * @param \Exception $previous
   *   (optional) The previous exception for nested exceptions
   */
  public function __construct(Response $response, $message = "", $code = 0, \Exception $previous = NULL) {
    parent::__construct($message, $code, $previous);
    $this->response = $response;
  }

  /**
   * Return the response to be enforced.
   *
   * @returns \Symfony\Component\HttpFoundation\Response $response
   *   The response to be enforced.
   */
  public function getResponse() {
    return $this->response;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EnforcedResponseException::$response protected property The response to be enforced.
EnforcedResponseException::getResponse public function Return the response to be enforced.
EnforcedResponseException::__construct public function Constructs a new enforced response exception.