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