Completed
Push — master ( ac39a4...a8792c )
by Esteban De La Fuente
01:43
created
lib/Arreglo.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
     public static function mergeRecursiveDistinct(array $array1, array $array2)
43 43
     {
44 44
         $merged = $array1;
45
-        foreach ( $array2 as $key => &$value ) {
45
+        foreach ($array2 as $key => &$value) {
46 46
             if (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) {
47 47
                 $merged [$key] = self::mergeRecursiveDistinct(
48 48
                     $merged [$key],
Please login to merge, or discard this patch.
lib/FirmaElectronica.php 3 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -317,10 +317,10 @@  discard block
 block discarded – undo
317 317
      */
318 318
     public function verify($data, $signature, $pub_key = null, $signature_alg = OPENSSL_ALGO_SHA1)
319 319
     {
320
-        if ($pub_key === null)
320
+        if ($pub_key===null)
321 321
             $pub_key = $this->certs['cert'];
322 322
         $pub_key = $this->normalizeCert($pub_key);
323
-        return openssl_verify($data, base64_decode($signature), $pub_key, $signature_alg) == 1 ? true : false;
323
+        return openssl_verify($data, base64_decode($signature), $pub_key, $signature_alg)==1 ? true : false;
324 324
     }
325 325
 
326 326
     /**
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
         } else {
452 452
             $digest_calculado = base64_encode(sha1($doc->C14N(), true));
453 453
         }
454
-        return $digest_original == $digest_calculado;
454
+        return $digest_original==$digest_calculado;
455 455
     }
456 456
 
457 457
     /**
Please login to merge, or discard this patch.
Doc Comments   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     /**
101 101
      * Método para generar un error usando una excepción de SowerPHP o terminar
102 102
      * el script si no se está usando el framework
103
-     * @param msg Mensaje del error
103
+     * @param msg string del error
104 104
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
105 105
      * @version 2017-08-04
106 106
      */
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 
189 189
     /**
190 190
      * Método que entrega desde cuando es válida la firma
191
-     * @return validFrom_time_t
191
+     * @return string
192 192
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
193 193
      * @version 2015-09-22
194 194
      */
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 
200 200
     /**
201 201
      * Método que entrega hasta cuando es válida la firma
202
-     * @return validTo_time_t
202
+     * @return string
203 203
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
204 204
      * @version 2015-09-22
205 205
      */
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 
233 233
     /**
234 234
      * Método que obtiene el módulo de la clave privada
235
-     * @return Módulo en base64
235
+     * @return string en base64
236 236
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
237 237
      * @version 2014-12-07
238 238
      */
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 
245 245
     /**
246 246
      * Método que obtiene el exponente público de la clave privada
247
-     * @return Exponente público en base64
247
+     * @return string público en base64
248 248
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
249 249
      * @version 2014-12-06
250 250
      */
@@ -294,9 +294,9 @@  discard block
 block discarded – undo
294 294
 
295 295
     /**
296 296
      * Método para realizar la firma de datos
297
-     * @param data Datos que se desean firmar
297
+     * @param data string que se desean firmar
298 298
      * @param signature_alg Algoritmo que se utilizará para firmar (por defect SHA1)
299
-     * @return Firma digital de los datos en base64 o =false si no se pudo firmar
299
+     * @return boolean|string digital de los datos en base64 o =false si no se pudo firmar
300 300
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
301 301
      * @version 2014-12-08
302 302
      */
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 
312 312
     /**
313 313
      * Método que verifica la firma digital de datos
314
-     * @param data Datos que se desean verificar
314
+     * @param data string que se desean verificar
315 315
      * @param signature Firma digital de los datos en base64
316 316
      * @param pub_key Certificado digital, clave pública, de la firma
317 317
      * @param signature_alg Algoritmo que se usó para firmar (por defect SHA1)
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
      *
335 335
      * @param xml Datos XML que se desean firmar
336 336
      * @param reference Referencia a la que hace la firma
337
-     * @return XML firmado o =false si no se pudo fimar
337
+     * @return boolean|string firmado o =false si no se pudo fimar
338 338
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
339 339
      * @version 2017-10-22
340 340
      */
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -168,8 +168,9 @@  discard block
 block discarded – undo
168 168
      */
169 169
     public function getName()
170 170
     {
171
-        if (isset($this->data['subject']['CN']))
172
-            return $this->data['subject']['CN'];
171
+        if (isset($this->data['subject']['CN'])) {
172
+                    return $this->data['subject']['CN'];
173
+        }
173 174
         return $this->error('No fue posible obtener el Name (subject.CN) de la firma');
174 175
     }
175 176
 
@@ -353,8 +354,9 @@  discard block
 block discarded – undo
353 354
      */
354 355
     public function verify($data, $signature, $pub_key = null, $signature_alg = OPENSSL_ALGO_SHA1)
355 356
     {
356
-        if ($pub_key === null)
357
-            $pub_key = $this->certs['cert'];
357
+        if ($pub_key === null) {
358
+                    $pub_key = $this->certs['cert'];
359
+        }
358 360
         $pub_key = $this->normalizeCert($pub_key);
359 361
         return openssl_verify($data, base64_decode($signature), $pub_key, $signature_alg) == 1 ? true : false;
360 362
     }
@@ -453,8 +455,9 @@  discard block
 block discarded – undo
453 455
         // calcular SignatureValue
454 456
         $SignedInfo = $doc->saveHTML($Signature->getElementsByTagName('SignedInfo')->item(0));
455 457
         $firma = $this->sign($SignedInfo);
456
-        if (!$firma)
457
-            return false;
458
+        if (!$firma) {
459
+                    return false;
460
+        }
458 461
         $signature = wordwrap($firma, $this->config['wordwrap'], "\n", true);
459 462
         // reemplazar valores en la firma de
460 463
         $Signature->getElementsByTagName('SignatureValue')->item(0)->nodeValue = $signature;
@@ -486,8 +489,9 @@  discard block
 block discarded – undo
486 489
         $signature = $Signature->getElementsByTagName('SignatureValue')->item(0)->nodeValue;
487 490
         $pub_key = $Signature->getElementsByTagName('X509Certificate')->item(0)->nodeValue;
488 491
         // verificar firma
489
-        if (!$this->verify($signed_info, $signature, $pub_key))
490
-            return false;
492
+        if (!$this->verify($signed_info, $signature, $pub_key)) {
493
+                    return false;
494
+        }
491 495
         // verificar digest
492 496
         $digest_original = $Signature->getElementsByTagName('DigestValue')->item(0)->nodeValue;
493 497
         if ($tag) {
Please login to merge, or discard this patch.
lib/CSV.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public static function read($archivo, $separador = ';', $delimitadortexto = '"')
48 48
     {
49
-        if (($handle = fopen($archivo, 'r')) !== FALSE) {
49
+        if (($handle = fopen($archivo, 'r'))!==FALSE) {
50 50
             $data = array();
51 51
             $i = 0;
52
-            while (($row = fgetcsv($handle, 0, $separador, $delimitadortexto)) !== FALSE) {
52
+            while (($row = fgetcsv($handle, 0, $separador, $delimitadortexto))!==FALSE) {
53 53
                 $j = 0;
54 54
                 foreach ($row as &$col) {
55 55
                     $data[$i][$j++] = $col;
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
         header('Content-Disposition: attachment; filename='.$archivo.'.csv');
78 78
         header('Pragma: no-cache');
79 79
         header('Expires: 0');
80
-        foreach($data as &$row) {
81
-            foreach($row as &$col) {
80
+        foreach ($data as &$row) {
81
+            foreach ($row as &$col) {
82 82
                 $col = $delimitadortexto.rtrim(str_replace('<br />', ', ', strip_tags($col, '<br>')), " \t\n\r\0\x0B,").$delimitadortexto;
83 83
             }
84
-            echo implode($separador, $row),"\r\n";
84
+            echo implode($separador, $row), "\r\n";
85 85
             unset($row);
86 86
         }
87 87
         unset($data);
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
     public static function save(array $data, $archivo, $separador = ';', $delimitadortexto = '"')
101 101
     {
102 102
         $fd = fopen($archivo, 'w');
103
-        foreach($data as &$row) {
104
-            foreach($row as &$col) {
103
+        foreach ($data as &$row) {
104
+            foreach ($row as &$col) {
105 105
                 $col = $delimitadortexto.rtrim(str_replace('<br />', ', ', strip_tags($col, '<br>')), " \t\n\r\0\x0B,").$delimitadortexto;
106 106
             }
107 107
             fwrite($fd, implode($separador, $row)."\r\n");
Please login to merge, or discard this patch.
lib/Estado.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -174,12 +174,14 @@
 block discarded – undo
174 174
     public static function get($codigo, $args = null)
175 175
     {
176 176
         // si no hay glosa asociada al código se entrega el mismo código
177
-        if (!isset(self::$glosas[(int)$codigo]))
178
-            return (int)$codigo;
177
+        if (!isset(self::$glosas[(int)$codigo])) {
178
+                    return (int)$codigo;
179
+        }
179 180
         // si los argumentos no son un arreglo se obtiene arreglo a partir
180 181
         // de los argumentos pasados a la función
181
-        if (!is_array($args))
182
-            $args = array_slice(func_get_args(), 1);
182
+        if (!is_array($args)) {
183
+                    $args = array_slice(func_get_args(), 1);
184
+        }
183 185
         // entregar glosa
184 186
         return vsprintf(I18n::translate(self::$glosas[(int)$codigo], 'estados'), $args);
185 187
     }
Please login to merge, or discard this patch.
lib/Sii/Factoring/DteCedido.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
 
69 69
     /**
70 70
      * Método que realiza la firma del DTE cedido
71
-     * @param Firma objeto que representa la Firma Electrónca
71
+     * @param Firma \sasco\LibreDTE\FirmaElectronica que representa la Firma Electrónca
72 72
      * @return =true si el DTE pudo ser fimado o =false si no se pudo firmar
73 73
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
74 74
      * @version 2016-12-10
Please login to merge, or discard this patch.
examples/016-etapa_intercambio_EnvioRecibos.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,4 +66,4 @@
 block discarded – undo
66 66
 
67 67
 // si hubo errores mostrar
68 68
 foreach (\sasco\LibreDTE\Log::readAll() as $error)
69
-    echo $error,"\n";
69
+    echo $error, "\n";
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,5 +98,6 @@
 block discarded – undo
98 98
 }
99 99
 
100 100
 // si hubo errores mostrar
101
-foreach (\sasco\LibreDTE\Log::readAll() as $error)
101
+foreach (\sasco\LibreDTE\Log::readAll() as $error) {
102 102
     echo $error,"\n";
103
+}
Please login to merge, or discard this patch.
examples/027-ventas_sin_movimiento.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,4 +66,4 @@
 block discarded – undo
66 66
 
67 67
 // si hubo errores mostrar
68 68
 foreach (\sasco\LibreDTE\Log::readAll() as $error)
69
-    echo $error,"\n";
69
+    echo $error, "\n";
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,5 +65,6 @@
 block discarded – undo
65 65
 var_dump($track_id);
66 66
 
67 67
 // si hubo errores mostrar
68
-foreach (\sasco\LibreDTE\Log::readAll() as $error)
68
+foreach (\sasco\LibreDTE\Log::readAll() as $error) {
69 69
     echo $error,"\n";
70
+}
Please login to merge, or discard this patch.
examples/030-boleta_consumo_folio.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,4 +66,4 @@
 block discarded – undo
66 66
 
67 67
 // si hubo errores mostrar
68 68
 foreach (\sasco\LibreDTE\Log::readAll() as $error)
69
-    echo $error,"\n";
69
+    echo $error, "\n";
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,5 +98,6 @@
 block discarded – undo
98 98
 }
99 99
 
100 100
 // si hubo errores mostrar
101
-foreach (\sasco\LibreDTE\Log::readAll() as $error)
101
+foreach (\sasco\LibreDTE\Log::readAll() as $error) {
102 102
     echo $error,"\n";
103
+}
Please login to merge, or discard this patch.
examples/034-xml_entities.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -83,5 +83,6 @@
 block discarded – undo
83 83
 echo $XML2->getFlattened('/nodo1/nodo2')."\n\n";
84 84
 
85 85
 // si hubo errores mostrar
86
-foreach (\sasco\LibreDTE\Log::readAll() as $error)
86
+foreach (\sasco\LibreDTE\Log::readAll() as $error) {
87 87
     echo $error, "\n";
88
+}
Please login to merge, or discard this patch.