| Conditions | 12 |
| Paths | 96 |
| Total Lines | 75 |
| Code Lines | 43 |
| 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 |
||
| 104 | public function parse(InlineParserContext $inlineContext): bool |
||
| 105 | { |
||
| 106 | $cursor = $inlineContext->getCursor(); |
||
| 107 | $subm = $inlineContext->getSubMatches(); |
||
| 108 | $uid = [$subm[0]]; |
||
| 109 | $firstFoundRecord = null; |
||
| 110 | if (isset($subm[1])) { |
||
| 111 | #Unescape character's # |
||
| 112 | |||
| 113 | #NOTE: It should use only one \\, but it's using two because it get's escaped again in the regex processing. |
||
| 114 | $linkText = preg_replace("/\\\\#/", "#", $subm[1]); |
||
| 115 | } else { |
||
| 116 | $linkText = ''; |
||
| 117 | } |
||
| 118 | |||
| 119 | // Do the search |
||
| 120 | $result = new Collection(); |
||
| 121 | |||
| 122 | // Log search requests for visitors |
||
| 123 | if (Auth::id() === null) { |
||
| 124 | Log::addSearchLog('General: ' . $query, $search_trees->all()); |
||
| 125 | } |
||
| 126 | |||
| 127 | $result = $this->search_service->searchIndividuals([$this->tree], $uid); |
||
| 128 | $firstFoundRecord = $this->firstMatchingUidRecord($uid[0], $result); |
||
| 129 | |||
| 130 | if ($firstFoundRecord === null) { |
||
| 131 | $result = $this->search_service->searchFamilies([$this->tree], $uid); |
||
| 132 | $firstFoundRecord = $this->firstMatchingUidRecord($uid[0], $result); |
||
| 133 | |||
| 134 | if ($firstFoundRecord === null) { |
||
| 135 | $result = $this->search_service->searchFamilyNames([$this->tree], $uid); |
||
| 136 | $firstFoundRecord = $this->firstMatchingUidRecord($uid[0], $result); |
||
| 137 | |||
| 138 | if ($firstFoundRecord === null) { |
||
| 139 | $result = $this->search_service->searchRepositories([$this->tree], $uid); |
||
| 140 | $firstFoundRecord = $this->firstMatchingUidRecord($uid[0], $result); |
||
| 141 | |||
| 142 | if ($firstFoundRecord === null) { |
||
| 143 | $result = $this->search_service->searchSources([$this->tree], $uid); |
||
| 144 | $firstFoundRecord = $this->firstMatchingUidRecord($uid[0], $result); |
||
| 145 | |||
| 146 | if ($firstFoundRecord === null) { |
||
| 147 | $result = $this->search_service->searchNotes([$this->tree], $uid); |
||
| 148 | $firstFoundRecord = $this->firstMatchingUidRecord($uid[0], $result); |
||
| 149 | |||
| 150 | if ($firstFoundRecord === null) { |
||
| 151 | $result = $this->search_service->searchLocations([$this->tree], $uid); |
||
| 152 | $firstFoundRecord = $this->firstMatchingUidRecord($uid[0], $result); |
||
| 153 | |||
| 154 | if ($firstFoundRecord === null) { |
||
| 155 | $result = $this->search_service->searchMedia([$this->tree], $uid); |
||
| 156 | $firstFoundRecord = $this->firstMatchingUidRecord($uid[0], $result); |
||
| 157 | } |
||
| 158 | } |
||
| 159 | } |
||
| 160 | } |
||
| 161 | } |
||
| 162 | } |
||
| 163 | } |
||
| 164 | |||
| 165 | if ($firstFoundRecord === null) { |
||
| 166 | return false; |
||
| 167 | } else { |
||
| 168 | $record = $firstFoundRecord; |
||
| 169 | |||
| 170 | if ($record instanceof GedcomRecord) { |
||
| 171 | $cursor->advanceBy($inlineContext->getFullMatchLength()); |
||
| 172 | |||
| 173 | $inlineContext->getContainer()->appendChild(new UidNode($record, $linkText)); |
||
| 174 | |||
| 175 | return true; |
||
| 176 | } |
||
| 177 | |||
| 178 | return false; |
||
| 179 | } |
||
| 182 |
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