Completed
Push — master ( f3e6fd...11ebaf )
by Esteban De La Fuente
02:35 queued 12s
created
lib/Sii/EnvioDte.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 {
33 33
 
34 34
     private $dtes = []; ///< Objetos con los DTE que se enviarán
35
-    private $config = [ // 0: DTE, 1: boleta
35
+    private $config = [// 0: DTE, 1: boleta
36 36
         'SubTotDTE_max' => [20, 2], ///< máxima cantidad de tipos de documentos en el envío
37 37
         'DTE_max' => [2000, 1000], ///< máxima cantidad de DTE en un envío
38 38
         'tipos' => ['EnvioDTE', 'EnvioBOLETA'], ///< Tag para el envío, según si son Boletas o no
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
     public function agregar(Dte $DTE)
51 51
     {
52 52
         // determinar el tipo del envío (DTE o boleta)
53
-        if ($this->tipo === null) {
53
+        if ($this->tipo===null) {
54 54
             $this->tipo = (int)$DTE->esBoleta();
55 55
         }
56 56
         // validar que el tipo de documento sea del tipo que se espera
57
-        else if ((int)$DTE->esBoleta() != $this->tipo) {
57
+        else if ((int)$DTE->esBoleta()!=$this->tipo) {
58 58
             return false;
59 59
         }
60 60
         //
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
                 'RutEnvia' => $Dte->getEmisor(),
240 240
                 'RutReceptor' => $Dte->getReceptor(),
241 241
                 'FchResol' => date('Y-m-d'),
242
-                'NroResol' => ($Dte->getCertificacion()?'0':'').'9999',
242
+                'NroResol' => ($Dte->getCertificacion() ? '0' : '').'9999',
243 243
             ]);
244 244
             // cargar nuevo XML con datos completos
245 245
             if (!parent::loadXML($this->generar())) {
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
     {
321 321
         $fecha = '9999-12-31';
322 322
         foreach ($this->getDocumentos() as $Dte) {
323
-            if ($Dte->getFechaEmision() < $fecha)
323
+            if ($Dte->getFechaEmision()<$fecha)
324 324
                 $fecha = $Dte->getFechaEmision();
325 325
         }
326 326
         return $fecha;
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
     {
336 336
         $fecha = '0000-01-01';
337 337
         foreach ($this->getDocumentos() as $Dte) {
338
-            if ($Dte->getFechaEmision() > $fecha)
338
+            if ($Dte->getFechaEmision()>$fecha)
339 339
                 $fecha = $Dte->getFechaEmision();
340 340
         }
341 341
         return $fecha;
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
                 $e = substr($e, 0, -2);
395 395
             $d = (int)$nodo_dte->getElementsByTagName('TipoDTE')->item(0)->nodeValue;
396 396
             $f = (int)$nodo_dte->getElementsByTagName('Folio')->item(0)->nodeValue;
397
-            if ($folio == $f and $dte == $d and $emisor == $e) {
397
+            if ($folio==$f and $dte==$d and $emisor==$e) {
398 398
                 return new Dte($nodo_dte->C14N(), false); // cargar DTE sin normalizar
399 399
             }
400 400
         }
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
         $SignatureValue = trim(str_replace(["\n", ' ', "\t"], '', $Signatures->item($Signatures->length-1)->getElementsByTagName('SignatureValue')->item(0)->nodeValue));
453 453
         $X509Certificate = trim(str_replace(["\n", ' ', "\t"], '', $Signatures->item($Signatures->length-1)->getElementsByTagName('X509Certificate')->item(0)->nodeValue));
454 454
         $X509Certificate = '-----BEGIN CERTIFICATE-----'."\n".wordwrap($X509Certificate, 64, "\n", true)."\n".'-----END CERTIFICATE-----';
455
-        $valid = openssl_verify($SignedInfo->C14N(), base64_decode($SignatureValue), $X509Certificate) === 1 ? true : false;
455
+        $valid = openssl_verify($SignedInfo->C14N(), base64_decode($SignatureValue), $X509Certificate)===1 ? true : false;
456 456
         return $valid and $DigestValue===base64_encode(sha1($SetDTE, true));
457 457
     }
458 458
 
Please login to merge, or discard this patch.