Conditions | 15 |
Paths | 192 |
Total Lines | 71 |
Code Lines | 50 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
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 |
||
26 | protected function insertBusinessDocHeader($model): void |
||
27 | { |
||
28 | $headerData = [ |
||
29 | 'title' => $this->i18n->trans($model->modelClassName() . '-min'), |
||
30 | 'subject' => $this->i18n->trans('customer'), |
||
31 | 'fieldName' => 'nombrecliente' |
||
32 | ]; |
||
33 | |||
34 | if (isset($model->codproveedor)) { |
||
35 | $headerData['subject'] = $this->i18n->trans('supplier'); |
||
36 | $headerData['fieldName'] = 'nombre'; |
||
37 | } |
||
38 | |||
39 | if (!empty($this->format->titulo)) { |
||
40 | $headerData['title'] = Utils::fixHtml($this->format->titulo); |
||
41 | } |
||
42 | |||
43 | $this->pdf->ezText("\n" . $headerData['title'] . ': ' . $model->codigo . "\n", self::FONT_SIZE + 6); |
||
44 | $this->newLine(); |
||
45 | |||
46 | $subject = $model->getSubject(); |
||
47 | $tipoidfiscal = empty($subject->tipoidfiscal) ? $this->i18n->trans('cifnif') : $subject->tipoidfiscal; |
||
48 | $serie = $model->getSerie(); |
||
49 | |||
50 | $tableData = [ |
||
51 | ['key' => $headerData['subject'], 'value' => Utils::fixHtml($model->{$headerData['fieldName']})], |
||
52 | ['key' => $this->i18n->trans('date'), 'value' => $model->fecha], |
||
53 | ['key' => $this->i18n->trans('address'), 'value' => $this->getDocAddress($subject, $model)], |
||
54 | ['key' => $this->i18n->trans('code'), 'value' => $model->codigo], |
||
55 | ['key' => $tipoidfiscal, 'value' => $model->cifnif], |
||
56 | ['key' => $this->i18n->trans('tipocomprobante'), 'value' => $model->tipocomprobante], |
||
57 | ['key' => $this->i18n->trans('number'), 'value' => $model->numero], |
||
58 | ['key' => $this->i18n->trans('due-date'), 'value' => $model->ncffechavencimiento], |
||
59 | ['key' => $this->i18n->trans('serie'), 'value' => $serie->descripcion], |
||
60 | ]; |
||
61 | |||
62 | // rectified invoice? |
||
63 | if (!empty($model->codigorect) && isset($model->codigorect)) { |
||
64 | $facturaOrigen = $model->parentDocuments(); |
||
65 | $tableData[9] = ['key' => $this->i18n->trans('ncf-modifies'), 'value' => $facturaOrigen[0]->numeroncf]; |
||
66 | } |
||
67 | |||
68 | if (property_exists($model, 'numproveedor') && $model->numeroncf) { |
||
69 | $tableData[3] = ['key' => $this->i18n->trans('ncf-number'), 'value' => $model->numeroncf]; |
||
70 | } elseif (property_exists($model, 'numeroncf') && $model->numeroncf) { |
||
71 | $tipoComprobante = new NCFTipo(); |
||
72 | $tableData[3] = ['key' => $this->i18n->trans('ncf-number'), 'value' => $model->numeroncf]; |
||
73 | } else { |
||
74 | $tableData[3] = ['key' => $this->i18n->trans('serie'), 'value' => $serie->descripcion]; |
||
75 | unset($tableData[6]); |
||
76 | } |
||
77 | |||
78 | if (property_exists($model, 'tipocomprobante') && $model->tipocomprobante) { |
||
79 | $tipoComprobante = new NCFTipo(); |
||
80 | $dataTC = $tipoComprobante->get($model->tipocomprobante); |
||
81 | $tableData[5] = ['key' => $this->i18n->trans('tipocomprobante'), 'value' => $dataTC->descripcion]; |
||
82 | } |
||
83 | |||
84 | $tableOptions = [ |
||
85 | 'width' => $this->tableWidth, |
||
86 | 'showHeadings' => 0, |
||
87 | 'shaded' => 0, |
||
88 | 'lineCol' => [1, 1, 1], |
||
89 | 'cols' => [] |
||
90 | ]; |
||
91 | $this->insertParallelTable($tableData, '', $tableOptions); |
||
92 | $this->pdf->ezText(''); |
||
93 | |||
94 | if (!empty($model->idcontactoenv) |
||
95 | && ($model->idcontactoenv !== $model->idcontactofact || !empty($model->codtrans))) { |
||
96 | $this->insertBusinessDocShipping($model); |
||
97 | } |
||
99 | } |
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