Completed
Push — master ( 42b7be...e7032c )
by Esteban De La Fuente
01:53
created
lib/File.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
 
74 74
     /**
75 75
      * Método que entrega el mimetype de un archivo
76
-     * @param file Ruta hacia el fichero
76
+     * @param file string hacia el fichero
77 77
      * @return Mimetype del fichero o =false si no se pudo determinar
78 78
      * @author http://stackoverflow.com/a/23287361
79 79
      * @version 2015-11-03
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -49,18 +49,18 @@  discard block
 block discarded – undo
49 49
     public static function rmdir($dir)
50 50
     {
51 51
         // List the contents of the directory table
52
-        $dir_content = scandir ($dir);
52
+        $dir_content = scandir($dir);
53 53
         // Is it a directory?
54 54
         if ($dir_content!==false) {
55 55
             // For each directory entry
56 56
             foreach ($dir_content as &$entry) {
57 57
                 // Unix symbolic shortcuts, we go
58
-                if (!in_array ($entry, array ('.','..'))) {
58
+                if (!in_array($entry, array('.', '..'))) {
59 59
                     // We find the path from the beginning
60
-                    $entry = $dir.DIRECTORY_SEPARATOR. $entry;
60
+                    $entry = $dir.DIRECTORY_SEPARATOR.$entry;
61 61
                     // This entry is not an issue: it clears
62 62
                     if (!is_dir($entry)) {
63
-                        unlink ($entry);
63
+                        unlink($entry);
64 64
                     } else { // This entry is a folder, it again on this issue
65 65
                         self::rmdir($entry);
66 66
                     }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             }
69 69
         }
70 70
         // It has erased all entries in the folder, we can now erase
71
-        rmdir ($dir);
71
+        rmdir($dir);
72 72
     }
73 73
 
74 74
     /**
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
         // enviar archivo
161 161
         if ($options['download']) {
162 162
             ob_clean();
163
-            header ('Content-Disposition: attachment; filename='.$file_compressed);
163
+            header('Content-Disposition: attachment; filename='.$file_compressed);
164 164
             $mimetype = self::mimetype($dir.DIRECTORY_SEPARATOR.$file_compressed);
165 165
             if ($mimetype)
166
-                header ('Content-Type: '.$mimetype);
167
-            header ('Content-Length: '.filesize($dir.DIRECTORY_SEPARATOR.$file_compressed));
166
+                header('Content-Type: '.$mimetype);
167
+            header('Content-Length: '.filesize($dir.DIRECTORY_SEPARATOR.$file_compressed));
168 168
             readfile($dir.DIRECTORY_SEPARATOR.$file_compressed);
169 169
             unlink($dir.DIRECTORY_SEPARATOR.$file_compressed);
170 170
         }
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -80,8 +80,9 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public static function mimetype($file)
82 82
     {
83
-        if (!function_exists('finfo_open'))
84
-            return false;
83
+        if (!function_exists('finfo_open')) {
84
+                    return false;
85
+        }
85 86
         $finfo = finfo_open(FILEINFO_MIME_TYPE);
86 87
         $mimetype = finfo_file($finfo, $file);
87 88
         finfo_close($finfo);
@@ -121,8 +122,11 @@  discard block
 block discarded – undo
121 122
         }
122 123
         // si es formato gz y es directorio se cambia a tgz
123 124
         if (is_dir($file)) {
124
-            if ($options['format']=='gz') $options['format'] = 'tar.gz';
125
-            else if ($options['format']=='bz2') $options['format'] = 'tar.bz2';
125
+            if ($options['format']=='gz') {
126
+                $options['format'] = 'tar.gz';
127
+            } else if ($options['format']=='bz2') {
128
+                $options['format'] = 'tar.bz2';
129
+            }
126 130
         }
127 131
         // obtener directorio que contiene al archivo/directorio y el nombre de este
128 132
         $filepath = $file;
@@ -162,8 +166,9 @@  discard block
 block discarded – undo
162 166
             ob_clean();
163 167
             header ('Content-Disposition: attachment; filename='.$file_compressed);
164 168
             $mimetype = self::mimetype($dir.DIRECTORY_SEPARATOR.$file_compressed);
165
-            if ($mimetype)
166
-                header ('Content-Type: '.$mimetype);
169
+            if ($mimetype) {
170
+                            header ('Content-Type: '.$mimetype);
171
+            }
167 172
             header ('Content-Length: '.filesize($dir.DIRECTORY_SEPARATOR.$file_compressed));
168 173
             readfile($dir.DIRECTORY_SEPARATOR.$file_compressed);
169 174
             unlink($dir.DIRECTORY_SEPARATOR.$file_compressed);
@@ -171,8 +176,11 @@  discard block
 block discarded – undo
171 176
         // borrar directorio o archivo que se está comprimiendo si así se ha
172 177
         // solicitado
173 178
         if ($options['delete']) {
174
-            if (is_dir($filepath)) self::rmdir($filepath);
175
-            else unlink($filepath);
179
+            if (is_dir($filepath)) {
180
+                self::rmdir($filepath);
181
+            } else {
182
+                unlink($filepath);
183
+            }
176 184
         }
177 185
     }
178 186
 
Please login to merge, or discard this patch.
lib/Log.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
      * Método que escribe un mensaje en la bitácora
59 59
      * @param code Código del mensaje que se desea escribir
60 60
      * @param msg Mensaje que se desea escribir
61
-     * @param severity Gravedad del mensaje, por defecto LOG_ERR (puede ser cualquiera de las constantes PHP de syslog)
61
+     * @param severity integer del mensaje, por defecto LOG_ERR (puede ser cualquiera de las constantes PHP de syslog)
62 62
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
63 63
      * @version 2015-09-16
64 64
      */
