Conditions | 12 |
Paths | 1 |
Total Lines | 41 |
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 |
||
66 | public function saveBefore(): Closure |
||
67 | { |
||
68 | return function () { |
||
69 | |||
70 | $ncfrango = new NCFRango(); |
||
71 | $cliente = new Cliente(); |
||
72 | $appSettins = new AppSettings; |
||
73 | $actualCliente = $cliente->get($this->codcliente); |
||
74 | $actualCliente->idempresa = $appSettins::get('default', 'idempresa'); |
||
75 | $this->tipocomprobante = $this->tipocomprobante ?? $actualCliente->tipocomprobante; |
||
76 | $this->tipocomprobante = $_REQUEST['tipocomprobanter'] ?? $this->tipocomprobante; |
||
77 | $this->numeroncf = (isset($_REQUEST['tipocomprobanter'])) ? '' : $this->numeroncf; |
||
78 | if ($this->tipocomprobante !== '' && \in_array($this->numeroncf, ['', null], true)) { |
||
79 | $tipocomprobante = "02"; |
||
80 | if (($this->tipocomprobante !== null) === true) { |
||
81 | $tipocomprobante = $this->tipocomprobante; |
||
82 | } elseif (($this->tipocomprobante === null) === true) { |
||
83 | $tipocomprobante = $actualCliente->tipocomprobante; |
||
84 | } |
||
85 | |||
86 | $ncfRangoToUse = $ncfrango->getByTipoComprobante($actualCliente->idempresa, $tipocomprobante); |
||
87 | if (!$ncfRangoToUse) { |
||
88 | $this->toolBox()->i18nLog()->error("no-ncf-range-for-$tipocomprobante"); |
||
89 | return false; |
||
90 | } |
||
91 | $ncf = $ncfRangoToUse->generateNCF(); |
||
92 | $this->numeroncf = $ncf; |
||
93 | $this->ncffechavencimiento = $ncfRangoToUse->fechavencimiento; |
||
94 | $this->tipocomprobante = $ncfRangoToUse->tipocomprobante; |
||
95 | $ncfRangoToUse->correlativo++; |
||
96 | $ncfRangoToUse->save(); |
||
97 | if (($this->tipocomprobante === '03' || $this->tipocomprobante === '04') === true) { |
||
98 | $this->ncftipoanulacion = isset($_REQUEST['ncftipoanulacionr']) |
||
99 | ? $_REQUEST['ncftipoanulacionr'] |
||
100 | : $this->ncftipoanulacion; |
||
101 | $this->ncffechavencimiento = isset($_REQUEST['ncffechavencimientor']) |
||
102 | ? $_REQUEST['ncffechavencimientor'] |
||
103 | : $this->ncffechavencimiento; |
||
104 | } |
||
105 | } |
||
106 | $this->ncffechavencimiento = ($this->ncffechavencimiento == '') ? null : $this->ncffechavencimiento; |
||
107 | }; |
||
125 |
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