| Conditions | 10 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 10 |
| 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 |
||
| 33 | 8 | public function check(array $properties, string $message) : void |
|
| 34 | { |
||
| 35 | 8 | if (array_key_exists('Platform', $properties) |
|
| 36 | 7 | || array_key_exists('Platform_Description', $properties) |
|
| 37 | 7 | || array_key_exists('Platform_Maker', $properties) |
|
| 38 | 7 | || array_key_exists('Platform_Bits', $properties) |
|
| 39 | 7 | || array_key_exists('Platform_Version', $properties) |
|
| 40 | 7 | || array_key_exists('Win16', $properties) |
|
| 41 | 7 | || array_key_exists('Win32', $properties) |
|
| 42 | 7 | || array_key_exists('Win64', $properties) |
|
| 43 | 7 | || array_key_exists('Browser_Bits', $properties) |
|
| 44 | ) { |
||
| 45 | 1 | throw new \LogicException($message); |
|
| 46 | } |
||
| 47 | 7 | } |
|
| 48 | } |
||
| 49 |