| Conditions | 7 |
| Paths | 9 |
| Total Lines | 52 |
| Code Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 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 |
||
| 88 | public function render(array $arguments, $pageUid, $apiPid, $class) |
||
| 89 | { |
||
| 90 | |||
| 91 | if ($arguments['document']) { |
||
| 92 | |||
| 93 | // it's already a document object? |
||
| 94 | if ($arguments['document'] instanceof \EWW\Dpf\Domain\Model\Document) { |
||
| 95 | |||
| 96 | $document = $arguments['document']; |
||
| 97 | |||
| 98 | } else if (MathUtility::canBeInterpretedAsInteger($arguments['document'])) { |
||
| 99 | |||
| 100 | $document = $this->documentRepository->findByUid($arguments['document']); |
||
| 101 | |||
| 102 | } |
||
| 103 | |||
| 104 | // we found a valid document |
||
| 105 | if ($document) { |
||
| 106 | |||
| 107 | $row['uid'] = $document->getUid(); |
||
| 108 | |||
| 109 | $row['title'] = $document->getTitle(); |
||
| 110 | |||
| 111 | $row['action'] = 'preview'; |
||
| 112 | |||
| 113 | } else { |
||
| 114 | |||
| 115 | // ok, nothing to render. So return empty content. |
||
| 116 | return ''; |
||
| 117 | |||
| 118 | } |
||
| 119 | |||
| 120 | } else if ($arguments['documentObjectIdentifier']) { |
||
| 121 | |||
| 122 | $row['action'] = 'mets'; |
||
| 123 | |||
| 124 | $row['uid'] = $arguments['documentObjectIdentifier']; |
||
| 125 | |||
| 126 | // pass configured API secret key parameter to enable dissemination of inactive documents |
||
| 127 | $settings = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS); |
||
| 128 | |||
| 129 | if (array_key_exists('plugin.tx_dpf.settings.deliverInactiveSecretKey', $settings)) { |
||
| 130 | $row['deliverInactive'] = $this->settings['plugin.tx_dpf.settings.deliverInactiveSecretKey']; |
||
| 131 | } |
||
| 132 | |||
| 133 | } |
||
| 134 | |||
| 135 | $insideText = $this->renderChildren(); |
||
| 136 | |||
| 137 | $content = $this->getViewIcon($row, $pageUid, $apiPid, $insideText, $class); |
||
| 138 | |||
| 139 | return $content; |
||
| 140 | |||
| 143 |
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