@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function decompress($zipContent, $fileToExtract) |
42 | 42 | { |
43 | - $temp = tempnam(sys_get_temp_dir(),time() . '.zip'); |
|
43 | + $temp = tempnam(sys_get_temp_dir(), time() . '.zip'); |
|
44 | 44 | file_put_contents($temp, $zipContent); |
45 | 45 | $zip = new ZipArchive; |
46 | 46 | $output = ""; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function decompressLastFile($zipContent) |
63 | 63 | { |
64 | - $temp = tempnam(sys_get_temp_dir(),time() . '.zip'); |
|
64 | + $temp = tempnam(sys_get_temp_dir(), time() . '.zip'); |
|
65 | 65 | file_put_contents($temp, $zipContent); |
66 | 66 | $zip = new ZipArchive; |
67 | 67 | $output = ""; |
@@ -69,9 +69,9 @@ |
||
69 | 69 | $obj = $resp[0]; |
70 | 70 | |
71 | 71 | $cdr = new CdrResponse(); |
72 | - $cdr->setId($this->getValueByName($obj,'ReferenceID')) |
|
73 | - ->setCode($this->getValueByName($obj,'ResponseCode')) |
|
74 | - ->setDescription($this->getValueByName($obj,'Description')); |
|
72 | + $cdr->setId($this->getValueByName($obj, 'ReferenceID')) |
|
73 | + ->setCode($this->getValueByName($obj, 'ResponseCode')) |
|
74 | + ->setDescription($this->getValueByName($obj, 'Description')); |
|
75 | 75 | |
76 | 76 | return $cdr; |
77 | 77 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | ]); |
29 | 29 | $metadata->addPropertyConstraints('serie', [ |
30 | 30 | new Assert\NotBlank(), |
31 | - new Assert\Length([ 'max' => 4]), |
|
31 | + new Assert\Length(['max' => 4]), |
|
32 | 32 | ]); |
33 | 33 | $metadata->addPropertyConstraints('correlativo', [ |
34 | 34 | new Assert\NotBlank(), |
@@ -42,19 +42,19 @@ discard block |
||
42 | 42 | new Assert\NotBlank(), |
43 | 43 | new Assert\Length(['max' => 3]), |
44 | 44 | ]); |
45 | - $metadata->addPropertyConstraints('mtoOperGravadas',[ |
|
45 | + $metadata->addPropertyConstraints('mtoOperGravadas', [ |
|
46 | 46 | new Assert\NotBlank(), |
47 | 47 | new Assert\Type(['type' => 'numeric']), |
48 | 48 | ]); |
49 | - $metadata->addPropertyConstraints('mtoOperInafectas',[ |
|
49 | + $metadata->addPropertyConstraints('mtoOperInafectas', [ |
|
50 | 50 | new Assert\NotBlank(), |
51 | 51 | new Assert\Type(['type' => 'numeric']), |
52 | 52 | ]); |
53 | - $metadata->addPropertyConstraints('mtoOperExoneradas',[ |
|
53 | + $metadata->addPropertyConstraints('mtoOperExoneradas', [ |
|
54 | 54 | new Assert\NotBlank(), |
55 | 55 | new Assert\Type(['type' => 'numeric']), |
56 | 56 | ]); |
57 | - $metadata->addPropertyConstraints('mtoImpVenta',[ |
|
57 | + $metadata->addPropertyConstraints('mtoImpVenta', [ |
|
58 | 58 | new Assert\NotBlank(), |
59 | 59 | new Assert\Type(['type' => 'numeric']), |
60 | 60 | ]); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | ]); |
29 | 29 | $metadata->addPropertyConstraints('serie', [ |
30 | 30 | new Assert\NotBlank(), |
31 | - new Assert\Length([ 'max' => 4]), |
|
31 | + new Assert\Length(['max' => 4]), |
|
32 | 32 | ]); |
33 | 33 | $metadata->addPropertyConstraints('correlativo', [ |
34 | 34 | new Assert\NotBlank(), |
@@ -42,19 +42,19 @@ discard block |
||
42 | 42 | new Assert\NotBlank(), |
43 | 43 | new Assert\Length(['max' => 3]), |
44 | 44 | ]); |
45 | - $metadata->addPropertyConstraints('mtoOperGravadas',[ |
|
45 | + $metadata->addPropertyConstraints('mtoOperGravadas', [ |
|
46 | 46 | new Assert\NotBlank(), |
47 | 47 | new Assert\Type(['type' => 'numeric']), |
48 | 48 | ]); |
49 | - $metadata->addPropertyConstraints('mtoOperInafectas',[ |
|
49 | + $metadata->addPropertyConstraints('mtoOperInafectas', [ |
|
50 | 50 | new Assert\NotBlank(), |
51 | 51 | new Assert\Type(['type' => 'numeric']), |
52 | 52 | ]); |
53 | - $metadata->addPropertyConstraints('mtoOperExoneradas',[ |
|
53 | + $metadata->addPropertyConstraints('mtoOperExoneradas', [ |
|
54 | 54 | new Assert\NotBlank(), |
55 | 55 | new Assert\Type(['type' => 'numeric']), |
56 | 56 | ]); |
57 | - $metadata->addPropertyConstraints('mtoImpVenta',[ |
|
57 | + $metadata->addPropertyConstraints('mtoImpVenta', [ |
|
58 | 58 | new Assert\NotBlank(), |
59 | 59 | new Assert\Type(['type' => 'numeric']), |
60 | 60 | ]); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | ]); |
76 | 76 | $metadata->addPropertyConstraints('desMotivo', [ |
77 | 77 | new Assert\NotBlank(), |
78 | - new Assert\Length([ 'max' => 250]), |
|
78 | + new Assert\Length(['max' => 250]), |
|
79 | 79 | ]); |
80 | 80 | $metadata->addPropertyConstraints('tipDocAfectado', [ |
81 | 81 | new Assert\NotBlank(), |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | ]); |
87 | 87 | $metadata->addPropertyConstraints('numDocfectado', [ |
88 | 88 | new Assert\NotBlank(), |
89 | - new Assert\Length([ 'max' => 13]), |
|
89 | + new Assert\Length(['max' => 13]), |
|
90 | 90 | ]); |
91 | 91 | } |
92 | 92 | } |
93 | 93 | \ No newline at end of file |
@@ -28,9 +28,9 @@ |
||
28 | 28 | ]); |
29 | 29 | $metadata->addPropertyConstraints('nroDocRel', [ |
30 | 30 | new Assert\NotBlank(), |
31 | - new Assert\Length([ 'max' => 30]), |
|
31 | + new Assert\Length(['max' => 30]), |
|
32 | 32 | ]); |
33 | - $metadata->addPropertyConstraints('total',[ |
|
33 | + $metadata->addPropertyConstraints('total', [ |
|
34 | 34 | new Assert\NotBlank(), |
35 | 35 | new Assert\Type(['type' => 'numeric']), |
36 | 36 | ]); |
@@ -80,21 +80,21 @@ discard block |
||
80 | 80 | $name = str_replace('\\', '/', $name); |
81 | 81 | $hexdtime = pack('V', $this->unix2DosTime($time)); |
82 | 82 | $frd = "\x50\x4b\x03\x04"; |
83 | - $frd .= "\x14\x00"; // ver needed to extract |
|
84 | - $frd .= "\x00\x00"; // gen purpose bit flag |
|
85 | - $frd .= "\x08\x00"; // compression method |
|
86 | - $frd .= $hexdtime; // last mod time and date |
|
83 | + $frd .= "\x14\x00"; // ver needed to extract |
|
84 | + $frd .= "\x00\x00"; // gen purpose bit flag |
|
85 | + $frd .= "\x08\x00"; // compression method |
|
86 | + $frd .= $hexdtime; // last mod time and date |
|
87 | 87 | // "local file header" segment |
88 | 88 | $unc_len = strlen($data); |
89 | 89 | $crc = crc32($data); |
90 | 90 | $zdata = gzcompress($data); |
91 | 91 | $zdata = substr(substr($zdata, 0, strlen($zdata) - 4), 2); // fix crc bug |
92 | 92 | $c_len = strlen($zdata); |
93 | - $frd .= pack('V', $crc); // crc32 |
|
94 | - $frd .= pack('V', $c_len); // compressed filesize |
|
95 | - $frd .= pack('V', $unc_len); // uncompressed filesize |
|
96 | - $frd .= pack('v', strlen($name)); // length of filename |
|
97 | - $frd .= pack('v', 0); // extra field length |
|
93 | + $frd .= pack('V', $crc); // crc32 |
|
94 | + $frd .= pack('V', $c_len); // compressed filesize |
|
95 | + $frd .= pack('V', $unc_len); // uncompressed filesize |
|
96 | + $frd .= pack('v', strlen($name)); // length of filename |
|
97 | + $frd .= pack('v', 0); // extra field length |
|
98 | 98 | $frd .= $name; |
99 | 99 | // "file data" segment |
100 | 100 | $frd .= $zdata; |
@@ -102,20 +102,20 @@ discard block |
||
102 | 102 | $this->datasec[] = $frd; |
103 | 103 | // now add to central directory record |
104 | 104 | $cdrec = "\x50\x4b\x01\x02"; |
105 | - $cdrec .= "\x00\x00"; // version made by |
|
106 | - $cdrec .= "\x14\x00"; // version needed to extract |
|
107 | - $cdrec .= "\x00\x00"; // gen purpose bit flag |
|
108 | - $cdrec .= "\x08\x00"; // compression method |
|
109 | - $cdrec .= $hexdtime; // last mod time & date |
|
110 | - $cdrec .= pack('V', $crc); // crc32 |
|
111 | - $cdrec .= pack('V', $c_len); // compressed filesize |
|
112 | - $cdrec .= pack('V', $unc_len); // uncompressed filesize |
|
105 | + $cdrec .= "\x00\x00"; // version made by |
|
106 | + $cdrec .= "\x14\x00"; // version needed to extract |
|
107 | + $cdrec .= "\x00\x00"; // gen purpose bit flag |
|
108 | + $cdrec .= "\x08\x00"; // compression method |
|
109 | + $cdrec .= $hexdtime; // last mod time & date |
|
110 | + $cdrec .= pack('V', $crc); // crc32 |
|
111 | + $cdrec .= pack('V', $c_len); // compressed filesize |
|
112 | + $cdrec .= pack('V', $unc_len); // uncompressed filesize |
|
113 | 113 | $cdrec .= pack('v', strlen($name)); // length of filename |
114 | - $cdrec .= pack('v', 0); // extra field length |
|
115 | - $cdrec .= pack('v', 0); // file comment length |
|
116 | - $cdrec .= pack('v', 0); // disk number start |
|
117 | - $cdrec .= pack('v', 0); // internal file attributes |
|
118 | - $cdrec .= pack('V', 32); // external file attributes |
|
114 | + $cdrec .= pack('v', 0); // extra field length |
|
115 | + $cdrec .= pack('v', 0); // file comment length |
|
116 | + $cdrec .= pack('v', 0); // disk number start |
|
117 | + $cdrec .= pack('v', 0); // internal file attributes |
|
118 | + $cdrec .= pack('V', 32); // external file attributes |
|
119 | 119 | // - 'archive' bit set |
120 | 120 | $cdrec .= pack('V', $this->old_offset); // relative offset of local header |
121 | 121 | $this->old_offset += strlen($frd); |
@@ -135,18 +135,18 @@ discard block |
||
135 | 135 | public function file() |
136 | 136 | { |
137 | 137 | $ctrldir = implode('', $this->ctrl_dir); |
138 | - $header = $ctrldir. |
|
139 | - $this->eof_ctrl_dir. |
|
140 | - pack('v', sizeof($this->ctrl_dir)). //total #of entries "on this disk" |
|
141 | - pack('v', sizeof($this->ctrl_dir)). //total #of entries overall |
|
142 | - pack('V', strlen($ctrldir)). //size of central dir |
|
143 | - pack('V', $this->old_offset). //offset to start of central dir |
|
144 | - "\x00\x00"; //.zip file comment length |
|
138 | + $header = $ctrldir . |
|
139 | + $this->eof_ctrl_dir . |
|
140 | + pack('v', sizeof($this->ctrl_dir)) . //total #of entries "on this disk" |
|
141 | + pack('v', sizeof($this->ctrl_dir)) . //total #of entries overall |
|
142 | + pack('V', strlen($ctrldir)) . //size of central dir |
|
143 | + pack('V', $this->old_offset) . //offset to start of central dir |
|
144 | + "\x00\x00"; //.zip file comment length |
|
145 | 145 | |
146 | 146 | // Return entire ZIP archive as string |
147 | 147 | $data = implode('', $this->datasec); |
148 | 148 | |
149 | - return $data.$header; |
|
149 | + return $data . $header; |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | // end of the 'file()' method |
@@ -18,7 +18,7 @@ |
||
18 | 18 | * FACTURACION SERVICES. |
19 | 19 | */ |
20 | 20 | const FE_BETA = 'https://e-beta.sunat.gob.pe/ol-ti-itcpfegem-beta/billService'; |
21 | - const FE_HOMOLOGACION = 'https://www.sunat.gob.pe/ol-ti-itcpgem-sqa/billService'; |
|
21 | + const FE_HOMOLOGACION = 'https://www.sunat.gob.pe/ol-ti-itcpgem-sqa/billService'; |
|
22 | 22 | const FE_PRODUCCION = 'https://e-factura.sunat.gob.pe/ol-ti-itcpfegem/billService'; |
23 | 23 | const WSDL_ENDPOINT = 'https://e-beta.sunat.gob.pe/ol-ti-itcpfegem-beta/billService?wsdl'; |
24 | 24 |
@@ -51,7 +51,7 @@ |
||
51 | 51 | { |
52 | 52 | //TODO: load render one time. |
53 | 53 | $loader = new \Twig_Loader_Filesystem(__DIR__ . '/../Templates'); |
54 | - $numFilter = new \Twig_SimpleFilter('n_format', function ($number, $decimals = 2) { |
|
54 | + $numFilter = new \Twig_SimpleFilter('n_format', function($number, $decimals = 2) { |
|
55 | 55 | return number_format($number, $decimals, '.', ''); |
56 | 56 | }); |
57 | 57 | $twig = new \Twig_Environment($loader, array( |
@@ -36,8 +36,7 @@ |
||
36 | 36 | $result |
37 | 37 | ->setTicket($response->ticket) |
38 | 38 | ->setSuccess(true); |
39 | - } |
|
40 | - catch (\SoapFault $e) { |
|
39 | + } catch (\SoapFault $e) { |
|
41 | 40 | $result->setError($this->getErrorFromFault($e)); |
42 | 41 | } |
43 | 42 | return $result; |
@@ -32,7 +32,7 @@ |
||
32 | 32 | 'fileName' => $filename, |
33 | 33 | 'contentFile' => $content, |
34 | 34 | ]; |
35 | - $response = $client->call('sendSummary', [ 'parameters' => $params ]); |
|
35 | + $response = $client->call('sendSummary', ['parameters' => $params]); |
|
36 | 36 | $result |
37 | 37 | ->setTicket($response->ticket) |
38 | 38 | ->setSuccess(true); |