Conditions | 14 |
Paths | 13 |
Total Lines | 68 |
Code Lines | 36 |
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 |
||
38 | public static function load($class_name) |
||
39 | { |
||
40 | // Only load classes belonging to this library. |
||
41 | if ( \stripos($class_name, 'ConsoleHelpers\PHPUnitCompat') !== 0 ) { |
||
42 | return false; |
||
43 | } |
||
44 | |||
45 | switch ( $class_name ) { |
||
46 | case 'ConsoleHelpers\PHPUnitCompat\AbstractTestCase': |
||
47 | self::defineAliases(); |
||
48 | |||
49 | $phpunit_version = self::getPhpUnitVersion(); |
||
50 | |||
51 | if ( version_compare($phpunit_version, '5.0.0', '<') ) { |
||
52 | require_once __DIR__ . '/src/PHPUnitCompat/AbstractTestCase4.php'; |
||
53 | } |
||
54 | elseif ( version_compare($phpunit_version, '6.0.0', '<') ) { |
||
55 | require_once __DIR__ . '/src/PHPUnitCompat/AbstractTestCase5.php'; |
||
56 | } |
||
57 | elseif ( version_compare($phpunit_version, '7.0.0', '<') ) { |
||
58 | require_once __DIR__ . '/src/PHPUnitCompat/AbstractTestCase6.php'; |
||
59 | } |
||
60 | elseif ( version_compare($phpunit_version, '8.0.0', '<') ) { |
||
61 | require_once __DIR__ . '/src/PHPUnitCompat/AbstractTestCase7.php'; |
||
62 | } |
||
63 | else { |
||
64 | require_once __DIR__ . '/src/PHPUnitCompat/AbstractTestCase8.php'; |
||
65 | } |
||
66 | |||
67 | return true; |
||
68 | |||
69 | case 'ConsoleHelpers\PHPUnitCompat\AbstractTestSuite': |
||
70 | $phpunit_version = self::getPhpUnitVersion(); |
||
71 | |||
72 | if ( version_compare($phpunit_version, '5.0.0', '<') ) { |
||
73 | require_once __DIR__ . '/src/PHPUnitCompat/AbstractTestSuite4.php'; |
||
74 | } |
||
75 | elseif ( version_compare($phpunit_version, '6.0.0', '<') ) { |
||
76 | require_once __DIR__ . '/src/PHPUnitCompat/AbstractTestSuite5.php'; |
||
77 | } |
||
78 | elseif ( version_compare($phpunit_version, '7.0.0', '<') ) { |
||
79 | require_once __DIR__ . '/src/PHPUnitCompat/AbstractTestSuite6.php'; |
||
80 | } |
||
81 | elseif ( version_compare($phpunit_version, '8.0.0', '<') ) { |
||
82 | require_once __DIR__ . '/src/PHPUnitCompat/AbstractTestSuite7.php'; |
||
83 | } |
||
84 | else { |
||
85 | require_once __DIR__ . '/src/PHPUnitCompat/AbstractTestSuite8.php'; |
||
86 | } |
||
87 | |||
88 | return true; |
||
89 | |||
90 | /* |
||
91 | * Handles: |
||
92 | * - ConsoleHelpers\PHPUnitCompat\TAbstractTestCaseBody |
||
93 | * - ConsoleHelpers\PHPUnitCompat\TAbstractTestSuiteBody |
||
94 | */ |
||
95 | default: |
||
96 | $file = \realpath(__DIR__ . '/src/' . \strtr(\substr($class_name, 15), '\\', '/') . '.php'); |
||
97 | |||
98 | if ( \is_string($file) && \file_exists($file) === true ) { |
||
99 | require_once $file; |
||
100 | |||
101 | return true; |
||
102 | } |
||
103 | } |
||
104 | |||
105 | return false; |
||
106 | } |
||
215 |
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