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