You are here

class PolicyAlterEvent in Content-Security-Policy 8

Event for altering a response CSP Policy.

Hierarchy

  • class \Drupal\csp\Event\PolicyAlterEvent extends \Symfony\Component\EventDispatcher\Event

Expanded class hierarchy of PolicyAlterEvent

5 files declare their use of PolicyAlterEvent
CoreCspSubscriber.php in src/EventSubscriber/CoreCspSubscriber.php
CoreCspSubscriberTest.php in tests/src/Unit/EventSubscriber/CoreCspSubscriberTest.php
Ie9CspSubscriber.php in src/EventSubscriber/Ie9CspSubscriber.php
Ie9CspSubscriberTest.php in tests/src/Unit/EventSubscriber/Ie9CspSubscriberTest.php
ResponseCspSubscriber.php in src/EventSubscriber/ResponseCspSubscriber.php

File

src/Event/PolicyAlterEvent.php, line 12

Namespace

Drupal\csp\Event
View source
class PolicyAlterEvent extends Event {

  /**
   * A CSP policy.
   *
   * @var \Drupal\csp\Csp
   */
  private $policy;

  /**
   * The Response the policy is being applied to.
   *
   * @var \Symfony\Component\HttpFoundation\Response
   */
  private $response;

  /**
   * Create a new PolicyAlterEvent instance.
   *
   * @param \Drupal\csp\Csp $policy
   *   A CSP policy.
   * @param \Symfony\Component\HttpFoundation\Response $response
   *   The Response the policy is being applied to.
   */
  public function __construct(Csp $policy, Response $response) {
    $this->policy = $policy;
    $this->response = $response;
  }

  /**
   * Retrieve the defined CSP policy.
   *
   * @return \Drupal\csp\Csp
   *   The CSP policy.
   */
  public function getPolicy() {
    return $this->policy;
  }

  /**
   * Retrieve the Response the policy is applied to.
   *
   * @return \Symfony\Component\HttpFoundation\Response
   *   The Response the policy is applied to.
   */
  public function getResponse() {
    return $this->response;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PolicyAlterEvent::$policy private property A CSP policy.
PolicyAlterEvent::$response private property The Response the policy is being applied to.
PolicyAlterEvent::getPolicy public function Retrieve the defined CSP policy.
PolicyAlterEvent::getResponse public function Retrieve the Response the policy is applied to.
PolicyAlterEvent::__construct public function Create a new PolicyAlterEvent instance.