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