Conditions | 1 |
Paths | 1 |
Total Lines | 83 |
Code Lines | 70 |
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 |
||
60 | public function itShouldMakeAllQuestions() |
||
61 | { |
||
62 | $yes = 'y'; |
||
63 | $gitIgnoreDataResponse = GitIgnoreDataResponseStub::random(); |
||
64 | |||
65 | $this->shouldReadConfigurationData(ConfigStub::createUndefined()); |
||
66 | $this->shouldAsk(HookQuestions::PRE_COMMIT_HOOK, HookQuestions::DEFAULT_TOOL_ANSWER, $yes); |
||
67 | $this->shouldAsk( |
||
68 | HookQuestions::PRE_COMMIT_RIGHT_MESSAGE, |
||
69 | HookQuestions::PRE_COMMIT_RIGHT_MESSAGE_DEFAULT, |
||
70 | ConfigArrayDataStub::RIGHT_MESSAGE |
||
71 | ); |
||
72 | $this->shouldAsk( |
||
73 | HookQuestions::PRE_COMMIT_ERROR_MESSAGE, |
||
74 | HookQuestions::PRE_COMMIT_ERROR_MESSAGE_DEFAULT, |
||
75 | ConfigArrayDataStub::ERROR_MESSAGE |
||
76 | ); |
||
77 | $this->shouldAsk(HookQuestions::COMPOSER_TOOL, HookQuestions::DEFAULT_TOOL_ANSWER, $yes); |
||
78 | $this->shouldAsk(HookQuestions::JSONLINT_TOOL, HookQuestions::DEFAULT_TOOL_ANSWER, $yes); |
||
79 | $this->shouldAsk(HookQuestions::PHPLINT_TOOL, HookQuestions::DEFAULT_TOOL_ANSWER, $yes); |
||
80 | $this->shouldAsk(HookQuestions::PHPMD_TOOL, HookQuestions::DEFAULT_TOOL_ANSWER, $yes); |
||
81 | $this->shouldAsk(HookQuestions::PHPMD_OPTIONS, null, ConfigArrayDataStub::PHPMD_OPTIONS); |
||
82 | $this->shouldAsk(HookQuestions::PHPCS_TOOL, HookQuestions::DEFAULT_TOOL_ANSWER, $yes); |
||
83 | $this->shouldAsk(HookQuestions::PHPCS_STANDARD, null, ConfigArrayDataStub::PHPCS_STANDARD); |
||
84 | $this->shouldAsk(HookQuestions::PHPCS_IGNORE, null, ConfigArrayDataStub::EMPTY_STRING); |
||
85 | $this->shouldAsk(HookQuestions::PHPCSFIXER_TOOL, HookQuestions::DEFAULT_TOOL_ANSWER, $yes); |
||
86 | $this->shouldAsk(HookQuestions::PHPCSFIXER_PSR0_LEVEL, HookQuestions::DEFAULT_TOOL_ANSWER, $yes); |
||
87 | $this->shouldAsk(HookQuestions::PHPCSFIXER_PSR1_LEVEL, HookQuestions::DEFAULT_TOOL_ANSWER, $yes); |
||
88 | $this->shouldAsk(HookQuestions::PHPCSFIXER_PSR2_LEVEL, HookQuestions::DEFAULT_TOOL_ANSWER, $yes); |
||
89 | $this->shouldAsk(HookQuestions::PHPCSFIXER_SYMFONY_LEVEL, HookQuestions::DEFAULT_TOOL_ANSWER, $yes); |
||
90 | $this->shouldAsk(HookQuestions::PHPCSFIXER_OPTIONS, null, ConfigArrayDataStub::PHPCSFIXER_OPTIONS); |
||
91 | $this->shouldAsk(HookQuestions::PHPUNIT_TOOL, HookQuestions::DEFAULT_TOOL_ANSWER, $yes); |
||
92 | $this->shouldAsk(HookQuestions::PHPUNIT_RANDOM_MODE, HookQuestions::DEFAULT_TOOL_ANSWER, $yes); |
||
93 | $this->shouldAsk(HookQuestions::PHPUNIT_OPTIONS, null, ConfigArrayDataStub::PHPUNIT_OPTIONS); |
||
94 | $this->shouldAsk(HookQuestions::PHPUNIT_STRICT_COVERAGE, HookQuestions::DEFAULT_TOOL_ANSWER, $yes); |
||
95 | $this->shouldAsk(HookQuestions::PHPUNIT_STRICT_COVERAGE_MINIMUM, 0.00, ConfigArrayDataStub::MINIMUM_COVERAGE); |
||
96 | $this->shouldAsk(HookQuestions::PHPUNIT_GUARD_COVERAGE, HookQuestions::DEFAULT_TOOL_ANSWER, $yes); |
||
97 | $this->shouldAsk( |
||
98 | HookQuestions::PHPUNIT_GUARD_COVERAGE_MESSAGE, |
||
99 | HookQuestions::PHPUNIT_GUARD_COVERAGE_MESSAGE_DEFAULT, |
||
100 | ConfigArrayDataStub::ERROR_MESSAGE |
||
101 | ); |
||
102 | $this->shouldHandleQuery(new GitIgnoreExtractorQuery(), $gitIgnoreDataResponse); |
||
103 | $this->shouldHandleCommand(new GitIgnoreWriterCommand($gitIgnoreDataResponse->getContent())); |
||
104 | |||
105 | $this->shouldAsk(HookQuestions::COMMIT_MSG_HOOK, HookQuestions::DEFAULT_TOOL_ANSWER, $yes); |
||
106 | $this->shouldCopyPreCommitHook(); |
||
107 | $this->shouldAsk( |
||
108 | HookQuestions::COMMIT_MSG_REGULAR_EXPRESSION, |
||
109 | HookQuestions::COMMIT_MSG_REGULAR_EXPRESSION_ANSWER, |
||
110 | ConfigArrayDataStub::REGULAR_EXPRESSION |
||
111 | ); |
||
112 | $this->shouldCopyCommitMsgHook(); |
||
113 | $this->shouldAsk(HookQuestions::PRE_PUSH_HOOK_QUESTION, HookQuestions::DEFAULT_TOOL_ANSWER, $yes); |
||
114 | $this->shouldAsk( |
||
115 | HookQuestions::PRE_PUSH_RIGHT_MESSAGE, |
||
116 | HookQuestions::PRE_PUSH_RIGHT_MESSAGE_DEFAULT, |
||
117 | HookQuestions::PRE_PUSH_RIGHT_MESSAGE_DEFAULT |
||
118 | ); |
||
119 | $this->shouldAsk( |
||
120 | HookQuestions::PRE_PUSH_ERROR_MESSAGE, |
||
121 | HookQuestions::PRE_PUSH_ERROR_MESSAGE_DEFAULT, |
||
122 | HookQuestions::PRE_PUSH_ERROR_MESSAGE_DEFAULT |
||
123 | ); |
||
124 | $this->shouldAsk(HookQuestions::PHPUNIT_TOOL, HookQuestions::DEFAULT_TOOL_ANSWER, $yes); |
||
125 | $this->shouldAsk(HookQuestions::PHPUNIT_RANDOM_MODE, HookQuestions::DEFAULT_TOOL_ANSWER, $yes); |
||
126 | $this->shouldAsk(HookQuestions::PHPUNIT_OPTIONS, null, ConfigArrayDataStub::PHPUNIT_OPTIONS); |
||
127 | $this->shouldAsk(HookQuestions::PHPUNIT_STRICT_COVERAGE, HookQuestions::DEFAULT_TOOL_ANSWER, $yes); |
||
128 | $this->shouldAsk(HookQuestions::PHPUNIT_STRICT_COVERAGE_MINIMUM, 0.00, ConfigArrayDataStub::MINIMUM_COVERAGE); |
||
129 | $this->shouldAsk(HookQuestions::PHPUNIT_GUARD_COVERAGE, HookQuestions::DEFAULT_TOOL_ANSWER, $yes); |
||
130 | $this->shouldAsk( |
||
131 | HookQuestions::PHPUNIT_GUARD_COVERAGE_MESSAGE, |
||
132 | HookQuestions::PHPUNIT_GUARD_COVERAGE_MESSAGE_DEFAULT, |
||
133 | ConfigArrayDataStub::ERROR_MESSAGE |
||
134 | ); |
||
135 | $this->shouldHandleQuery(new GitIgnoreExtractorQuery(), GitIgnoreDataResponseStub::randomWithGuardCoverage()); |
||
136 | $this->shouldCopyPrePushHook(); |
||
137 | $this->shouldWriteConfigurationData(ConfigArrayDataStub::hooksEnabledWithEnabledTools()); |
||
138 | |||
139 | $command = new ConfigurationProcessor($this->getIOInterface()); |
||
140 | |||
141 | $this->configurationProcessorCommandHandler->handle($command); |
||
142 | } |
||
143 | |||
166 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.