Conditions | 1 |
Paths | 1 |
Total Lines | 54 |
Code Lines | 39 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
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 |
||
20 | public static function hooksEnabledWithEnabledTools() |
||
21 | { |
||
22 | return [ |
||
23 | 'pre-commit' => [ |
||
24 | 'enabled' => true, |
||
25 | 'process' => [ |
||
26 | 'composer' => true, |
||
27 | 'jsonlint' => true, |
||
28 | 'phplint' => true, |
||
29 | 'phpmd' => true, |
||
30 | 'phpcs' => [ |
||
31 | 'enabled' => true, |
||
32 | 'standard' => static::PHPCS_STANDARD, |
||
33 | ], |
||
34 | 'php-cs-fixer' => [ |
||
35 | 'enabled' => true, |
||
36 | 'levels' => [ |
||
37 | 'psr0' => true, |
||
38 | 'psr1' => true, |
||
39 | 'psr2' => true, |
||
40 | 'symfony' => true, |
||
41 | ], |
||
42 | ], |
||
43 | 'phpunit' => [ |
||
44 | 'enabled' => true, |
||
45 | 'random-mode' => true, |
||
46 | 'options' => static::PHPUNIT_OPTIONS, |
||
47 | ], |
||
48 | ], |
||
49 | 'messages' => [ |
||
50 | 'right-message' => static::RIGHT_MESSAGE, |
||
51 | 'error-message' => static::ERROR_MESSAGE, |
||
52 | ], |
||
53 | ], |
||
54 | 'commit-msg' => [ |
||
55 | 'enabled' => true, |
||
56 | 'regular-expression' => static::REGULAR_EXPRESSION, |
||
57 | ], |
||
58 | 'pre-push' => [ |
||
59 | 'enabled' => true, |
||
60 | 'process' => [ |
||
61 | 'phpunit' => [ |
||
62 | 'enabled' => true, |
||
63 | 'random-mode' => true, |
||
64 | 'options' => static::PHPUNIT_OPTIONS |
||
65 | ] |
||
66 | ], |
||
67 | 'messages' => [ |
||
68 | 'right-message' => static::RIGHT_MESSAGE, |
||
69 | 'error-message' => static::ERROR_MESSAGE, |
||
70 | ] |
||
71 | ] |
||
72 | ]; |
||
73 | } |
||
74 | } |
||
75 |