@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | /** |
121 | 121 | * {@inheritdoc} |
122 | 122 | */ |
123 | - public function getValue(string $key, string|int $code, mixed $default = null): mixed |
|
123 | + public function getValue(string $key, string | int $code, mixed $default = null): mixed |
|
124 | 124 | { |
125 | 125 | $data = $this->getData($key); |
126 | 126 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | } |
145 | 145 | |
146 | 146 | // Filtrar los datos del repositorio. |
147 | - return array_filter($data, function ($row, $code) use ($filters) { |
|
147 | + return array_filter($data, function($row, $code) use ($filters) { |
|
148 | 148 | // Recorrer los filtros e ir descartando lo que no coincida. |
149 | 149 | foreach ($filters as $filter => $values) { |
150 | 150 | // El filtro solicitado es por ID o código. |
@@ -117,7 +117,7 @@ |
||
117 | 117 | if (!$isValid) { |
118 | 118 | $errors = !empty($errors) |
119 | 119 | ? self::translateLibxmlErrors($errors, array_merge($translations, [ |
120 | - '{' . $xmlDocument->getNamespace() . '}' => '', |
|
120 | + '{'.$xmlDocument->getNamespace().'}' => '', |
|
121 | 121 | ])) |
122 | 122 | : [] |
123 | 123 | ; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | ?array $namespace = null, |
75 | 75 | ?DOMElement $parent = null, |
76 | 76 | ?XmlDocument $doc = null |
77 | - ): XmlDocument|DOMElement { |
|
77 | + ): XmlDocument | DOMElement { |
|
78 | 78 | // Si no hay un documento XML completo (desde raíz, no vale un nodo), |
79 | 79 | // entonces se crea, pues se necesitará para crear los futuros nodos. |
80 | 80 | if ($doc === null) { |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | private static function nodeAddChilds( |
186 | 186 | XmlDocument $doc, |
187 | - XmlDocument|DOMElement $parent, |
|
187 | + XmlDocument | DOMElement $parent, |
|
188 | 188 | string $tagName, |
189 | 189 | array $childs, |
190 | 190 | ?array $namespace = null, |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $Node = $namespace |
218 | 218 | ? $doc->createElementNS( |
219 | 219 | $namespace[0], |
220 | - $namespace[1] . ':' . $tagName |
|
220 | + $namespace[1].':'.$tagName |
|
221 | 221 | ) |
222 | 222 | : $doc->createElement($tagName) |
223 | 223 | ; |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | $Node = $namespace |
232 | 232 | ? $doc->createElementNS( |
233 | 233 | $namespace[0], |
234 | - $namespace[1] . ':' . $tagName, |
|
234 | + $namespace[1].':'.$tagName, |
|
235 | 235 | $value |
236 | 236 | ) |
237 | 237 | : $doc->createElement($tagName, $value) |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | $Node = $namespace |
264 | 264 | ? $doc->createElementNS( |
265 | 265 | $namespace[0], |
266 | - $namespace[1] . ':' . $tagName, |
|
266 | + $namespace[1].':'.$tagName, |
|
267 | 267 | $value |
268 | 268 | ) |
269 | 269 | : $doc->createElement($tagName, $value) |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | * @return array Arreglo con la representación del XML. |
313 | 313 | */ |
314 | 314 | public static function xmlToArray( |
315 | - XmlDocument|DOMElement $documentElement, |
|
315 | + XmlDocument | DOMElement $documentElement, |
|
316 | 316 | ?array &$data = null, |
317 | 317 | bool $twinsAsArray = false |
318 | 318 | ): array { |
@@ -83,12 +83,11 @@ |
||
83 | 83 | */ |
84 | 84 | private function libXmlErrorToString(array $errors): array |
85 | 85 | { |
86 | - return array_map(function ($error) { |
|
86 | + return array_map(function($error) { |
|
87 | 87 | if ($error instanceof LibXMLError) { |
88 | 88 | return sprintf( |
89 | 89 | 'Error %s: %s en la línea %d, columna %d (Código: %d).', |
90 | - $error->level === LIBXML_ERR_WARNING ? 'Advertencia' : |
|
91 | - ($error->level === LIBXML_ERR_ERROR ? 'Error' : 'Fatal'), |
|
90 | + $error->level === LIBXML_ERR_WARNING ? 'Advertencia' : ($error->level === LIBXML_ERR_ERROR ? 'Error' : 'Fatal'), |
|
92 | 91 | trim($error->message), |
93 | 92 | $error->line, |
94 | 93 | $error->column, |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $csv->setEnclosure($textDelimiter); |
59 | 59 | return iterator_to_array($csv->getRecords()); |
60 | 60 | } catch (\Exception $e) { |
61 | - throw new RuntimeException('Error al leer el CSV desde el string: ' . $e->getMessage()); |
|
61 | + throw new RuntimeException('Error al leer el CSV desde el string: '.$e->getMessage()); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | if ($sendHttpHeaders) { |
150 | 150 | header('Content-Type: text/csv'); |
151 | - header('Content-Disposition: attachment; filename="' . $file . '.csv"'); |
|
151 | + header('Content-Disposition: attachment; filename="'.$file.'.csv"'); |
|
152 | 152 | header('Pragma: no-cache'); |
153 | 153 | header('Expires: 0'); |
154 | 154 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param string|int $rut |
75 | 75 | * @return string |
76 | 76 | */ |
77 | - public static function format(string|int $rut): string |
|
77 | + public static function format(string | int $rut): string |
|
78 | 78 | { |
79 | 79 | // Si es un string, se espera que venga con DV, el guión es opcional. |
80 | 80 | if (is_string($rut)) { |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | * @param string|integer $rut |
92 | 92 | * @return string |
93 | 93 | */ |
94 | - public static function formatFull(string|int $rut): string |
|
94 | + public static function formatFull(string | int $rut): string |
|
95 | 95 | { |
96 | 96 | $rut = self::format($rut); |
97 | 97 | [$rut, $dv] = self::toArray($rut); |
98 | 98 | |
99 | - return self::addThousandsSeparator($rut) . '-' . $dv; |
|
99 | + return self::addThousandsSeparator($rut).'-'.$dv; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | */ |
189 | 189 | public static function addDv(int $rut): string |
190 | 190 | { |
191 | - return ((string) $rut) . self::calculateDv($rut); |
|
191 | + return ((string) $rut).self::calculateDv($rut); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -253,6 +253,6 @@ discard block |
||
253 | 253 | { |
254 | 254 | [$rut, $dv] = self::toArray($rut); |
255 | 255 | |
256 | - return $rut . '-' . $dv; |
|
256 | + return $rut.'-'.$dv; |
|
257 | 257 | } |
258 | 258 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @param string $tag Tag de la tabla. |
60 | 60 | * @return string|false Glosa del campo o false si no existe. |
61 | 61 | */ |
62 | - public function getGlosa(string $tag): string|false |
|
62 | + public function getGlosa(string $tag): string | false |
|
63 | 63 | { |
64 | 64 | try { |
65 | 65 | $data = $this->dataProvider->getData('aduana'); |
@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | |
95 | 95 | if ($tag === 'TipoBultos') { |
96 | 96 | $valor = $valuesData[$codigo['CodTpoBultos']] ?? $codigo['CodTpoBultos']; |
97 | - $valor = $codigo['CantBultos'] . ' ' . $valor; |
|
97 | + $valor = $codigo['CantBultos'].' '.$valor; |
|
98 | 98 | |
99 | 99 | if (!empty($codigo['IdContainer'])) { |
100 | - $valor .= ' (' . $codigo['IdContainer'] . ' / ' . $codigo['Sello'] . ' / ' . $codigo['EmisorSello'] . ')'; |
|
100 | + $valor .= ' ('.$codigo['IdContainer'].' / '.$codigo['Sello'].' / '.$codigo['EmisorSello'].')'; |
|
101 | 101 | } elseif (!empty($codigo['Marcas'])) { |
102 | - $valor .= ' (' . $codigo['Marcas'] . ')'; |
|
102 | + $valor .= ' ('.$codigo['Marcas'].')'; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | return $valor; |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * @param string $valor Valor a buscar. |
116 | 116 | * @return int|string Código correspondiente o el valor si no se encuentra. |
117 | 117 | */ |
118 | - public function getCodigo(string $tag, string $valor): int|string |
|
118 | + public function getCodigo(string $tag, string $valor): int | string |
|
119 | 119 | { |
120 | 120 | $glosaData = $this->dataProvider->getData('aduana'); |
121 | 121 |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param int $codigo Código del impuesto |
54 | 54 | * @return string A: adicional, R: retención y =false no se pudo determinar. |
55 | 55 | */ |
56 | - public function getTipo(int $codigo): string|false |
|
56 | + public function getTipo(int $codigo): string | false |
|
57 | 57 | { |
58 | 58 | $tipo = $this->dataProvider->getValue( |
59 | 59 | 'impuestos_adicionales_retenciones', |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $codigo, |
77 | 77 | false |
78 | 78 | ); |
79 | - return $glosa['glosa'] ?? 'Impto. cód. ' . $codigo; |
|
79 | + return $glosa['glosa'] ?? 'Impto. cód. '.$codigo; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @param int $codigo Código del impuesto |
86 | 86 | * @return float|false Tasa del impuesto o =false si no se pudo determinar. |
87 | 87 | */ |
88 | - public function getTasa(int $codigo): float|false |
|
88 | + public function getTasa(int $codigo): float | false |
|
89 | 89 | { |
90 | 90 | $tasa = $this->dataProvider->getValue( |
91 | 91 | 'impuestos_adicionales_retenciones', |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @param DataProviderInterface|null $dataProvider Proveedor de datos. |
127 | 127 | */ |
128 | 128 | public function __construct( |
129 | - string|int|null $rut = null, |
|
129 | + string | int | null $rut = null, |
|
130 | 130 | ?string $razon_social = null, |
131 | 131 | ?string $giro = null, |
132 | 132 | ?int $actividad_economica = null, |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public function getRut(): string |
241 | 241 | { |
242 | - return $this->rut . '-' . $this->dv; |
|
242 | + return $this->rut.'-'.$this->dv; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |