Conditions | 10 |
Paths | 10 |
Total Lines | 39 |
Code Lines | 25 |
Lines | 0 |
Ratio | 0 % |
Tests | 15 |
CRAP Score | 13.2218 |
Changes | 1 | ||
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 |
||
28 | 10 | public function getValue($name) |
|
29 | { |
||
30 | switch ($name) { |
||
31 | 10 | case 'ThumbnailMIMEType': |
|
32 | 3 | switch ($this->getValue('MIMEType')) { |
|
33 | 3 | case 'application/psd': |
|
34 | return 'image/png'; |
||
35 | 3 | case 'image/tiff': |
|
36 | return 'image/jpeg'; |
||
37 | default: |
||
38 | 3 | return $this->getValue('MIMEType'); |
|
39 | } |
||
40 | |||
41 | // no break |
||
42 | 10 | case 'Extension': |
|
43 | |||
44 | 8 | switch ($this->getValue('MIMEType')) { |
|
45 | 8 | case 'application/psd': |
|
46 | return 'psd'; |
||
47 | |||
48 | 8 | case 'image/tiff': |
|
49 | return 'tif'; |
||
50 | |||
51 | 8 | case 'image/gif': |
|
52 | return 'gif'; |
||
53 | |||
54 | 8 | case 'image/jpeg': |
|
55 | return 'jpg'; |
||
56 | |||
57 | 8 | case 'image/png': |
|
58 | 8 | return 'png'; |
|
59 | |||
60 | default: |
||
61 | throw new Exception('Unable to find photo extension for mime-type: '.$this->getValue('MIMEType')); |
||
62 | } |
||
63 | |||
64 | // no break |
||
65 | default: |
||
66 | 10 | return parent::getValue($name); |
|
67 | } |
||
91 |
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