| Conditions | 12 |
| Paths | 53 |
| Total Lines | 64 |
| Code Lines | 38 |
| 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 |
||
| 66 | public function aroundRenderResult( |
||
| 67 | ResultInterface $subject, |
||
| 68 | \Closure $proceed, |
||
| 69 | ResponseInterface $response |
||
| 70 | ) { |
||
| 71 | $result = $proceed($response); |
||
| 72 | |||
| 73 | if ( |
||
| 74 | PHP_SAPI === 'cli' || |
||
| 75 | $this->request->isXmlHttpRequest() === true || |
||
| 76 | $this->generalConfig->isDisabledSubmitForm() === false |
||
| 77 | ) { |
||
| 78 | return $result; |
||
| 79 | } |
||
| 80 | |||
| 81 | $html = $response->getBody(); |
||
| 82 | $dom = new HtmlDomParser(); |
||
| 83 | |||
| 84 | $dom->overwriteSpecialScriptTags([ |
||
| 85 | 'text/html', |
||
| 86 | 'text/x-magento-template', |
||
| 87 | 'text/x-custom-template', |
||
| 88 | 'text/x-handlebars-template', |
||
| 89 | ]); |
||
| 90 | |||
| 91 | $dom = $dom->loadHtml($html); |
||
| 92 | |||
| 93 | try { |
||
| 94 | $elements = $dom->findMultiOrFalse('[data-hryvinskyi-recaptcha="default"]'); |
||
| 95 | |||
| 96 | if ($elements !== false) { |
||
| 97 | foreach ($elements as $element) { |
||
| 98 | $form = $this->closest($element, 'form'); |
||
| 99 | |||
| 100 | $form->setAttribute('onsubmit', 'return false;' . |
||
| 101 | $form->getAttribute('onsubmit')); |
||
| 102 | $form->setAttribute('class', $form->getAttribute('class') . |
||
| 103 | ' hryvinskyi-recaptcha-disabled-submit'); |
||
| 104 | } |
||
| 105 | } |
||
| 106 | |||
| 107 | $elementsTarget = $dom->findMultiOrFalse('[data-hryvinskyi-recaptcha="target"]'); |
||
| 108 | |||
| 109 | if ($elementsTarget !== false) { |
||
| 110 | foreach ($elementsTarget as $element) { |
||
| 111 | $target = $dom->findOneOrFalse($element->getAttribute('data-hryvinskyi-recaptcha-target')); |
||
| 112 | if ($target !== false) { |
||
| 113 | $target->setAttribute('onsubmit', 'return false;' . |
||
| 114 | $target->getAttribute('onsubmit')); |
||
| 115 | $target->setAttribute('class', $target->getAttribute('class') . |
||
| 116 | ' hryvinskyi-recaptcha-disabled-submit'); |
||
| 117 | } |
||
| 118 | } |
||
| 119 | } |
||
| 120 | |||
| 121 | if ($elements !== false || $elementsTarget !== false) { |
||
| 122 | $response->setBody((string)$dom); |
||
| 123 | } |
||
| 124 | } catch (\Throwable $e) { |
||
| 125 | $response->setBody($html); |
||
| 126 | $this->logger->critical($e->getMessage()); |
||
| 127 | } |
||
| 128 | |||
| 129 | return $result; |
||
| 130 | } |
||
| 157 |
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