| Conditions | 3 |
| Paths | 4 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | public function __invoke(Request $request, Response $response, callable $next) |
||
| 18 | { |
||
| 19 | if ($this->where == 'before') { |
||
| 20 | $response->setHeader($this->name, $this->value); |
||
| 21 | } |
||
| 22 | |||
| 23 | $resp = $next($request, $response); |
||
| 24 | |||
| 25 | if ($this->where == 'after') { |
||
| 26 | $response->setHeader($this->name, $this->value); |
||
| 27 | } |
||
| 28 | |||
| 29 | return $resp; |
||
| 30 | } |
||
| 31 | |||
| 32 | } |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: