Passed
Branch develop (5fc816)
by JAIME ELMER
01:58
created
src/Sunat/Document/SunatDocument.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
 
130 130
     private function addInvoiceTaxes() {
131 131
         $Invoice                   = $this->invoiceDocument;
132
-        $currencyID                = $Invoice->getCurrencyType();              // Tipo de moneda
133
-        $totalTaxableOperations    = $Invoice->getTotalTaxableOperations();    // Total operaciones gravadas
134
-        $totalTaxes                = $Invoice->getTotalTaxes();                // Total operaciones gravadas
135
-        $Igv                       = $Invoice->getIGV();                       // Total IGV
136
-        $totalExemptedOperations   = $Invoice->getTotalExemptedOperations();   // Total operaciones exoneradas
132
+        $currencyID                = $Invoice->getCurrencyType(); // Tipo de moneda
133
+        $totalTaxableOperations    = $Invoice->getTotalTaxableOperations(); // Total operaciones gravadas
134
+        $totalTaxes                = $Invoice->getTotalTaxes(); // Total operaciones gravadas
135
+        $Igv                       = $Invoice->getIGV(); // Total IGV
136
+        $totalExemptedOperations   = $Invoice->getTotalExemptedOperations(); // Total operaciones exoneradas
137 137
         $totalUnaffectedOperations = $Invoice->getTotalUnaffectedOperations(); // Total operaciones inafectas
138
-        $totalFreeOpertions        = $Invoice->getTotalFreeOperations();       // Total operaciones gratuitas
138
+        $totalFreeOpertions        = $Invoice->getTotalFreeOperations(); // Total operaciones gratuitas
139 139
 
140 140
         // XML nodes
141 141
         $TaxTotal = new TaxTotal();
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
         }
147 147
         // Total operaciones exoneradas
148 148
         if ($totalExemptedOperations) {
149
-            UblHelper::addTaxSubtotal($TaxTotal, $currencyID, 0, $totalExemptedOperations,   Catalogo::CAT5_EXO);
149
+            UblHelper::addTaxSubtotal($TaxTotal, $currencyID, 0, $totalExemptedOperations, Catalogo::CAT5_EXO);
150 150
         }
151 151
         // Total operaciones inafectas
152 152
         if ($totalUnaffectedOperations) {
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         }
155 155
         // Total operaciones gratuitas solo aplica a FACTURA
156 156
         if ($totalFreeOpertions && $Invoice->getInvoiceType() === Catalogo::CAT1_FACTURA) {
157
-            UblHelper::addTaxSubtotal($TaxTotal, $currencyID, 0, $totalFreeOpertions,        Catalogo::CAT5_GRA);
157
+            UblHelper::addTaxSubtotal($TaxTotal, $currencyID, 0, $totalFreeOpertions, Catalogo::CAT5_GRA);
158 158
         }
159 159
 
160 160
         // Total impuestos
@@ -280,8 +280,8 @@  discard block
 block discarded – undo
280 280
         $Invoice            = $this->invoiceDocument;
281 281
         $Items              = $this->getItems();
282 282
         $currencyID         = $this->getDocumentCurrencyCode(); // Tipo de moneda
283
-        $totalAllowances    = $Invoice->getTotalAllowances();   // Total descuentos
284
-        $payableAmount      = $Invoice->getPayableAmount();     // Total a pagar
283
+        $totalAllowances    = $Invoice->getTotalAllowances(); // Total descuentos
284
+        $payableAmount      = $Invoice->getPayableAmount(); // Total a pagar
285 285
         $billableAmount     = $Invoice->getBillableValue();
286 286
         // LegalMonetaryTotal
287 287
         $LegalMonetaryTotal = new LegalMonetaryTotal();
Please login to merge, or discard this patch.
src/Tools/FSInputGenerator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@
 block discarded – undo
139 139
     private static function getVariablesGlobales(InvoiceDocument $Invoice) {
140 140
         $data         = [];
141 141
         $currencyType = $Invoice->getCurrencyType();
142
-        $ac   = $Invoice->getAllowancesAndCharges();
142
+        $ac = $Invoice->getAllowancesAndCharges();
143 143
         $baseAmount   = $Invoice->getItems()->getTotalTaxableAmount();
144 144
         foreach ($ac as $item) {
145 145
             $k = $item['multiplierFactor'];
Please login to merge, or discard this patch.
src/Tools/Validations.php 1 patch
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,6 @@
 block discarded – undo
31 31
      * then the **isIn** function wont check the
32 32
      * *needle* in the *haystack*.
33 33
      * types of the
34
-
35 34
      * @return type
36 35
      */
37 36
     public static function isIn($needle, array $haystack, $strict = true) {
Please login to merge, or discard this patch.
src/Sunat/InputValidator.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -103,8 +103,7 @@
 block discarded – undo
103 103
         switch ($type) {
104 104
             case 'Array':
105 105
                 return $field == 'items' ?
106
-                        'El campo items debe ser de tipo array.' :
107
-                        "Se espera que el campo $field sea un array.";
106
+                        'El campo items debe ser de tipo array.' : "Se espera que el campo $field sea un array.";
108 107
             case 'Dni':
109 108
                 return "$value no es un DNI valido.";
110 109
             case 'Ruc':
Please login to merge, or discard this patch.
src/Sunat/InvoiceItems.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -71,41 +71,41 @@
 block discarded – undo
71 71
             $grossUnitValue = $item['unitValue'];
72 72
             $igvIncluded    = $item['igvIncluded'];
73 73
             
74
-            $unitValue         = $this->calcUnitValue($igvAffectCode, $grossUnitValue, $igvIncluded);      // Valor unitario
74
+            $unitValue         = $this->calcUnitValue($igvAffectCode, $grossUnitValue, $igvIncluded); // Valor unitario
75 75
             $unitTaxedValue    = $this->calcUnitTaxedValue($igvAffectCode, $grossUnitValue, $igvIncluded); // Valor unitario incluyendo impuestos si son aplicables
76
-            $unitBillableValue = $this->calcUnitBillableValue($unitValue, $priceType);                     // Valor unitario facturable
76
+            $unitBillableValue = $this->calcUnitBillableValue($unitValue, $priceType); // Valor unitario facturable
77 77
             $quantity          = $item['quantity']; // Cantidad
78 78
 
79
-            $itemValue            = $unitValue * $quantity;         // Valor de item
79
+            $itemValue            = $unitValue * $quantity; // Valor de item
80 80
             $itemBillableValue    = $unitBillableValue * $quantity; // Valor de item
81 81
             $itemAllowancesAmount = Operations::getTotalAllowances($itemBillableValue, $ac); // Descuentos de item
82
-            $itemChargesAmount    = Operations::getTotalCharges($itemValue, $ac);            // Cargos de item
83
-            $itemTaxableAmount    = $this->calcItemTaxableAmount($itemValue, $priceType, $ac);         // Valor de venta del ítem = (Valor del item - Descuentos + Cargos), 0 si el valor del item es referencial!
82
+            $itemChargesAmount    = Operations::getTotalCharges($itemValue, $ac); // Cargos de item
83
+            $itemTaxableAmount    = $this->calcItemTaxableAmount($itemValue, $priceType, $ac); // Valor de venta del ítem = (Valor del item - Descuentos + Cargos), 0 si el valor del item es referencial!
84 84
             $igvAmount            = $this->calcIgvAmount($igvAffectCode, $itemTaxableAmount); // Afectación al IGV por item
85 85
             
86 86
             $itemIgvTaxed         = $itemBillableValue + $igvAmount;
87 87
             
88
-            $this->set(self::COL_PRODUCT_CODE,        $idx, $item['productCode']);
89
-            $this->set(self::COL_UNPSC,               $idx, $item['sunatProductCode']);
90
-            $this->set(self::COL_UNIT_CODE,           $idx, $item['unitCode']);
91
-            $this->set(self::COL_QUANTITY,            $idx, $quantity);
92
-            $this->set(self::COL_DESCRIPTION,         $idx, $item['description']);
93
-            $this->set(self::COL_CURRENCY_CODE,       $idx, $currencyCode);
88
+            $this->set(self::COL_PRODUCT_CODE, $idx, $item['productCode']);
89
+            $this->set(self::COL_UNPSC, $idx, $item['sunatProductCode']);
90
+            $this->set(self::COL_UNIT_CODE, $idx, $item['unitCode']);
91
+            $this->set(self::COL_QUANTITY, $idx, $quantity);
92
+            $this->set(self::COL_DESCRIPTION, $idx, $item['description']);
93
+            $this->set(self::COL_CURRENCY_CODE, $idx, $currencyCode);
94 94
             // Códigos de catálogos predefinidos
95
-            $this->set(self::COL_PRICE_TYPE,          $idx, $priceType);
96
-            $this->set(self::COL_TAX_TYPE,            $idx, $item['taxType']);
97
-            $this->set(self::COL_IGV_AFFECTATION,     $idx, $item['igvAffectationCode']);
95
+            $this->set(self::COL_PRICE_TYPE, $idx, $priceType);
96
+            $this->set(self::COL_TAX_TYPE, $idx, $item['taxType']);
97
+            $this->set(self::COL_IGV_AFFECTATION, $idx, $item['igvAffectationCode']);
98 98
 
99
-            $this->set(self::COL_UNIT_VALUE,          $idx, $unitValue);
99
+            $this->set(self::COL_UNIT_VALUE, $idx, $unitValue);
100 100
             $this->set(self::COL_UNIT_BILLABLE_VALUE, $idx, $unitBillableValue);
101
-            $this->set(self::COL_UNIT_TAXED_VALUE,    $idx, $unitTaxedValue);
102
-            $this->set(self::COL_ITEM_VALUE,          $idx, $itemValue);
101
+            $this->set(self::COL_UNIT_TAXED_VALUE, $idx, $unitTaxedValue);
102
+            $this->set(self::COL_ITEM_VALUE, $idx, $itemValue);
103 103
             $this->set(self::COL_ITEM_BILLABLE_VALUE, $idx, $itemBillableValue);
104
-            $this->set(self::COL_ALLOWANCES_CHARGES,  $idx, $ac);
105
-            $this->set(self::COL_ALLOWANCES_AMOUNT,   $idx, $itemAllowancesAmount);
106
-            $this->set(self::COL_CHARGES_AMOUNT,      $idx, $itemChargesAmount);
104
+            $this->set(self::COL_ALLOWANCES_CHARGES, $idx, $ac);
105
+            $this->set(self::COL_ALLOWANCES_AMOUNT, $idx, $itemAllowancesAmount);
106
+            $this->set(self::COL_CHARGES_AMOUNT, $idx, $itemChargesAmount);
107 107
             $this->set(self::COL_ITEM_TAXABLE_AMOUNT, $idx, $itemTaxableAmount);
108
-            $this->set(self::COL_IGV,                 $idx, $igvAmount);
108
+            $this->set(self::COL_IGV, $idx, $igvAmount);
109 109
             $this->set(self::COL_ITEM_PAYABLE_AMOUNT, $idx, $itemIgvTaxed);
110 110
         }
111 111
     }
Please login to merge, or discard this patch.
src/Sunat/Operations.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@
 block discarded – undo
32 32
             $isCharge = $item['isCharge'];
33 33
             $k = $item['multiplierFactor'];
34 34
             $r = $amount * $k;
35
-            if($isCharge){
35
+            if ($isCharge) {
36 36
                 $totalCharges += $r;
37
-            }else{
37
+            } else {
38 38
                 $totalAllowances += $r;
39 39
             }
40 40
             
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
             $r = $amount * $k;
35 35
             if($isCharge){
36 36
                 $totalCharges += $r;
37
-            }else{
37
+            } else{
38 38
                 $totalAllowances += $r;
39 39
             }
40 40
             
Please login to merge, or discard this patch.
src/Sunat/InvoiceDocument.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@
 block discarded – undo
79 79
 
80 80
     private function addDefaults(array &$data) {
81 81
         $data['allowancesCharges'] = isset($data['allowancesCharges']) ? $data['allowancesCharges'] : [];
82
-        $data['issueDate']  = isset($data['issueDate']) ? $data['issueDate'] : new DateTime();
82
+        $data['issueDate'] = isset($data['issueDate']) ? $data['issueDate'] : new DateTime();
83 83
         $data['purchaseOrder'] = isset($data['purchaseOrder']) ? $data['purchaseOrder'] : null;
84 84
     }
85 85
 
Please login to merge, or discard this patch.