We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Conditions | 9 |
| Paths | 12 |
| Total Lines | 55 |
| Code Lines | 33 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 1 | 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 |
||
| 39 | public function main($content, $conf) { |
||
| 40 | |||
| 41 | $this->init($conf); |
||
| 42 | |||
| 43 | // Merge configuration with conf array of toolbox. |
||
| 44 | if (!empty($this->cObj->data['conf'])) { |
||
| 45 | $this->conf = Helper::mergeRecursiveWithOverrule($this->cObj->data['conf'], $this->conf); |
||
| 46 | } |
||
| 47 | |||
| 48 | $this->addSearchInDocumentJS(); |
||
| 49 | |||
| 50 | // Load current document. |
||
| 51 | $this->loadDocument(); |
||
| 52 | if ($this->doc === NULL |
||
| 53 | || $this->doc->numPages < 1 |
||
|
|
|||
| 54 | || empty($this->conf['fileGrpFulltext']) |
||
| 55 | || empty($this->conf['solrcore'])) { |
||
| 56 | // Quit without doing anything if required variables are not set. |
||
| 57 | return $content; |
||
| 58 | } |
||
| 59 | |||
| 60 | // Quit if no fulltext file is present |
||
| 61 | $fullTextFile = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpFulltext']]; |
||
| 62 | if (empty($fullTextFile)) { |
||
| 63 | return $content; |
||
| 64 | } |
||
| 65 | |||
| 66 | // Load template file. |
||
| 67 | $this->getTemplate('###TEMPLATE###', '', TRUE); |
||
| 68 | |||
| 69 | // Configure @action URL for form. |
||
| 70 | $linkConf = array( |
||
| 71 | 'parameter' => $GLOBALS['TSFE']->id, |
||
| 72 | 'forceAbsoluteUrl' => 1 |
||
| 73 | ); |
||
| 74 | |||
| 75 | $encryptedSolr = $this->getEncryptedCoreName(); |
||
| 76 | // Fill markers. |
||
| 77 | $markerArray = array( |
||
| 78 | '###ACTION_URL###' => $this->cObj->typoLink_URL($linkConf), |
||
| 79 | '###LABEL_QUERY###' => $this->pi_getLL('label.query'), |
||
| 80 | '###LABEL_DELETE_SEARCH###' => $this->pi_getLL('label.delete_search'), |
||
| 81 | '###LABEL_LOADING###' => $this->pi_getLL('label.loading'), |
||
| 82 | '###LABEL_SUBMIT###' => $this->pi_getLL('label.submit'), |
||
| 83 | '###LABEL_SEARCH_IN_DOCUMENT###' => $this->pi_getLL('label.searchInDocument'), |
||
| 84 | '###LABEL_NEXT###' => $this->pi_getLL('label.next'), |
||
| 85 | '###LABEL_PREVIOUS###' => $this->pi_getLL('label.previous'), |
||
| 86 | '###LABEL_PAGE###' => $this->pi_getLL('label.logicalPage'), |
||
| 87 | '###CURRENT_DOCUMENT###' => $this->doc->uid, |
||
| 88 | '###SOLR_ENCRYPTED###' => isset($encryptedSolr['encrypted']) ? $encryptedSolr['encrypted'] : '', |
||
| 89 | '###SOLR_HASH###' => isset($encryptedSolr['hash']) ? $encryptedSolr['hash'] : '', |
||
| 90 | ); |
||
| 91 | |||
| 92 | $content .= $this->templateService->substituteMarkerArray($this->template, $markerArray); |
||
| 93 | return $this->pi_wrapInBaseClass($content); |
||
| 94 | } |
||
| 125 |