Conditions | 15 |
Paths | 385 |
Total Lines | 63 |
Code Lines | 42 |
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 |
||
152 | public function main() |
||
153 | { |
||
154 | if (null === $this->file && 0 == count($this->filesets)) { |
||
155 | throw new BuildException('Missing both attribute "file" and "fileset".'); |
||
156 | } |
||
157 | if (null === $this->file) { |
||
158 | // check filesets, and compile a list of files for phpcs to analyse |
||
159 | foreach ($this->filesets as $fileset) { |
||
160 | $files = $fileset->getIterator(); |
||
161 | foreach ($files as $file) { |
||
162 | $this->files[] = $file; |
||
163 | } |
||
164 | } |
||
165 | } |
||
166 | |||
167 | $toExecute = $this->getCommandline(); |
||
168 | |||
169 | $this->cache |
||
170 | ? $toExecute->createArgument()->setValue('--cache') |
||
171 | : $toExecute->createArgument()->setValue('--no-cache'); |
||
172 | |||
173 | if ($this->ignoreAnnotations) { |
||
174 | $toExecute->createArgument()->setValue('--ignore-annotations'); |
||
175 | } |
||
176 | if ('' !== $this->format) { |
||
177 | $toExecute->createArgument()->setValue(' --report=' . $this->format); |
||
178 | } |
||
179 | if ('' !== $this->standard) { |
||
180 | $toExecute->createArgument()->setValue(' --standard=' . $this->standard); |
||
181 | } |
||
182 | if ('' !== $this->outfile) { |
||
183 | $toExecute->createArgument()->setValue(' --report-file=' . $this->outfile); |
||
184 | } |
||
185 | |||
186 | foreach ($this->formatters as $formatter) { |
||
187 | $formatterReportFile = ($formatter->getUseFile() ? $formatter->getOutFile() : null); |
||
188 | $formatterType = $formatter->getType(); |
||
189 | $this->project->log( |
||
190 | "Generate report of type \"{$formatterType}\" with report written to {$formatterReportFile}", |
||
191 | Project::MSG_VERBOSE |
||
192 | ); |
||
193 | $toExecute->createArgument()->setValue(' --report-' . $formatterType . '=' . $formatterReportFile); |
||
194 | } |
||
195 | |||
196 | if (null !== $this->file) { |
||
197 | $toExecute->createArgument()->setFile($this->file); |
||
198 | } else { |
||
199 | foreach ($this->files as $file) { |
||
200 | $toExecute->createArgument()->setFile(new File($file)); |
||
201 | } |
||
202 | } |
||
203 | |||
204 | $exe = new ExecTask(); |
||
205 | $exe->setProject($this->getProject()); |
||
206 | $exe->setLocation($this->getLocation()); |
||
207 | $exe->setOwningTarget($this->target); |
||
208 | $exe->setTaskName($this->getTaskName()); |
||
209 | $exe->setExecutable($this->bin); |
||
210 | $exe->setCheckreturn($this->checkreturn); |
||
211 | $exe->setLevel($this->logLevelName); |
||
212 | $exe->setExecutable($toExecute->getExecutable()); |
||
213 | $exe->createArg()->setLine(implode(' ', $toExecute->getArguments())); |
||
214 | $exe->main(); |
||
215 | } |
||
217 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths