| Total Complexity | 3 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class DefenceFactory |
||
| 13 | { |
||
| 14 | 2 | private function createTerminateScriptHandler(): TerminateScriptHandler |
|
| 15 | { |
||
| 16 | 2 | return new TerminateScriptHandler(new PhpFunctionsWrapper(), new HttpResponseFactory()); |
|
| 17 | } |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Creates an instance of `Defence` containing no filters, and a handler that will immediately send a "Forbidden" |
||
| 21 | * response and terminate the script |
||
| 22 | */ |
||
| 23 | 2 | public function createDefaultDefence(): Defence |
|
| 24 | { |
||
| 25 | 2 | return new Defence(new SimpleFilterChain(), $this->createTerminateScriptHandler()); |
|
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Creates an instance of `Defence` in the default configuration and then adds filters that require no set-up and |
||
| 30 | * can be safely run in all cases |
||
| 31 | */ |
||
| 32 | 1 | public function createDefaultDefenceWithBasicFilters(): Defence |
|
| 44 | } |
||
| 45 | } |
||
| 46 |