| Conditions | 11 |
| Paths | 1 |
| Total Lines | 37 |
| Code Lines | 26 |
| 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 |
||
| 87 | public function saveBefore(): Closure |
||
| 88 | { |
||
| 89 | return function () { |
||
| 90 | if (null !== $this->codigorect && $this->idfactura === null) { |
||
| 91 | $this->cleanRefundData(); |
||
| 92 | } |
||
| 93 | $cliente = new Cliente(); |
||
| 94 | $actualCliente = $cliente::find($this->codcliente); |
||
| 95 | |||
| 96 | if (null === $actualCliente) { |
||
| 97 | Tools::log()->error("no-customer-found"); |
||
| 98 | return false; |
||
| 99 | } |
||
| 100 | |||
| 101 | $actualCliente->idempresa = Tools::settings('default', 'idempresa'); |
||
| 102 | $this->tipocomprobante = $this->tipocomprobante ?? $actualCliente->tipocomprobante; |
||
| 103 | $this->tipocomprobante = $_REQUEST['tipocomprobanter'] ?? $this->tipocomprobante; |
||
| 104 | $this->ecf_fecha_firma = $_REQUEST['ecf_fecha_firma'] ?? NULL; |
||
| 105 | if ($this->tipocomprobante !== '' && \in_array($this->numeroncf, ['', null], true)) { |
||
| 106 | $tipocomprobante = "02"; |
||
| 107 | if (($this->tipocomprobante !== null) === true) { |
||
| 108 | $tipocomprobante = $this->tipocomprobante; |
||
| 109 | } elseif (($this->tipocomprobante === null) === true) { |
||
| 110 | $tipocomprobante = $actualCliente->tipocomprobante; |
||
| 111 | } |
||
| 112 | |||
| 113 | $ncfrango = new NCFRango(); |
||
| 114 | if (!CommonModelFunctions::setCFRango($actualCliente, $ncfrango, $tipocomprobante, $this)) return false; |
||
| 115 | |||
| 116 | $arrayNCFTypes = ['03','04']; |
||
| 117 | if (in_array($this->tipocomprobante, $arrayNCFTypes) === true) { |
||
| 118 | $this->ncftipoanulacion = $_REQUEST['ncftipoanulacionr'] ?? $this->ncftipoanulacion; |
||
| 119 | $this->ncffechavencimiento = $_REQUEST['ncffechavencimientor'] ?? $this->ncffechavencimiento; |
||
| 120 | } |
||
| 121 | } |
||
| 122 | $this->ncffechavencimiento = ($this->ncffechavencimiento === '') ? null : $this->ncffechavencimiento; |
||
| 123 | return $this; |
||
| 124 | }; |
||
| 161 |
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