| Conditions | 10 |
| Paths | 18 |
| Total Lines | 33 |
| Code Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| 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 |
||
| 54 | public function beforeSave() |
||
| 55 | { |
||
| 56 | $value = $this->getValue(); |
||
| 57 | |||
| 58 | if (!empty($value['value'])) { |
||
| 59 | $this->setValue($value['value']); |
||
| 60 | } elseif (!isset($value['value'])) { |
||
| 61 | $this->setValue(''); |
||
| 62 | } |
||
| 63 | |||
| 64 | if (is_array($value) && !empty($value['delete'])) { |
||
| 65 | $sCurrentFile = $this->applePayHelper->getApplePayUploadPath().$value['value']; |
||
| 66 | if (file_exists($sCurrentFile)) { |
||
| 67 | unlink($sCurrentFile); |
||
| 68 | } |
||
| 69 | $this->setValue(''); |
||
| 70 | return $this; |
||
| 71 | } |
||
| 72 | |||
| 73 | if (empty($value['tmp_name'])) { |
||
| 74 | return $this; |
||
| 75 | } |
||
| 76 | |||
| 77 | $tmpPath = $this->_tmpDirectory->getRelativePath($value['tmp_name']); |
||
| 78 | if ($tmpPath && $this->_tmpDirectory->isExist($tmpPath)) { |
||
| 79 | if (!$this->_tmpDirectory->stat($tmpPath)['size']) { |
||
| 80 | throw new \Magento\Framework\Exception\LocalizedException(__('The certificate file is empty.')); |
||
| 81 | } |
||
| 82 | $this->setValue($value['name']); |
||
| 83 | |||
| 84 | $this->moveFile($value['tmp_name'], $value['name']); |
||
| 85 | } |
||
| 86 | return $this; |
||
| 87 | } |
||
| 105 |
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