| Conditions | 32 | 
| Paths | > 20000 | 
| Total Lines | 135 | 
| Code Lines | 93 | 
| 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 | ||
| 101 | public function display(Tree|null $tree = null, string|null $date_format = null, bool $convert_calendars = false): string | ||
| 102 |     { | ||
| 103 |         if ($tree instanceof Tree) { | ||
| 104 |             $CALENDAR_FORMAT = $tree->getPreference('CALENDAR_FORMAT'); | ||
| 105 |         } else { | ||
| 106 | $CALENDAR_FORMAT = 'none'; | ||
| 107 | } | ||
| 108 | |||
| 109 | $date_format ??= I18N::dateFormat(); | ||
| 110 | |||
| 111 |         if ($convert_calendars) { | ||
| 112 |             $calendar_format = explode('_and_', $CALENDAR_FORMAT); | ||
| 113 |         } else { | ||
| 114 | $calendar_format = []; | ||
| 115 | } | ||
| 116 | |||
| 117 | // Two dates with text before, between and after | ||
| 118 | $q1 = $this->qual1; | ||
| 119 | $d1 = $this->date1->format($date_format, $this->qual1); | ||
| 120 | $q2 = $this->qual2; | ||
| 121 |         if ($this->date2 === null) { | ||
| 122 | $d2 = ''; | ||
| 123 |         } else { | ||
| 124 | $d2 = $this->date2->format($date_format, $this->qual2); | ||
| 125 | } | ||
| 126 | // Con vert to other calendars, if requested | ||
| 127 | $conv1 = ''; | ||
| 128 | $conv2 = ''; | ||
| 129 |         foreach ($calendar_format as $cal_fmt) { | ||
| 130 |             if ($cal_fmt !== 'none') { | ||
| 131 | $d1conv = $this->date1->convertToCalendar($cal_fmt); | ||
| 132 |                 if ($d1conv->inValidRange()) { | ||
| 133 | $d1tmp = $d1conv->format($date_format, $this->qual1); | ||
| 134 |                 } else { | ||
| 135 | $d1tmp = ''; | ||
| 136 | } | ||
| 137 |                 if ($this->date2 === null) { | ||
| 138 | $d2conv = null; | ||
| 139 | $d2tmp = ''; | ||
| 140 |                 } else { | ||
| 141 | $d2conv = $this->date2->convertToCalendar($cal_fmt); | ||
| 142 |                     if ($d2conv->inValidRange()) { | ||
| 143 | $d2tmp = $d2conv->format($date_format, $this->qual2); | ||
| 144 |                     } else { | ||
| 145 | $d2tmp = ''; | ||
| 146 | } | ||
| 147 | } | ||
| 148 | // If the date is different from the unconverted date, add it to the date string. | ||
| 149 |                 if ($d1 !== $d1tmp && $d1tmp !== '') { | ||
| 150 |                     if ($tree instanceof Tree) { | ||
| 151 |                         if ($CALENDAR_FORMAT !== 'none') { | ||
| 152 | $conv1 .= ' <span dir="' . I18N::direction() . '">(<a href="' . e($d1conv->calendarUrl($date_format, $tree)) . '" rel="nofollow">' . $d1tmp . '</a>)</span>'; | ||
| 153 |                         } else { | ||
| 154 | $conv1 .= ' <span dir="' . I18N::direction() . '"><br><a href="' . e($d1conv->calendarUrl($date_format, $tree)) . '" rel="nofollow">' . $d1tmp . '</a></span>'; | ||
| 155 | } | ||
| 156 |                     } else { | ||
| 157 |                         $conv1 .= ' <span dir="' . I18N::direction() . '">(' . $d1tmp . ')</span>'; | ||
| 158 | } | ||
| 159 | } | ||
| 160 |                 if ($this->date2 !== null && $d2 !== $d2tmp && $d1tmp !== '') { | ||
| 161 |                     if ($tree instanceof Tree) { | ||
| 162 | $conv2 .= ' <span dir="' . I18N::direction() . '">(<a href="' . e($d2conv->calendarUrl($date_format, $tree)) . '" rel="nofollow">' . $d2tmp . '</a>)</span>'; | ||
| 163 |                     } else { | ||
| 164 |                         $conv2 .= ' <span dir="' . I18N::direction() . '">(' . $d2tmp . ')</span>'; | ||
| 165 | } | ||
| 166 | } | ||
| 167 | } | ||
| 168 | } | ||
| 169 | |||
| 170 | // Add URLs, if requested | ||
| 171 |         if ($tree instanceof Tree) { | ||
| 172 | $d1 = '<a href="' . e($this->date1->calendarUrl($date_format, $tree)) . '" rel="nofollow">' . $d1 . '</a>'; | ||
| 173 |             if ($this->date2 instanceof AbstractCalendarDate) { | ||
| 174 | $d2 = '<a href="' . e($this->date2->calendarUrl($date_format, $tree)) . '" rel="nofollow">' . $d2 . '</a>'; | ||
| 175 | } | ||
| 176 | } | ||
| 177 | |||
| 178 | // Localise the date | ||
| 179 |         switch ($q1 . $q2) { | ||
| 180 | case '': | ||
| 181 | $tmp = $d1 . $conv1; | ||
| 182 |                 if ($this->text !== '') { | ||
| 183 |                     $tmp .= '(' . e($this->text) . ')'; | ||
| 184 | } | ||
| 185 | break; | ||
| 186 | case 'ABT': | ||
| 187 | /* I18N: Gedcom ABT dates */ | ||
| 188 |                 $tmp = I18N::translate('about %s', $d1 . $conv1); | ||
| 189 | break; | ||
| 190 | case 'CAL': | ||
| 191 | /* I18N: Gedcom CAL dates */ | ||
| 192 |                 $tmp = I18N::translate('calculated %s', $d1 . $conv1); | ||
| 193 | break; | ||
| 194 | case 'EST': | ||
| 195 | /* I18N: Gedcom EST dates */ | ||
| 196 |                 $tmp = I18N::translate('estimated %s', $d1 . $conv1); | ||
| 197 | break; | ||
| 198 | case 'INT': | ||
| 199 | /* I18N: Gedcom INT dates */ | ||
| 200 |                 $tmp = I18N::translate('interpreted %s (%s)', $d1 . $conv1, e($this->text)); | ||
| 201 | break; | ||
| 202 | case 'BEF': | ||
| 203 | /* I18N: Gedcom BEF dates */ | ||
| 204 |                 $tmp = I18N::translate('before %s', $d1 . $conv1); | ||
| 205 | break; | ||
| 206 | case 'AFT': | ||
| 207 | /* I18N: Gedcom AFT dates */ | ||
| 208 |                 $tmp = I18N::translate('after %s', $d1 . $conv1); | ||
| 209 | break; | ||
| 210 | case 'FROM': | ||
| 211 | /* I18N: Gedcom FROM dates */ | ||
| 212 |                 $tmp = I18N::translate('from %s', $d1 . $conv1); | ||
| 213 | break; | ||
| 214 | case 'TO': | ||
| 215 | /* I18N: Gedcom TO dates */ | ||
| 216 |                 $tmp = I18N::translate('to %s', $d1 . $conv1); | ||
| 217 | break; | ||
| 218 | case 'BETAND': | ||
| 219 | /* I18N: Gedcom BET-AND dates */ | ||
| 220 |                 $tmp = I18N::translate('between %s and %s', $d1 . $conv1, $d2 . $conv2); | ||
| 221 | break; | ||
| 222 | case 'FROMTO': | ||
| 223 | /* I18N: Gedcom FROM-TO dates */ | ||
| 224 |                 $tmp = I18N::translate('from %s to %s', $d1 . $conv1, $d2 . $conv2); | ||
| 225 | break; | ||
| 226 | default: | ||
| 227 |                 $tmp = I18N::translate('Invalid date'); | ||
| 228 | break; | ||
| 229 | } | ||
| 230 | |||
| 231 |         if (strip_tags($tmp) === '') { | ||
| 232 | return ''; | ||
| 233 | } | ||
| 234 | |||
| 235 | return '<span class="date">' . $tmp . '</span>'; | ||
| 236 | } | ||
| 416 | 
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