Conditions | 1 |
Paths | 1 |
Total Lines | 75 |
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 |
||
22 | public static function hooksEnabledWithEnabledTools() |
||
23 | { |
||
24 | return [ |
||
25 | 'pre-commit' => [ |
||
26 | 'enabled' => true, |
||
27 | 'execute' => [ |
||
28 | 'composer' => true, |
||
29 | 'jsonlint' => true, |
||
30 | 'phplint' => true, |
||
31 | 'phpmd' => [ |
||
32 | 'enabled' => true, |
||
33 | 'options' => self::PHPMD_OPTIONS |
||
34 | ], |
||
35 | 'phpcs' => [ |
||
36 | 'enabled' => true, |
||
37 | 'standard' => static::PHPCS_STANDARD, |
||
38 | 'ignore' => static::EMPTY_STRING, |
||
39 | ], |
||
40 | 'php-cs-fixer' => [ |
||
41 | 'enabled' => true, |
||
42 | 'levels' => [ |
||
43 | 'psr0' => true, |
||
44 | 'psr1' => true, |
||
45 | 'psr2' => true, |
||
46 | 'symfony' => true, |
||
47 | ], |
||
48 | 'options' => static::PHPCSFIXER_OPTIONS, |
||
49 | ], |
||
50 | 'phpunit' => [ |
||
51 | 'enabled' => true, |
||
52 | 'random-mode' => true, |
||
53 | 'options' => static::PHPUNIT_OPTIONS, |
||
54 | 'strict-coverage' => [ |
||
55 | 'enabled' => true, |
||
56 | 'minimum' => self::MINIMUM_COVERAGE |
||
57 | ], |
||
58 | 'guard-coverage' => [ |
||
59 | 'enabled' => true, |
||
60 | 'message' => self::ERROR_MESSAGE |
||
61 | ], |
||
62 | ], |
||
63 | ], |
||
64 | 'message' => [ |
||
65 | 'right-message' => static::RIGHT_MESSAGE, |
||
66 | 'error-message' => static::ERROR_MESSAGE, |
||
67 | ], |
||
68 | ], |
||
69 | 'commit-msg' => [ |
||
70 | 'enabled' => true, |
||
71 | 'regular-expression' => static::REGULAR_EXPRESSION, |
||
72 | ], |
||
73 | 'pre-push' => [ |
||
74 | 'enabled' => true, |
||
75 | 'execute' => [ |
||
76 | 'phpunit' => [ |
||
77 | 'enabled' => true, |
||
78 | 'random-mode' => true, |
||
79 | 'options' => static::PHPUNIT_OPTIONS, |
||
80 | 'strict-coverage' => [ |
||
81 | 'enabled' => true, |
||
82 | 'minimum' => self::MINIMUM_COVERAGE |
||
83 | ], |
||
84 | 'guard-coverage' => [ |
||
85 | 'enabled' => true, |
||
86 | 'message' => self::ERROR_MESSAGE |
||
87 | ], |
||
88 | ] |
||
89 | ], |
||
90 | 'message' => [ |
||
91 | 'right-message' => HookQuestions::PRE_PUSH_RIGHT_MESSAGE_DEFAULT, |
||
92 | 'error-message' => HookQuestions::PRE_PUSH_ERROR_MESSAGE_DEFAULT, |
||
93 | ] |
||
94 | ] |
||
95 | ]; |
||
96 | } |
||
97 | } |
||
98 |