Completed
Pull Request — master (#46)
by Antonio Oertel
04:53
created
src/LotNumber/LotNumber.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,6 +22,6 @@
 block discarded – undo
22 22
      */
23 23
     public static function geraNumLote($numdigits = 15)
24 24
     {
25
-        return substr(str_replace(',', '', number_format(microtime(true)*1000000, 0)), 0, $numdigits);
25
+        return substr(str_replace(',', '', number_format(microtime(true) * 1000000, 0)), 0, $numdigits);
26 26
     }
27 27
 }
Please login to merge, or discard this patch.
src/DateTime/DateTime.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             'SP'=>'America/Sao_Paulo',
57 57
             'TO'=>'America/Araguaina');
58 58
 
59
-        if (! isset($tzUFlist[$siglaUF])) {
59
+        if (!isset($tzUFlist[$siglaUF])) {
60 60
             return '';
61 61
         }
62 62
         //seta a zona de tempo
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         $dataHora = str_replace('+', '-', $dataHora);
82 82
         $aDH = explode('T', $dataHora);
83 83
         $adDH = explode('-', $aDH[0]);
84
-        $atDH = array('0','0','0');
84
+        $atDH = array('0', '0', '0');
85 85
         if (count($aDH) == 2) {
86 86
             $inter = explode('-', $aDH[1]);
87 87
             $atDH = explode(':', $inter[0]);
Please login to merge, or discard this patch.
src/Dom/Dom.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         if (substr($xmlString, 0, 1) != '<') {
37 37
             throw new Exception\InvalidArgumentException($msg);
38 38
         }
39
-        if (! $this->loadXML($xmlString, LIBXML_NOBLANKS | LIBXML_NOEMPTYTAG)) {
39
+        if (!$this->loadXML($xmlString, LIBXML_NOBLANKS | LIBXML_NOEMPTYTAG)) {
40 40
             throw new Exception\InvalidArgumentException($msg);
41 41
         }
42 42
     }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         if (empty($node)) {
78 78
             return '';
79 79
         }
80
-        $texto = ! empty($node->getElementsByTagName($name)->item(0)->nodeValue) ?
80
+        $texto = !empty($node->getElementsByTagName($name)->item(0)->nodeValue) ?
81 81
             $node->getElementsByTagName($name)->item(0)->nodeValue : '';
82 82
         return html_entity_decode($texto, ENT_QUOTES, 'UTF-8');
83 83
     }
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
     public function getChave($nodeName = 'infNFe')
107 107
     {
108 108
         $node = $this->getElementsByTagName($nodeName)->item(0);
109
-        if (! empty($node)) {
109
+        if (!empty($node)) {
110 110
             $chaveId = $node->getAttribute("Id");
111
-            $chave =  preg_replace('/[^0-9]/', '', $chaveId);
111
+            $chave = preg_replace('/[^0-9]/', '', $chaveId);
112 112
             return $chave;
113 113
         }
114 114
         return '';
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
     public function addArrayChild(&$parent, $arr)
199 199
     {
200 200
         $num = 0;
201
-        if (! empty($arr) && ! empty($parent)) {
201
+        if (!empty($arr) && !empty($parent)) {
202 202
             foreach ($arr as $node) {
203 203
                 $this->appChild($parent, $node, '');
204 204
                 $num++;
Please login to merge, or discard this patch.
src/Dom/ValidXsd.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
         $dom->formatOutput = false;
28 28
         $dom->loadXML($xml, LIBXML_NOBLANKS | LIBXML_NOEMPTYTAG);
29 29
         libxml_clear_errors();
30
-        if (! $dom->schemaValidate($xsd)) {
30
+        if (!$dom->schemaValidate($xsd)) {
31 31
             $aIntErrors = libxml_get_errors();
32 32
             foreach ($aIntErrors as $intError) {
33 33
                 self::$errors[] = self::zTranslateError($intError->message) . "\n";
Please login to merge, or discard this patch.
src/Configure/Configure.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
      * @var array
28 28
      */
29 29
     public static $aRequirements = array(
30
-        'PHP' => array('php','','','5.4.0','Versão do PHP'),
31
-        'cURL'=> array('curl','cURL Information','','7.22.2','mínimo cURL 7.22.2'),
32
-        'OpenSSL' => array('openssl','OpenSSL Library Version','','','mínimo OpenSSL 1.0'),
33
-        'DOM' => array('dom','libxml Version','','2.0.6','mínimo DOM 2.0.6'),
34
-        'GD' => array('gd','GD Support','','','-----'),
35
-        'SOAP' => array('soap','Soap Client','','','-----'),
36
-        'ZIP' => array('zip','Zip version', '', '', '-----')
30
+        'PHP' => array('php', '', '', '5.4.0', 'Versão do PHP'),
31
+        'cURL'=> array('curl', 'cURL Information', '', '7.22.2', 'mínimo cURL 7.22.2'),
32
+        'OpenSSL' => array('openssl', 'OpenSSL Library Version', '', '', 'mínimo OpenSSL 1.0'),
33
+        'DOM' => array('dom', 'libxml Version', '', '2.0.6', 'mínimo DOM 2.0.6'),
34
+        'GD' => array('gd', 'GD Support', '', '', '-----'),
35
+        'SOAP' => array('soap', 'Soap Client', '', '', '-----'),
36
+        'ZIP' => array('zip', 'Zip version', '', '', '-----')
37 37
     );
38 38
     
39 39
     /**
@@ -49,12 +49,12 @@  discard block
 block discarded – undo
49 49
         $phpver = $modules->convVer($phpversion);
50 50
         $phpvermin = $modules->convVer(self::$aRequirements['PHP'][3]);
51 51
         $status = 'NOK';
52
-        $bcor = "bgcolor=\"".self::$cRed."\"";
52
+        $bcor = "bgcolor=\"" . self::$cRed . "\"";
53 53
         $comment = "v. $phpversion Inadequada !!!";
54 54
         if ($phpver >= $phpvermin) {
55
-            $comment = "mínimo PHP ". self::$aRequirements['PHP'][3];
55
+            $comment = "mínimo PHP " . self::$aRequirements['PHP'][3];
56 56
             $status = 'OK';
57
-            $bcor = "bgcolor=\"".self::$cGreen."\"";
57
+            $bcor = "bgcolor=\"" . self::$cGreen . "\"";
58 58
         }
59 59
         $htmmod = "<table><tr bgcolor=\"#FFFF99\">"
60 60
             . "<td>Versão do PHP $phpversion</td>"
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
                 );
74 74
             }
75 75
         }
76
-        return $htmmod.'</table>';
76
+        return $htmmod . '</table>';
77 77
     }
78 78
     
79 79
     /**
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             $flag = $flag && false;
93 93
             $msg .= "CNPJ incorreto! $cnpj \n";
94 94
         }
95
-        if (! is_dir($pathCertsFiles)) {
95
+        if (!is_dir($pathCertsFiles)) {
96 96
             $flag = $flag && false;
97 97
             $msg .= "Diretório não localizado! $pathCertsFiles \n";
98 98
         }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         }
102 102
         try {
103 103
             $cert = new Pkcs12($pathCertsFiles, $cnpj);
104
-            $flag = $cert->loadPfxFile($pathCertsFiles.$certPfxName, $certPassword);
104
+            $flag = $cert->loadPfxFile($pathCertsFiles . $certPfxName, $certPassword);
105 105
         } catch (InvalidArgumentException $exc) {
106 106
             $flag = false;
107 107
             $msg = $exc->getMessage();
@@ -134,12 +134,12 @@  discard block
 block discarded – undo
134 134
         $pathcerts = ''
135 135
     ) {
136 136
         $aResp = array(
137
-            'NFe' => array('status'=>true,'msg'=>''),
138
-            'CTe' => array('status'=>true,'msg'=>''),
139
-            'MDFe' => array('status'=>true,'msg'=>''),
140
-            'CLe' => array('status'=>true,'msg'=>''),
141
-            'NFSe' => array('status'=>true,'msg'=>''),
142
-            'Certs' => array('status'=>true,'msg'=>'')
137
+            'NFe' => array('status'=>true, 'msg'=>''),
138
+            'CTe' => array('status'=>true, 'msg'=>''),
139
+            'MDFe' => array('status'=>true, 'msg'=>''),
140
+            'CLe' => array('status'=>true, 'msg'=>''),
141
+            'NFSe' => array('status'=>true, 'msg'=>''),
142
+            'Certs' => array('status'=>true, 'msg'=>'')
143 143
         );
144 144
         //testa e constroi a estrutura da pasta NFe
145 145
         $aResp['NFe'] = self::zFolderMTest($pathnfe);
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
         $aResp['NFSe'] = self::zFolderMTest($pathnfse);
154 154
         //testa diretorio certs
155 155
         if ($pathcerts != '') {
156
-            if (! is_writable($pathcerts)) {
156
+            if (!is_writable($pathcerts)) {
157 157
                 $aResp['Certs'] = array('status'=>false, 'msg'=>'Diretório sem permissões de escrita');
158 158
             }
159 159
         }
Please login to merge, or discard this patch.
src/Identify/Identify.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
             $tpAmb = $dom->getNodeValue('tpAmb');
75 75
             $dhEmi = $dom->getNodeValue('dhEmi');
76 76
         }
77
-        $aResp['Id'] =  $schId;
78
-        $aResp['tag'] =  $key;
77
+        $aResp['Id'] = $schId;
78
+        $aResp['tag'] = $key;
79 79
         $aResp['dom'] = $dom;
80 80
         $aResp['chave'] = $chave;
81 81
         $aResp['tpAmb'] = $tpAmb;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     {
93 93
         foreach (self::$schemesId as $key => $schId) {
94 94
             $node = $dom->getElementsByTagName($key)->item(0);
95
-            if (! empty($node)) {
95
+            if (!empty($node)) {
96 96
                 return $schId;
97 97
             }
98 98
         }
Please login to merge, or discard this patch.
src/Modules/Modules.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
         for ($i = 1; $i < $count; $i += 2) {
35 35
             if (preg_match('/<h2>([^<]+)<\/h2>/', $vTmp[$i], $vMat)) {
36 36
                 $moduleName = trim($vMat[1]);
37
-                $vTmp2 = explode("\n", $vTmp[$i+1]);
37
+                $vTmp2 = explode("\n", $vTmp[$i + 1]);
38 38
                 foreach ($vTmp2 as $vOne) {
39 39
                     $vPat = '<info>([^<]+)<\/info>';
40 40
                     $vPat3 = "/$vPat\s*$vPat\s*$vPat/";
41 41
                     $vPat2 = "/$vPat\s*$vPat/";
42 42
                     if (preg_match($vPat3, $vOne, $vMat)) {
43
-                        $vModules[$moduleName][trim($vMat[1])] = array(trim($vMat[2]),trim($vMat[3]));
43
+                        $vModules[$moduleName][trim($vMat[1])] = array(trim($vMat[2]), trim($vMat[3]));
44 44
                     } elseif (preg_match($vPat2, $vOne, $vMat)) {
45 45
                         $vModules[$moduleName][trim($vMat[1])] = trim($vMat[2]);
46 46
                     }
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         $enabled = true;
79 79
         
80 80
         foreach ($aReq as $req) {
81
-            if (! extension_loaded($req)) {
81
+            if (!extension_loaded($req)) {
82 82
                 $enabled = ($enabled && false);
83 83
                 $lista .= "$req não está carregado no PHP.\n";
84 84
             }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     public function getModuleSetting($moduleName, $setting = '')
112 112
     {
113 113
         //verifica se o modulo está carregado antes de continuar
114
-        if ($this->isLoaded($moduleName)==false) {
114
+        if ($this->isLoaded($moduleName) == false) {
115 115
             return 'Modulo não carregado';
116 116
         }
117 117
         if ($this->list[$moduleName][$setting]) {
Please login to merge, or discard this patch.
src/Strings/Strings.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
     public static function cleanString($texto = '')
24 24
     {
25 25
         $texto = trim($texto);
26
-        $aFind = array('&','á','à','ã','â','é','ê','í','ó','ô','õ','ú','ü',
27
-            'ç','Á','À','Ã','Â','É','Ê','Í','Ó','Ô','Õ','Ú','Ü','Ç');
28
-        $aSubs = array('e','a','a','a','a','e','e','i','o','o','o','u','u',
29
-            'c','A','A','A','A','E','E','I','O','O','O','U','U','C');
26
+        $aFind = array('&', 'á', 'à', 'ã', 'â', 'é', 'ê', 'í', 'ó', 'ô', 'õ', 'ú', 'ü',
27
+            'ç', 'Á', 'À', 'Ã', 'Â', 'É', 'Ê', 'Í', 'Ó', 'Ô', 'Õ', 'Ú', 'Ü', 'Ç');
28
+        $aSubs = array('e', 'a', 'a', 'a', 'a', 'e', 'e', 'i', 'o', 'o', 'o', 'u', 'u',
29
+            'c', 'A', 'A', 'A', 'A', 'E', 'E', 'I', 'O', 'O', 'O', 'U', 'U', 'C');
30 30
         $novoTexto = str_replace($aFind, $aSubs, $texto);
31 31
         $novoTexto = preg_replace("/[^a-zA-Z0-9 @,-.;:\/]/", "", $novoTexto);
32 32
         return $novoTexto;
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
     public static function clearProt($procXML = '')
72 72
     {
73 73
         $procXML = self::clearMsg($procXML);
74
-        $aApp = array('nfe','cte','mdfe');
74
+        $aApp = array('nfe', 'cte', 'mdfe');
75 75
         foreach ($aApp as $app) {
76 76
             $procXML = str_replace(
77
-                'xmlns="http://www.portalfiscal.inf.br/'.$app.'" xmlns="http://www.w3.org/2000/09/xmldsig#"',
78
-                'xmlns="http://www.portalfiscal.inf.br/'.$app.'"',
77
+                'xmlns="http://www.portalfiscal.inf.br/' . $app . '" xmlns="http://www.w3.org/2000/09/xmldsig#"',
78
+                'xmlns="http://www.portalfiscal.inf.br/' . $app . '"',
79 79
                 $procXML
80 80
             );
81 81
         }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public static function clearMsg($msg)
91 91
     {
92
-        $nmsg = str_replace(array(' standalone="no"','default:',':default',"\n","\r","\t"), '', $msg);
92
+        $nmsg = str_replace(array(' standalone="no"', 'default:', ':default', "\n", "\r", "\t"), '', $msg);
93 93
         $nnmsg = str_replace('> ', '>', $nmsg);
94 94
         if (strpos($nnmsg, '> ')) {
95 95
             $nnmsg = self::clearMsg((string) $nnmsg);
Please login to merge, or discard this patch.
src/Soap/CurlSoap.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             throw new Exception\InvalidArgumentException($msg);
105 105
         }
106 106
         $this->sslProtocol = $sslProtocol;
107
-        if (! is_file($priKeyPath) || ! is_file($pubKeyPath) || ! is_file($certKeyPath) || ! is_numeric($timeout)) {
107
+        if (!is_file($priKeyPath) || !is_file($pubKeyPath) || !is_file($certKeyPath) || !is_numeric($timeout)) {
108 108
             $msg = "Alguns dos certificados não foram encontrados ou o timeout pode não ser numérico.";
109 109
             throw new Exception\InvalidArgumentException($msg);
110 110
         }
@@ -153,12 +153,12 @@  discard block
 block discarded – undo
153 153
     public function send($urlservice, $namespace, $header, $body, $method)
154 154
     {
155 155
         //monta a mensagem ao webservice
156
-        $data = '<?xml version="1.0" encoding="utf-8"?>'.'<soap12:Envelope ';
156
+        $data = '<?xml version="1.0" encoding="utf-8"?>' . '<soap12:Envelope ';
157 157
         $data .= 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ';
158 158
         $data .= 'xmlns:xsd="http://www.w3.org/2001/XMLSchema" ';
159 159
         $data .= 'xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">';
160
-        $data .= '<soap12:Header>'.$header.'</soap12:Header>';
161
-        $data .= '<soap12:Body>'.$body.'</soap12:Body>';
160
+        $data .= '<soap12:Header>' . $header . '</soap12:Header>';
161
+        $data .= '<soap12:Body>' . $body . '</soap12:Body>';
162 162
         $data .= '</soap12:Envelope>';
163 163
         $data = Strings::clearMsg($data);
164 164
         $this->lastMsg = $data;
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         //    "Content-length: $tamanho");
172 172
         $parametros = array(
173 173
             'Content-Type: application/soap+xml;charset=utf-8',
174
-            'SOAPAction: "'.$method.'"',
174
+            'SOAPAction: "' . $method . '"',
175 175
             "Content-length: $tamanho");
176 176
         //solicita comunicação via cURL
177 177
         $resposta = $this->zCommCurl($urlservice, $data, $parametros);
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
         $xPos = stripos($resposta, "<");
194 194
         //se não existir não é um xml nem um html
195 195
         if ($xPos !== false) {
196
-            $xml = substr($resposta, $xPos, $lenresp-$xPos);
196
+            $xml = substr($resposta, $xPos, $lenresp - $xPos);
197 197
         } else {
198 198
             $xml = '';
199 199
         }
200 200
         //testa para saber se é um xml mesmo ou é um html
201
-        $result = simplexml_load_string($xml, 'SimpleXmlElement', LIBXML_NOERROR+LIBXML_ERR_FATAL+LIBXML_ERR_NONE);
201
+        $result = simplexml_load_string($xml, 'SimpleXmlElement', LIBXML_NOERROR + LIBXML_ERR_FATAL + LIBXML_ERR_NONE);
202 202
         if ($result === false) {
203 203
             //não é um xml então pode limpar
204 204
             $xml = '';
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
             throw new Exception\RuntimeException($msg);
209 209
         }
210 210
         if ($xml != '' && substr($xml, 0, 5) != '<?xml') {
211
-            $xml = '<?xml version="1.0" encoding="utf-8"?>'.$xml;
211
+            $xml = '<?xml version="1.0" encoding="utf-8"?>' . $xml;
212 212
         }
213 213
         return $xml;
214 214
     } //fim send
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
             //não retornou um wsdl
236 236
             return false;
237 237
         }
238
-        $wsdl = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n".trim(substr($resposta, $nPos));
238
+        $wsdl = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" . trim(substr($resposta, $nPos));
239 239
         return $wsdl;
240 240
     }
241 241
 
@@ -255,9 +255,9 @@  discard block
 block discarded – undo
255 255
         if ($this->proxyIP != '') {
256 256
             curl_setopt($oCurl, CURLOPT_HTTPPROXYTUNNEL, 1);
257 257
             curl_setopt($oCurl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
258
-            curl_setopt($oCurl, CURLOPT_PROXY, $this->proxyIP.':'.$this->proxyPORT);
258
+            curl_setopt($oCurl, CURLOPT_PROXY, $this->proxyIP . ':' . $this->proxyPORT);
259 259
             if ($this->proxyPASS != '') {
260
-                curl_setopt($oCurl, CURLOPT_PROXYUSERPWD, $this->proxyUSER.':'.$this->proxyPASS);
260
+                curl_setopt($oCurl, CURLOPT_PROXYUSERPWD, $this->proxyUSER . ':' . $this->proxyPASS);
261 261
                 curl_setopt($oCurl, CURLOPT_PROXYAUTH, CURLAUTH_BASIC);
262 262
             } //fim if senha proxy
263 263
         }//fim if aProxy
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
             curl_setopt($oCurl, CURLOPT_SSLCERT, $this->certKeyPath);
295 295
             curl_setopt($oCurl, CURLOPT_SSLKEY, $this->priKeyPath);
296 296
         } else {
297
-            $agent= 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)';
297
+            $agent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)';
298 298
             curl_setopt($oCurl, CURLOPT_USERAGENT, $agent);
299 299
         }
300 300
         curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1);
@@ -347,14 +347,14 @@  discard block
 block discarded – undo
347 347
         $this->infoCurl["starttransfer_time"] = $info["starttransfer_time"];
348 348
         $this->infoCurl["redirect_time"] = $info["redirect_time"];
349 349
         //coloca as informações em uma variável
350
-        $txtInfo ="";
350
+        $txtInfo = "";
351 351
         foreach ($info as $key => $content) {
352 352
             if (is_string($content)) {
353
-                $txtInfo .= strtoupper($key).'='.$content."\n";
353
+                $txtInfo .= strtoupper($key) . '=' . $content . "\n";
354 354
             }
355 355
         }
356 356
         //carrega a variavel debug
357
-        $this->soapDebug = $data."\n\n".$txtInfo."\n".$resposta;
357
+        $this->soapDebug = $data . "\n\n" . $txtInfo . "\n" . $resposta;
358 358
     }
359 359
     
360 360
     /**
Please login to merge, or discard this patch.