| Conditions | 23 | 
| Paths | 158 | 
| Total Lines | 57 | 
| Code Lines | 28 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 2 | ||
| Bugs | 0 | Features | 0 | 
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 59 | public function onKernelResponse($event): void  | 
            ||
| 60 |     { | 
            ||
| 61 |         if (!$event instanceof FilterResponseEvent && !$event instanceof ResponseEvent) { | 
            ||
| 62 |             throw new \InvalidArgumentException(\sprintf('Expected instance of type %s, %s given', \class_exists(ResponseEvent::class) ? ResponseEvent::class : FilterResponseEvent::class, \is_object($event) ? \get_class($event) : \gettype($event))); | 
            ||
| 63 | }  | 
            ||
| 64 | |||
| 65 |         if (!$event->isMasterRequest()) { | 
            ||
| 66 | return;  | 
            ||
| 67 | }  | 
            ||
| 68 | |||
| 69 |         if (null === $this->newRelicTwigExtension || false === $this->newRelicTwigExtension->isUsed()) { | 
            ||
| 70 |             foreach ($this->newRelic->getCustomMetrics() as $name => $value) { | 
            ||
| 71 | $this->interactor->addCustomMetric((string) $name, (float) $value);  | 
            ||
| 72 | }  | 
            ||
| 73 | |||
| 74 |             foreach ($this->newRelic->getCustomParameters() as $name => $value) { | 
            ||
| 75 | $this->interactor->addCustomParameter((string) $name, $value);  | 
            ||
| 76 | }  | 
            ||
| 77 | }  | 
            ||
| 78 | |||
| 79 |         foreach ($this->newRelic->getCustomEvents() as $name => $events) { | 
            ||
| 80 |             foreach ($events as $attributes) { | 
            ||
| 81 | $this->interactor->addCustomEvent((string) $name, $attributes);  | 
            ||
| 82 | }  | 
            ||
| 83 | }  | 
            ||
| 84 | |||
| 85 |         if ($this->instrument) { | 
            ||
| 86 |             if (null === $this->newRelicTwigExtension || false === $this->newRelicTwigExtension->isUsed()) { | 
            ||
| 87 | $this->interactor->disableAutoRUM();  | 
            ||
| 88 | }  | 
            ||
| 89 | |||
| 90 | // Some requests might not want to get instrumented  | 
            ||
| 91 |             if ($event->getRequest()->attributes->get('_instrument', true)) { | 
            ||
| 92 | $response = $event->getResponse();  | 
            ||
| 93 | |||
| 94 | // We can only instrument HTML responses  | 
            ||
| 95 | if (!$response instanceof StreamedResponse  | 
            ||
| 96 |                     && 'text/html' === \substr($response->headers->get('Content-Type', ''), 0, 9) | 
            ||
| 97 |                 ) { | 
            ||
| 98 | $responseContent = $response->getContent();  | 
            ||
| 99 |                     $response->setContent(''); // free the memory | 
            ||
| 100 | |||
| 101 |                     if (null === $this->newRelicTwigExtension || false === $this->newRelicTwigExtension->isHeaderCalled()) { | 
            ||
| 102 |                         $responseContent = \preg_replace('|<head>|i', '$0'.$this->interactor->getBrowserTimingHeader(), $responseContent); | 
            ||
| 103 | }  | 
            ||
| 104 | |||
| 105 |                     if (null === $this->newRelicTwigExtension || false === $this->newRelicTwigExtension->isFooterCalled()) { | 
            ||
| 106 |                         $responseContent = \preg_replace('|</body>|i', $this->interactor->getBrowserTimingFooter().'$0', $responseContent); | 
            ||
| 107 | }  | 
            ||
| 108 | |||
| 109 | $response->setContent($responseContent);  | 
            ||
| 110 | }  | 
            ||
| 111 | }  | 
            ||
| 112 | }  | 
            ||
| 113 | |||
| 114 |         if ($this->symfonyCache) { | 
            ||
| 115 | $this->interactor->endTransaction();  | 
            ||
| 116 | }  | 
            ||
| 119 | 
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths