| Conditions | 13 |
| Paths | 30 |
| Total Lines | 55 |
| Code Lines | 42 |
| 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 |
||
| 95 | public static function create($type, $y = 2000, $m = 1, $d = 1, $h = 0, $i = 0, $s = 0) |
||
| 96 | { |
||
| 97 | $firstDay = defined('CALENDAR_FIRST_DAY_OF_WEEK') ? CALENDAR_FIRST_DAY_OF_WEEK : 1; |
||
| 98 | switch ($type) { |
||
| 99 | case 'Day': |
||
| 100 | require_once CALENDAR_ROOT . 'Day.php'; |
||
| 101 | |||
| 102 | return new Calendar_Day($y, $m, $d); |
||
| 103 | case 'Month': |
||
| 104 | // Set default state for which month type to build |
||
| 105 | if (!defined('CALENDAR_MONTH_STATE')) { |
||
| 106 | define('CALENDAR_MONTH_STATE', CALENDAR_USE_MONTH); |
||
| 107 | } |
||
| 108 | switch (CALENDAR_MONTH_STATE) { |
||
| 109 | case CALENDAR_USE_MONTH_WEEKDAYS: |
||
| 110 | require_once CALENDAR_ROOT . 'Month/Weekdays.php'; |
||
| 111 | $class = 'Calendar_Month_Weekdays'; |
||
| 112 | break; |
||
| 113 | case CALENDAR_USE_MONTH_WEEKS: |
||
| 114 | require_once CALENDAR_ROOT . 'Month/Weeks.php'; |
||
| 115 | $class = 'Calendar_Month_Weeks'; |
||
| 116 | break; |
||
| 117 | case CALENDAR_USE_MONTH: |
||
| 118 | default: |
||
| 119 | require_once CALENDAR_ROOT . 'Month.php'; |
||
| 120 | $class = 'Calendar_Month'; |
||
| 121 | break; |
||
| 122 | } |
||
| 123 | |||
| 124 | return new $class($y, $m, $firstDay); |
||
| 125 | case 'Week': |
||
| 126 | require_once CALENDAR_ROOT . 'Week.php'; |
||
| 127 | |||
| 128 | return new Calendar_Week($y, $m, $d, $firstDay); |
||
| 129 | case 'Hour': |
||
| 130 | require_once CALENDAR_ROOT . 'Hour.php'; |
||
| 131 | |||
| 132 | return new Calendar_Hour($y, $m, $d, $h); |
||
| 133 | case 'Minute': |
||
| 134 | require_once CALENDAR_ROOT . 'Minute.php'; |
||
| 135 | |||
| 136 | return new Calendar_Minute($y, $m, $d, $h, $i); |
||
| 137 | case 'Second': |
||
| 138 | require_once CALENDAR_ROOT . 'Second.php'; |
||
| 139 | |||
| 140 | return new Calendar_Second($y, $m, $d, $h, $i, $s); |
||
| 141 | case 'Year': |
||
| 142 | require_once CALENDAR_ROOT . 'Year.php'; |
||
| 143 | |||
| 144 | return new Calendar_Year($y); |
||
| 145 | default: |
||
| 146 | require_once __DIR__ . '/PEAR.php'; |
||
| 147 | PEAR::raiseError('Calendar_Factory::create() unrecognised type: ' . $type, null, PEAR_ERROR_TRIGGER, E_USER_NOTICE, 'Calendar_Factory::create()'); |
||
| 148 | |||
| 149 | return false; |
||
| 150 | } |
||
| 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