| Conditions | 12 |
| Paths | 13 |
| Total Lines | 28 |
| Code Lines | 20 |
| 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 |
||
| 39 | protected function setSpecificAttribute(string $key, $value): MetadataInterface |
||
| 40 | { |
||
| 41 | switch(mb_strtolower($key)) |
||
| 42 | { |
||
| 43 | case 'compression': |
||
| 44 | case 'compression lossless': |
||
| 45 | $this->lossless = ($value == 'true' || $value == 'Uncompressed'); |
||
| 46 | break; |
||
| 47 | |||
| 48 | case 'height': |
||
| 49 | case 'image height': |
||
| 50 | case 'tiff:imageheigth': |
||
| 51 | case 'tiff:imagelength': |
||
| 52 | $this->height = (int) $value; |
||
| 53 | break; |
||
| 54 | |||
| 55 | case 'width': |
||
| 56 | case 'image width': |
||
| 57 | case 'tiff:imagewidth': |
||
| 58 | $this->width = (int) $value; |
||
| 59 | break; |
||
| 60 | |||
| 61 | case 'x-tika:content': |
||
| 62 | $this->content = $value; |
||
| 63 | break; |
||
| 64 | } |
||
| 65 | |||
| 66 | return $this; |
||
| 67 | } |
||
| 69 |