| Conditions | 16 |
| Paths | 161 |
| Total Lines | 96 |
| Code Lines | 59 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| 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 |
||
| 56 | public function generar_pdf_cabecera(&$empresa, &$lppag) |
||
| 57 | { |
||
| 58 | /// ¿Añadimos el logo? |
||
| 59 | if ($this->logo !== false) { |
||
| 60 | if (function_exists('imagecreatefromstring')) { |
||
| 61 | $lppag -= 2; /// si metemos el logo, caben menos líneas |
||
| 62 | |||
| 63 | $tamanyo = $this->calcular_tamanyo_logo(); |
||
| 64 | if (strtolower(substr($this->logo, -4)) === '.png') { |
||
| 65 | $this->pdf->addPngFromFile($this->logo, self::LOGO_X, self::LOGO_Y, $tamanyo[0], $tamanyo[1]); |
||
| 66 | } elseif (function_exists('imagepng')) { |
||
| 67 | /** |
||
| 68 | * La librería ezpdf tiene problemas al redimensionar jpegs, |
||
| 69 | * así que hacemos la conversión a png para evitar estos problemas. |
||
| 70 | */ |
||
| 71 | if (imagepng(imagecreatefromstring(file_get_contents($this->logo)), FS_MYDOCS |
||
|
1 ignored issue
–
show
|
|||
| 72 | . 'images/logo.png')) { |
||
| 73 | $this->pdf->addPngFromFile( |
||
| 74 | FS_MYDOCS . 'images/logo.png', |
||
| 75 | self::LOGO_X, |
||
| 76 | self::LOGO_Y, |
||
| 77 | $tamanyo[0], |
||
| 78 | $tamanyo[1] |
||
| 79 | ); |
||
| 80 | } else { |
||
| 81 | $this->pdf->addJpegFromFile($this->logo, self::LOGO_X, self::LOGO_Y, $tamanyo[0], $tamanyo[1]); |
||
| 82 | } |
||
| 83 | } else { |
||
| 84 | $this->pdf->addJpegFromFile($this->logo, self::LOGO_X, self::LOGO_Y, $tamanyo[0], $tamanyo[1]); |
||
| 85 | } |
||
| 86 | |||
| 87 | $this->pdf->ez['rightMargin'] = 40; |
||
| 88 | $this->pdf->ezText( |
||
| 89 | "<b>" . fs_fix_html($empresa->nombre) . "</b>", |
||
| 90 | 12, |
||
| 91 | array('justification' => 'right') |
||
| 92 | ); |
||
| 93 | $this->pdf->ezText(FS_CIFNIF . ": " . $empresa->cifnif, 8, array('justification' => 'right')); |
||
|
1 ignored issue
–
show
|
|||
| 94 | |||
| 95 | $direccion = $empresa->direccion . "\n"; |
||
| 96 | if ($empresa->apartado) { |
||
| 97 | $direccion .= ucfirst(FS_APARTADO) . ': ' . $empresa->apartado . ' - '; |
||
|
1 ignored issue
–
show
|
|||
| 98 | } |
||
| 99 | |||
| 100 | if ($empresa->codpostal) { |
||
| 101 | $direccion .= 'CP: ' . $empresa->codpostal . ' - '; |
||
| 102 | } |
||
| 103 | |||
| 104 | if ($empresa->ciudad) { |
||
| 105 | $direccion .= $empresa->ciudad . ' - '; |
||
| 106 | } |
||
| 107 | |||
| 108 | if ($empresa->provincia) { |
||
| 109 | $direccion .= '(' . $empresa->provincia . ')'; |
||
| 110 | } |
||
| 111 | |||
| 112 | if ($empresa->telefono) { |
||
| 113 | $direccion .= "\nTeléfono: " . $empresa->telefono; |
||
| 114 | } |
||
| 115 | |||
| 116 | $this->pdf->ezText(fs_fix_html($direccion) . "\n", 8, array('justification' => 'right')); |
||
| 117 | $this->set_y(self::LOGO_Y + 10); |
||
| 118 | } else { |
||
| 119 | die('ERROR: no se encuentra la función imagecreatefromstring(). ' |
||
| 120 | . 'Y por tanto no se puede usar el logotipo en los documentos.'); |
||
| 121 | } |
||
| 122 | } else { |
||
| 123 | $this->pdf->ezText( |
||
| 124 | "<b>" . fs_fix_html($empresa->nombre) . "</b>", |
||
| 125 | 12, |
||
| 126 | array('justification' => 'center') |
||
| 127 | ); |
||
| 128 | $this->pdf->ezText(FS_CIFNIF . ": " . $empresa->cifnif, 8, array('justification' => 'center')); |
||
| 129 | |||
| 130 | $direccion = $empresa->direccion; |
||
| 131 | if ($empresa->apartado) { |
||
| 132 | $direccion .= ' - ' . ucfirst(FS_APARTADO) . ': ' . $empresa->apartado; |
||
| 133 | } |
||
| 134 | |||
| 135 | if ($empresa->codpostal) { |
||
| 136 | $direccion .= ' - CP: ' . $empresa->codpostal; |
||
| 137 | } |
||
| 138 | |||
| 139 | if ($empresa->ciudad) { |
||
| 140 | $direccion .= ' - ' . $empresa->ciudad; |
||
| 141 | } |
||
| 142 | |||
| 143 | if ($empresa->provincia) { |
||
| 144 | $direccion .= ' (' . $empresa->provincia . ')'; |
||
| 145 | } |
||
| 146 | |||
| 147 | if ($empresa->telefono) { |
||
| 148 | $direccion .= ' - Teléfono: ' . $empresa->telefono; |
||
| 149 | } |
||
| 150 | |||
| 151 | $this->pdf->ezText(fs_fix_html($direccion), 8, array('justification' => 'center')); |
||
| 152 | } |
||
| 351 | } |
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