Conditions | 10 |
Paths | 18 |
Total Lines | 18 |
Code Lines | 11 |
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 |
||
71 | private static function checkExampleRequirements(array $requirements) : void |
||
72 | { |
||
73 | if (isset($requirements['tarantool'])) { |
||
74 | [$major, $minor, $patch] = \sscanf($requirements['tarantool'], '%d.%d.%d'); |
||
75 | $requiredVersionId = $major * 10000 + $minor * 100 + $patch; |
||
76 | if (self::getTarantoolVersionId() < $requiredVersionId) { |
||
77 | self::markTestSkipped(sprintf('Tarantool >= %s is required.', $requirements['tarantool'])); |
||
78 | } |
||
79 | } |
||
80 | |||
81 | if (isset($requirements['extension']) && !extension_loaded($requirements['extension'])) { |
||
82 | self::markTestSkipped(sprintf('Extension %s is required.', $requirements['extension'])); |
||
83 | } |
||
84 | |||
85 | if (isset($requirements['function']) && !\function_exists($requirements['function'])) { |
||
86 | $pieces = \explode('::', $requirements['function']); |
||
87 | if ((2 !== \count($pieces)) || !\class_exists($pieces[0]) || !\method_exists($pieces[0], $pieces[1])) { |
||
88 | self::markTestSkipped(sprintf('Function %s is required.', $requirements['function'])); |
||
89 | } |
||
93 |