| Conditions | 5 |
| Paths | 4 |
| Total Lines | 20 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 5.0061 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 25 | 1 | public function collect(...$payload): void |
|
| 26 | { |
||
| 27 | 1 | $event = current($payload); |
|
| 28 | 1 | if (!is_object($event) || !$this->isActive()) { |
|
| 29 | return; |
||
| 30 | } |
||
| 31 | |||
| 32 | 1 | if ($event instanceof BeforeMiddleware) { |
|
| 33 | 1 | $this->beforeStack[] = [ |
|
| 34 | 1 | 'name' => get_class($event->getMiddleware()), |
|
| 35 | 1 | 'time' => microtime(true), |
|
| 36 | 1 | 'memory' => memory_get_usage(), |
|
| 37 | 1 | 'request' => $event->getRequest(), |
|
| 38 | ]; |
||
| 39 | 1 | } elseif ($event instanceof AfterMiddleware) { |
|
| 40 | 1 | $this->afterStack[] = [ |
|
| 41 | 1 | 'name' => get_class($event->getMiddleware()), |
|
| 42 | 1 | 'time' => microtime(true), |
|
| 43 | 1 | 'memory' => memory_get_usage(), |
|
| 44 | 1 | 'response' => $event->getResponse(), |
|
| 45 | ]; |
||
| 55 |
This check looks for private methods that have been defined, but are not used inside the class.