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\EventView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PolicyAlterEvent:: |
private | property | A CSP policy. | |
PolicyAlterEvent:: |
private | property | The Response the policy is being applied to. | |
PolicyAlterEvent:: |
public | function | Retrieve the defined CSP policy. | |
PolicyAlterEvent:: |
public | function | Retrieve the Response the policy is applied to. | |
PolicyAlterEvent:: |
public | function | Create a new PolicyAlterEvent instance. |