| Conditions | 9 |
| Paths | 10 |
| Total Lines | 52 |
| Code Lines | 31 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| 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 |
||
| 41 | public function main($content, $conf) |
||
| 42 | { |
||
| 43 | $this->init($conf); |
||
| 44 | |||
| 45 | // get the tx_dpf.settings too |
||
| 46 | // Flexform wins over TS |
||
| 47 | $dpfTSconfig = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_dpf.']; |
||
| 48 | if (is_array($dpfTSconfig['settings.'])) { |
||
| 49 | \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($dpfTSconfig['settings.'], $this->conf, true, false); |
||
| 50 | $this->conf = $dpfTSconfig['settings.']; |
||
| 51 | } |
||
| 52 | |||
| 53 | // Load current document. |
||
| 54 | $this->loadDocument(); |
||
| 55 | if ($this->doc === null || empty($this->conf['fileGrpDownload'])) { |
||
| 56 | // Quit without doing anything if required variables are not set. |
||
| 57 | return $content; |
||
| 58 | } |
||
| 59 | |||
| 60 | // Load template file. |
||
| 61 | if (!empty($this->conf['templateFile'])) { |
||
| 62 | $this->template = $this->templateService->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
||
| 63 | } else { |
||
| 64 | $this->template = $this->templateService->getSubpart($this->cObj->fileResource('EXT:dpf/Classes/Plugins/DownloadTool/template.tmpl'), '###TEMPLATE###'); |
||
| 65 | } |
||
| 66 | |||
| 67 | $subpartArray['downloads'] = $this->templateService->getSubpart($this->template, '###DOWNLOADS###'); |
||
| 68 | // Show all PDF documents in download filegroup |
||
| 69 | $attachments = $this->getAttachments(); |
||
| 70 | // Get VG-Wort-Url |
||
| 71 | $vgwort = $this->getVGWortUrl(); |
||
| 72 | $content = ''; |
||
| 73 | if (is_array($attachments)) { |
||
| 74 | foreach ($attachments as $id => $file) { |
||
| 75 | $conf = array( |
||
| 76 | 'useCacheHash' => 0, |
||
| 77 | 'parameter' => $this->conf['apiPid'] . ' - piwik_download', |
||
| 78 | 'additionalParams' => '&tx_dpf[qid]=' . $this->doc->recordId . '&tx_dpf[action]=attachment' . '&tx_dpf[attachment]=' . $file['ID'], |
||
| 79 | 'forceAbsoluteUrl' => true, |
||
| 80 | ); |
||
| 81 | $title = $file['LABEL'] ? $file['LABEL'] : $file['ID']; |
||
| 82 | $markerArray['###FILE###'] = $this->cObj->typoLink($title, $conf); |
||
| 83 | |||
| 84 | if(!empty($vgwort)) { |
||
| 85 | $markerArray['###VGWORT###'] = "<div class='div_vgwpixel' data-url='" . $vgwort . "'></div>"; |
||
| 86 | } else { |
||
| 87 | $markerArray['###VGWORT###'] = ""; |
||
| 88 | } |
||
| 89 | $content .= $this->cObj->substituteMarkerArray($subpartArray['downloads'], $markerArray); |
||
| 90 | } |
||
| 91 | } |
||
| 92 | return $this->cObj->substituteSubpart($this->template, '###DOWNLOADS###', $content, true); |
||
| 93 | } |
||
| 142 |
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