1 | <?php |
||
10 | abstract class Policy |
||
11 | { |
||
12 | protected $directives = []; |
||
13 | |||
14 | protected $reportOnly = false; |
||
15 | |||
16 | abstract public function configure(); |
||
17 | |||
18 | /** |
||
19 | * @param string $directive |
||
20 | * @param string|array $values |
||
21 | * |
||
22 | * @return \Spatie\Csp\Policies\Policy |
||
23 | * |
||
24 | * @throws \Spatie\Csp\Exceptions\InvalidDirective |
||
25 | */ |
||
26 | public function addDirective(string $directive, $values): self |
||
40 | |||
41 | public function reportOnly(): self |
||
47 | |||
48 | public function enforce(): self |
||
54 | |||
55 | public function reportTo(string $uri): self |
||
61 | |||
62 | public function shouldBeApplied(Request $request, Response $response): bool |
||
66 | |||
67 | public function addNonceForDirective(string $directive): self |
||
71 | |||
72 | /** |
||
73 | * @param string|array $values |
||
74 | * |
||
75 | * @return \Spatie\Csp\Policies\Policy |
||
76 | * |
||
77 | * @throws \Spatie\Csp\Exceptions\InvalidDirective |
||
78 | */ |
||
79 | public function addFrame($values): self |
||
86 | |||
87 | public function applyTo(Response $response) |
||
101 | |||
102 | public function __toString() |
||
112 | |||
113 | protected function guardAgainstInvalidDirectives(string $directive) |
||
119 | |||
120 | protected function sanitizeValue(string $value): string |
||
137 | } |
||
138 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.