Please login to merge, or discard this patch.
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -65,8 +65,9 @@  discard block
 block discarded – undo
65 65
     public static function write($code, $msg = null, $severity = LOG_ERR)
66 66
     {
67 67
         // si no existe la bitácora para la gravedad se crea
68
-        if (!isset(self::$bitacora[$severity]))
69
-            self::$bitacora[$severity] = [];
68
+        if (!isset(self::$bitacora[$severity])) {
69
+                    self::$bitacora[$severity] = [];
70
+        }
70 71
         // si el código es un string se copia a msg
71 72
         if (is_string($code)) {
72 73
             $msg = $code;
@@ -97,8 +98,9 @@  discard block
 block discarded – undo
97 98
      */
98 99
     public static function read($severity = LOG_ERR)
99 100
     {
100
-        if (!isset(self::$bitacora[$severity]))
101
-            return false;
101
+        if (!isset(self::$bitacora[$severity])) {
102
+                    return false;
103
+        }
102 104
         return array_pop(self::$bitacora[$severity]);
103 105
     }
104 106
 
@@ -112,11 +114,13 @@  discard block
 block discarded – undo
112 114
      */
113 115
     public static function readAll($severity = LOG_ERR, $new_first = true)
114 116
     {
115
-        if (!isset(self::$bitacora[$severity]))
116
-            return [];
117
+        if (!isset(self::$bitacora[$severity])) {
118
+                    return [];
119
+        }
117 120
         $bitacora = self::$bitacora[$severity];
118
-        if ($new_first)
119
-            krsort($bitacora);
121
+        if ($new_first) {
122
+                    krsort($bitacora);
123
+        }
120 124
         self::$bitacora[$severity] = [];
121 125
         return $bitacora;
122 126
     }
@@ -163,8 +167,9 @@  discard block
 block discarded – undo
163 167
     public function __toString()
164 168
     {
165 169
         $msg = $this->msg ? $this->msg : 'Error código '.$this->code;
166
-        if (!$this->file)
167
-            return $msg;
170
+        if (!$this->file) {
171
+                    return $msg;
172
+        }
168 173
         return $msg.' (by '.$this->class.$this->type.$this->function.'() in '.$this->file.' on line '.$this->line.')';
169 174
     }
170 175
 
Please login to merge, or discard this patch.
lib/Sii/Autenticacion.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      * WSDL producción: https://palena.sii.cl/DTEWS/CrSeed.jws?WSDL
58 58
      * WSDL certificación: https://maullin.sii.cl/DTEWS/CrSeed.jws?WSDL
59 59
      *
60
-     * @return Semilla obtenida desde SII
60
+     * @return false|string obtenida desde SII
61 61
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
62 62
      * @version 2015-09-17
63 63
      */
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 
77 77
     /**
78 78
      * Método que firma una semilla previamente obtenida
79
-     * @param seed Semilla obtenida desde SII
79
+     * @param seed string obtenida desde SII
80 80
      * @param Firma objeto de la Firma electrónica o arreglo con configuración de la misma
81
-     * @return Solicitud de token con la semilla incorporada y firmada
81
+     * @return \sasco\LibreDTE\Argumentos|null de token con la semilla incorporada y firmada
82 82
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
83 83
      * @version 2015-09-17
84 84
      */
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      * WSDL certificación: https://maullin.sii.cl/DTEWS/GetTokenFromSeed.jws?WSDL
114 114
      *
115 115
      * @param Firma objeto de la Firma electrónica o arreglo con configuración de la misma
116
-     * @return Token para autenticación en SII o =false si no se pudo obtener
116
+     * @return false|string para autenticación en SII o =false si no se pudo obtener
117 117
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
118 118
      * @version 2015-11-03
119 119
      */
Please login to merge, or discard this patch.
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -84,8 +84,9 @@  discard block
 block discarded – undo
84 84
      */
85 85
     private static function getTokenRequest($seed, $Firma = [])
86 86
     {
87
-        if (is_array($Firma))
88
-            $Firma = new \sasco\LibreDTE\FirmaElectronica($Firma);
87
+        if (is_array($Firma)) {
88
+                    $Firma = new \sasco\LibreDTE\FirmaElectronica($Firma);
89
+        }
89 90
         $seedSigned = $Firma->signXML(
90 91
             (new \sasco\LibreDTE\XML())->generate([
91 92
                 'getToken' => [
@@ -119,11 +120,17 @@  discard block
 block discarded – undo
119 120
      */
120 121
     public static function getToken($Firma = [])
121 122
     {
122
-        if (!$Firma) return false;
123
+        if (!$Firma) {
124
+            return false;
125
+        }
123 126
         $semilla = self::getSeed();
124
-        if (!$semilla) return false;
127
+        if (!$semilla) {
128
+            return false;
129
+        }
125 130
         $requestFirmado = self::getTokenRequest($semilla, $Firma);
126
-        if (!$requestFirmado) return false;
131
+        if (!$requestFirmado) {
132
+            return false;
133
+        }
127 134
         $xml = \sasco\LibreDTE\Sii::request('GetTokenFromSeed', 'getToken', $requestFirmado);
128 135
         if ($xml===false or (string)$xml->xpath('/SII:RESPUESTA/SII:RESP_HDR/ESTADO')[0]!=='00') {
129 136
             \sasco\LibreDTE\Log::write(
Please login to merge, or discard this patch.
lib/Sii/Base/Documento.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
     /**
61 61
      * Método que entrega el ID del documento
62
-     * @return ID del libro
62
+     * @return string del libro
63 63
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
64 64
      * @version 2015-12-14
65 65
      */
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
     /**
72 72
      * Método para asignar la caratula
73
-     * @param Firma Objeto con la firma electrónica
73
+     * @param Firma \sasco\LibreDTE\FirmaElectronica con la firma electrónica
74 74
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
75 75
      * @version 2015-12-14
76 76
      */
Please login to merge, or discard this patch.
lib/Sii/Factoring/Aec.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
     /**
50 50
      * Método que agrega el objeto Cesion
51
-     * @param Cesion Objeto de \sasco\LibreDTE\Sii\Factoring\Cesion
51
+     * @param Cesion Cesion de \sasco\LibreDTE\Sii\Factoring\Cesion
52 52
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
53 53
      * @version 2016-12-10
54 54
      */
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
     /**
82 82
      * Método que genera el XML del AEC
83
-     * @return XML AEC con DTE y Cesion
83
+     * @return boolean|string AEC con DTE y Cesion
84 84
      * @author Adonias Vasquez (adonias.vasquez[at]epys.cl)
85 85
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
86 86
      * @version 2016-12-10
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
      * @param email del usuario que envía el AEC
174 174
      * @param empresa RUT de la empresa emisora del AEC
175 175
      * @param dte Documento XML con el DTE que se desea enviar a SII
176
-     * @param token Token de autenticación automática ante el SII
176
+     * @param token string de autenticación automática ante el SII
177 177
      * @param retry Intentos que se realizarán como máximo para obtener respuesta
178 178
      * @return Respuesta XML desde SII o bien null si no se pudo obtener respuesta
179 179
      * @author Adonias Vasquez (adonias.vasquez[at]epys.cl)
Please login to merge, or discard this patch.
Braces   +30 added lines, -20 removed lines patch added patch discarded remove patch
@@ -87,10 +87,12 @@  discard block
 block discarded – undo
87 87
      */
88 88
     public function generar()
89 89
     {
90
-        if (!isset($this->cedido) or !isset($this->cesiones[0]))
91
-            return false;
92
-        if (!isset($this->caratula))
93
-            $this->setCaratula();
90
+        if (!isset($this->cedido) or !isset($this->cesiones[0])) {
91
+                    return false;
92
+        }
93
+        if (!isset($this->caratula)) {
94
+                    $this->setCaratula();
95
+        }
94 96
         // genear XML del envío
95 97
         $xmlEnvio = (new \sasco\LibreDTE\XML())->generate([
96 98
             'AEC' => [
@@ -137,8 +139,9 @@  discard block
 block discarded – undo
137 139
     public function enviar()
138 140
     {
139 141
         // generar XML que se enviará
140
-        if (!$this->xml_data)
141
-            $this->xml_data = $this->generar();
142
+        if (!$this->xml_data) {
143
+                    $this->xml_data = $this->generar();
144
+        }
142 145
         if (!$this->xml_data) {
143 146
             \sasco\LibreDTE\Log::write(
144 147
                 \sasco\LibreDTE\Estado::DOCUMENTO_ERROR_GENERAR_XML,
@@ -150,20 +153,24 @@  discard block
 block discarded – undo
150 153
             return false;
151 154
         }
152 155
         // validar schema del documento antes de enviar
153
-        if (!$this->schemaValidate())
154
-            return false;
156
+        if (!$this->schemaValidate()) {
157
+                    return false;
158
+        }
155 159
         // solicitar token
156 160
         $token = \sasco\LibreDTE\Sii\Autenticacion::getToken($this->Firma);
157
-        if (!$token)
158
-            return false;
161
+        if (!$token) {
162
+                    return false;
163
+        }
159 164
         // enviar AEC
160 165
         $email = $this->caratula['MailContacto'];
161 166
         $emisor = $this->caratula['RutCedente'];
162 167
         $result = $this->enviarRTC($email, $emisor, $this->xml_data, $token, 10);
163
-        if ($result===false)
164
-            return false;
165
-        if (!is_numeric((string)$result->TRACKID))
166
-            return false;
168
+        if ($result===false) {
169
+                    return false;
170
+        }
171
+        if (!is_numeric((string)$result->TRACKID)) {
172
+                    return false;
173
+        }
167 174
         return (int)(string)$result->TRACKID;
168 175
     }
169 176
 
@@ -230,16 +237,19 @@  discard block
 block discarded – undo
230 237
         // enviar XML al SII
231 238
         for ($i = 0; $i < $retry; $i++) {
232 239
             $response = curl_exec($curl);
233
-            if ($response and $response != 'Error 500')
234
-                break;
240
+            if ($response and $response != 'Error 500') {
241
+                            break;
242
+            }
235 243
         }
236 244
         unlink($file);
237 245
         // verificar respuesta del envío y entregar error en caso que haya uno
238 246
         if (!$response or $response == 'Error 500') {
239
-            if (!$response)
240
-                \sasco\LibreDTE\Log::write(\sasco\LibreDTE\Estado::ENVIO_ERROR_CURL, \sasco\LibreDTE\Estado::get(\sasco\LibreDTE\Estado::ENVIO_ERROR_CURL, curl_error($curl)));
241
-            if ($response == 'Error 500')
242
-                \sasco\LibreDTE\Log::write(\sasco\LibreDTE\Estado::ENVIO_ERROR_500, \sasco\LibreDTE\Estado::get(\sasco\LibreDTE\Estado::ENVIO_ERROR_500));
247
+            if (!$response) {
248
+                            \sasco\LibreDTE\Log::write(\sasco\LibreDTE\Estado::ENVIO_ERROR_CURL, \sasco\LibreDTE\Estado::get(\sasco\LibreDTE\Estado::ENVIO_ERROR_CURL, curl_error($curl)));
249
+            }
250
+            if ($response == 'Error 500') {
251
+                            \sasco\LibreDTE\Log::write(\sasco\LibreDTE\Estado::ENVIO_ERROR_500, \sasco\LibreDTE\Estado::get(\sasco\LibreDTE\Estado::ENVIO_ERROR_500));
252
+            }
243 253
             return false;
244 254
         }
245 255
         // cerrar sesión curl
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -184,11 +184,11 @@  discard block
 block discarded – undo
184 184
     {
185 185
         // definir datos que se usarán en el envío
186 186
         list($rutCompany, $dvCompany) = explode('-', str_replace('.', '', $empresa));
187
-        if (strpos($dte, '<?xml') === false) {
188
-            $dte = '<?xml version="1.0" encoding="ISO-8859-1"?>' . "\n" . $dte;
187
+        if (strpos($dte, '<?xml')===false) {
188
+            $dte = '<?xml version="1.0" encoding="ISO-8859-1"?>'."\n".$dte;
189 189
         }
190 190
         do {
191
-            $file = sys_get_temp_dir() . '/aec_' . md5(microtime() . $token . $dte) . '.xml';
191
+            $file = sys_get_temp_dir().'/aec_'.md5(microtime().$token.$dte).'.xml';
192 192
         } while (file_exists($file));
193 193
         file_put_contents($file, $dte);
194 194
         $data = [
@@ -228,17 +228,17 @@  discard block
 block discarded – undo
228 228
             curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
229 229
         }
230 230
         // enviar XML al SII
231
-        for ($i = 0; $i < $retry; $i++) {
231
+        for ($i = 0; $i<$retry; $i++) {
232 232
             $response = curl_exec($curl);
233
-            if ($response and $response != 'Error 500')
233
+            if ($response and $response!='Error 500')
234 234
                 break;
235 235
         }
236 236
         unlink($file);
237 237
         // verificar respuesta del envío y entregar error en caso que haya uno
238
-        if (!$response or $response == 'Error 500') {
238
+        if (!$response or $response=='Error 500') {
239 239
             if (!$response)
240 240
                 \sasco\LibreDTE\Log::write(\sasco\LibreDTE\Estado::ENVIO_ERROR_CURL, \sasco\LibreDTE\Estado::get(\sasco\LibreDTE\Estado::ENVIO_ERROR_CURL, curl_error($curl)));
241
-            if ($response == 'Error 500')
241
+            if ($response=='Error 500')
242 242
                 \sasco\LibreDTE\Log::write(\sasco\LibreDTE\Estado::ENVIO_ERROR_500, \sasco\LibreDTE\Estado::get(\sasco\LibreDTE\Estado::ENVIO_ERROR_500));
243 243
             return false;
244 244
         }
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
             9 => 'Error Interno',
271 271
             10 => 'Error Interno'
272 272
         ];
273
-        if ($xml->STATUS != 0) {
273
+        if ($xml->STATUS!=0) {
274 274
             \sasco\LibreDTE\Log::write(
275 275
                 $xml->STATUS,
276 276
                 $error[(int)$xml->STATUS]
Please login to merge, or discard this patch.
lib/Sii/Factoring/Cesion.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 
39 39
     /**
40 40
      * Constructor de la clase Cesion
41
-     * @param DTECedido Objeto DteCedido
42
-     * @param Seq secuencia de la cesión
41
+     * @param DTECedido DteCedido DteCedido
42
+     * @param Seq integer de la cesión
43 43
      * @author Adonias Vasquez (adonias.vasquez[at]epys.cl)
44 44
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
45 45
      * @version 2016-12-10
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 
178 178
     /**
179 179
      * Método que realiza la firma de cesión
180
-     * @param Firma objeto que representa la Firma Electrónca
180
+     * @param Firma \sasco\LibreDTE\FirmaElectronica que representa la Firma Electrónca
181 181
      * @return =true si el DTE pudo ser fimado o =false si no se pudo firmar
182 182
      * @author Adonias Vasquez (adonias.vasquez[at]epys.cl)
183 183
      * @version 2016-08-10
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -194,8 +194,9 @@
 block discarded – undo
194 194
             return false;
195 195
         }
196 196
         $this->xml = new \sasco\LibreDTE\XML();
197
-        if (!$this->xml->loadXML($xml) or !$this->schemaValidate())
198
-            return false;
197
+        if (!$this->xml->loadXML($xml) or !$this->schemaValidate()) {
198
+                    return false;
199
+        }
199 200
         return true;
200 201
     }
201 202
 
Please login to merge, or discard this patch.
examples/020-log.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     }
66 66
     public function caso2()
67 67
     {
68
-        for ($i=0; $i<5; $i++)
68
+        for ($i = 0; $i<5; $i++)
69 69
             \sasco\LibreDTE\Log::write('Soy el error '.($i+1));
70 70
     }
71 71
     public function caso3()
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
 $GeneradorErrores->caso1();
83 83
 
84 84
 // obtener el error más reciente y usar como string
85
-echo \sasco\LibreDTE\Log::read(),"\n\n";
85
+echo \sasco\LibreDTE\Log::read(), "\n\n";
86 86
 
87 87
 // mostrar el resto de errores y usar como string
88 88
 foreach (\sasco\LibreDTE\Log::readAll() as $error)
89
-    echo $error,"\n";
89
+    echo $error, "\n";
90 90
 echo "\n\n\n";
91 91
 
92 92
 // ejecutar caso 2
@@ -94,27 +94,27 @@  discard block
 block discarded – undo
94 94
 
95 95
 // obtener el error más reciente y usar como objeto
96 96
 $error = \sasco\LibreDTE\Log::read();
97
-echo 'error código: ',$error->code,' y mensaje ',$error->msg,"\n\n";
97
+echo 'error código: ', $error->code, ' y mensaje ', $error->msg, "\n\n";
98 98
 
99 99
 // mostrar el resto de errores y usar como objeto
100 100
 foreach (\sasco\LibreDTE\Log::readAll() as $error)
101
-    echo 'error código: ',$error->code,' y mensaje ',$error->msg,"\n";
101
+    echo 'error código: ', $error->code, ' y mensaje ', $error->msg, "\n";
102 102
 echo "\n\n\n";
103 103
 
104 104
 // ejecutar caso 3 y mostrar en español todos los mensajes
105 105
 $GeneradorErrores->caso3();
106 106
 foreach (\sasco\LibreDTE\Log::readAll() as $error)
107
-    echo $error,"\n";
107
+    echo $error, "\n";
108 108
 echo "\n\n\n";
109 109
 
110 110
 // ejecutar caso 3 y mostrar en español todos los mensajes pero como objetos
111 111
 $GeneradorErrores->caso3();
112 112
 foreach (\sasco\LibreDTE\Log::readAll() as $error)
113
-    echo 'error código: ',$error->code,' y mensaje ',$error->msg,"\n";
113
+    echo 'error código: ', $error->code, ' y mensaje ', $error->msg, "\n";
114 114
 echo "\n\n\n";
115 115
 
116 116
 // ejecutar caso 3 y mostrar en inglés todos los mensajes
117 117
 \sasco\LibreDTE\I18n::setIdioma('en'); // idioma se debe asignar antes que se registre cualquier mensaje en el Log
118 118
 $GeneradorErrores->caso3();
119 119
 foreach (\sasco\LibreDTE\Log::readAll() as $error)
120
-    echo $error,"\n";
120
+    echo $error, "\n";
Please login to merge, or discard this patch.
Braces   +13 added lines, -7 removed lines patch added patch discarded remove patch
@@ -65,8 +65,9 @@  discard block
 block discarded – undo
65 65
     }
66 66
     public function caso2()
67 67
     {
68
-        for ($i=0; $i<5; $i++)
69
-            \sasco\LibreDTE\Log::write('Soy el error '.($i+1));
68
+        for ($i=0; $i<5; $i++) {
69
+                    \sasco\LibreDTE\Log::write('Soy el error '.($i+1));
70
+        }
70 71
     }
71 72
     public function caso3()
72 73
     {
@@ -85,8 +86,9 @@  discard block
 block discarded – undo
85 86
 echo \sasco\LibreDTE\Log::read(),"\n\n";
86 87
 
87 88
 // mostrar el resto de errores y usar como string
88
-foreach (\sasco\LibreDTE\Log::readAll() as $error)
89
+foreach (\sasco\LibreDTE\Log::readAll() as $error) {
89 90
     echo $error,"\n";
91
+}
90 92
 echo "\n\n\n";
91 93
 
92 94
 // ejecutar caso 2
@@ -97,24 +99,28 @@  discard block
 block discarded – undo
97 99
 echo 'error código: ',$error->code,' y mensaje ',$error->msg,"\n\n";
98 100
 
99 101
 // mostrar el resto de errores y usar como objeto
100
-foreach (\sasco\LibreDTE\Log::readAll() as $error)
102
+foreach (\sasco\LibreDTE\Log::readAll() as $error) {
101 103
     echo 'error código: ',$error->code,' y mensaje ',$error->msg,"\n";
104
+}
102 105
 echo "\n\n\n";
103 106
 
104 107
 // ejecutar caso 3 y mostrar en español todos los mensajes
105 108
 $GeneradorErrores->caso3();
106
-foreach (\sasco\LibreDTE\Log::readAll() as $error)
109
+foreach (\sasco\LibreDTE\Log::readAll() as $error) {
107 110
     echo $error,"\n";
111
+}
108 112
 echo "\n\n\n";
109 113
 
110 114
 // ejecutar caso 3 y mostrar en español todos los mensajes pero como objetos
111 115
 $GeneradorErrores->caso3();
112
-foreach (\sasco\LibreDTE\Log::readAll() as $error)
116
+foreach (\sasco\LibreDTE\Log::readAll() as $error) {
113 117
     echo 'error código: ',$error->code,' y mensaje ',$error->msg,"\n";
118
+}
114 119
 echo "\n\n\n";
115 120
 
116 121
 // ejecutar caso 3 y mostrar en inglés todos los mensajes
117 122
 \sasco\LibreDTE\I18n::setIdioma('en'); // idioma se debe asignar antes que se registre cualquier mensaje en el Log
118 123
 $GeneradorErrores->caso3();
119
-foreach (\sasco\LibreDTE\Log::readAll() as $error)
124
+foreach (\sasco\LibreDTE\Log::readAll() as $error) {
120 125
     echo $error,"\n";
126
+}
Please login to merge, or discard this patch.
examples/003-estadoDte.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 $token = \sasco\LibreDTE\Sii\Autenticacion::getToken($config['firma']);
40 40
 if (!$token) {
41 41
     foreach (\sasco\LibreDTE\Log::readAll() as $error)
42
-        echo $error,"\n";
42
+        echo $error, "\n";
43 43
     exit;
44 44
 }
45 45
 
@@ -65,4 +65,4 @@  discard block
 block discarded – undo
65 65
 
66 66
 // si hubo errores se muestran
67 67
 foreach (\sasco\LibreDTE\Log::readAll() as $error)
68
-    echo $error,"\n";
68
+    echo $error, "\n";
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,8 +38,9 @@  discard block
 block discarded – undo
38 38
 // solicitar token
39 39
 $token = \sasco\LibreDTE\Sii\Autenticacion::getToken($config['firma']);
40 40
 if (!$token) {
41
-    foreach (\sasco\LibreDTE\Log::readAll() as $error)
42
-        echo $error,"\n";
41
+    foreach (\sasco\LibreDTE\Log::readAll() as $error) {
42
+            echo $error,"\n";
43
+    }
43 44
     exit;
44 45
 }
45 46
 
@@ -64,5 +65,6 @@  discard block
 block discarded – undo
64 65
 }
65 66
 
66 67
 // si hubo errores se muestran
67
-foreach (\sasco\LibreDTE\Log::readAll() as $error)
68
+foreach (\sasco\LibreDTE\Log::readAll() as $error) {
68 69
     echo $error,"\n";
70
+}
Please login to merge, or discard this patch.
examples/021-libro_compras_csv.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.