Conditions | 11 |
Paths | 1 |
Total Lines | 45 |
Code Lines | 33 |
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 |
||
67 | public function saveBefore(): Closure |
||
68 | { |
||
69 | return function () { |
||
70 | if (null !== $this->codigorect && $this->idfactura === null) { |
||
2 ignored issues
–
show
|
|||
71 | $this->cleanRefundData(); |
||
72 | } |
||
73 | |||
74 | $cliente = new Cliente(); |
||
75 | $appSettins = new AppSettings; |
||
76 | $actualCliente = $cliente->get($this->codcliente); |
||
77 | $actualCliente->idempresa = $appSettins::get('default', 'idempresa'); |
||
78 | $this->tipocomprobante = $this->tipocomprobante ?? $actualCliente->tipocomprobante; |
||
79 | $this->tipocomprobante = $_REQUEST['tipocomprobanter'] ?? $this->tipocomprobante; |
||
80 | if ($this->tipocomprobante !== '' && \in_array($this->numeroncf, ['', null], true)) { |
||
81 | $tipocomprobante = "02"; |
||
82 | if (($this->tipocomprobante !== null) === true) { |
||
83 | $tipocomprobante = $this->tipocomprobante; |
||
84 | } elseif (($this->tipocomprobante === null) === true) { |
||
85 | $tipocomprobante = $actualCliente->tipocomprobante; |
||
86 | } |
||
87 | |||
88 | if ('' === $this->numeroncf) { |
||
89 | $ncfrango = new NCFRango(); |
||
90 | $ncfRangoToUse = $ncfrango->getByTipoComprobante($actualCliente->idempresa, $tipocomprobante); |
||
91 | if (!$ncfRangoToUse) { |
||
92 | $this->toolBox()->i18nLog()->error("no-ncf-range-for-$tipocomprobante"); |
||
93 | return false; |
||
94 | } |
||
95 | $ncf = $ncfRangoToUse->generateNCF(); |
||
96 | $this->numeroncf = $ncf; |
||
97 | $this->ncffechavencimiento = $ncfRangoToUse->fechavencimiento; |
||
98 | $this->tipocomprobante = $ncfRangoToUse->tipocomprobante; |
||
99 | $ncfRangoToUse->correlativo++; |
||
100 | $ncfRangoToUse->save(); |
||
101 | } |
||
102 | |||
103 | //Verificamos si $this->tipoComprobante es una nota de crédito o debito |
||
104 | $arrayNCFTypes = ['03','04']; |
||
105 | if (in_array($this->tipocomprobante, $arrayNCFTypes) === true) { |
||
106 | $this->ncftipoanulacion = $_REQUEST['ncftipoanulacionr'] ?? $this->ncftipoanulacion; |
||
107 | $this->ncffechavencimiento = $_REQUEST['ncffechavencimientor'] ?? $this->ncffechavencimiento; |
||
108 | } |
||
109 | } |
||
110 | $this->ncffechavencimiento = ($this->ncffechavencimiento === '') ? null : $this->ncffechavencimiento; |
||
111 | return $this; |
||
112 | }; |
||
149 |
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