Test Failed
Pull Request — master (#124)
by Rafael
02:31
created
src/DOMImproved.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
     /**
56 56
      * Load xml from path
57 57
      * @param string $filename
58
-     * @return bool
58
+     * @return false|null
59 59
      */
60 60
     public function loadXMLFile($filename)
61 61
     {
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
     public function getChave($nodeName = 'infNFe')
126 126
     {
127 127
         $node = $this->getElementsByTagName($nodeName)->item(0);
128
-        if (! empty($node)) {
128
+        if (!empty($node)) {
129 129
             $chaveId = $node->getAttribute("Id");
130
-            $chave =  preg_replace('/[^0-9]/', '', $chaveId);
130
+            $chave = preg_replace('/[^0-9]/', '', $chaveId);
131 131
             return $chave;
132 132
         }
133 133
         return '';
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
      * @return void
148 148
      */
149 149
     public function addChild(
150
-        DOMElement &$parent,
150
+        DOMElement & $parent,
151 151
         $name,
152 152
         $content = '',
153 153
         $obrigatorio = false,
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
      * @param string $msg
175 175
      * @return void
176 176
      */
177
-    public function appChild(DOMElement &$parent, DOMElement $child = null, $msg = '')
177
+    public function appChild(DOMElement & $parent, DOMElement $child = null, $msg = '')
178 178
     {
179 179
         if (empty($child)) {
180 180
             $this->erros[] = $msg;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
      * @param DOMElement $parent
189 189
      * @param DOMElement $child
190 190
      */
191
-    public function appExternalChild(DOMElement &$parent, DOMElement $child)
191
+    public function appExternalChild(DOMElement & $parent, DOMElement $child)
192 192
     {
193 193
         $node = $this->importNode($child, true);
194 194
         $parent->appendChild($node);
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      * @return void
204 204
      */
205 205
     public function appExternalChildBefore(
206
-        DOMElement &$parent,
206
+        DOMElement & $parent,
207 207
         DOMElement $child,
208 208
         $before
209 209
     ) {
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
      * @param string $msg
226 226
      * @return void
227 227
      */
228
-    public function appChildBefore(DOMElement &$parent, DOMElement $child = null, $before = '', $msg = '')
228
+    public function appChildBefore(DOMElement & $parent, DOMElement $child = null, $before = '', $msg = '')
229 229
     {
230 230
         if (empty($child) ||
231 231
             empty($before) ||
@@ -244,10 +244,10 @@  discard block
 block discarded – undo
244 244
      * @param array $arr
245 245
      * @return int
246 246
      */
247
-    public function addArrayChild(DOMElement &$parent, $arr)
247
+    public function addArrayChild(DOMElement & $parent, $arr)
248 248
     {
249 249
         $num = 0;
250
-        if (! empty($arr) && ! empty($parent)) {
250
+        if (!empty($arr) && !empty($parent)) {
251 251
             foreach ($arr as $node) {
252 252
                 $this->appChild($parent, $node, '');
253 253
                 $num++;
Please login to merge, or discard this patch.
src/Exception/ExceptionCollection.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,6 @@
 block discarded – undo
32 32
     
33 33
     /**
34 34
      * Add exceptions to the collection
35
-     * @param ExceptionCollection|\Exception $e Exception to add
36 35
      * @return ExceptionCollection;
37 36
      */
38 37
     public function add(\Exception $exception)
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@
 block discarded – undo
87 87
      */
88 88
     public function __toString()
89 89
     {
90
-        $messages = array_map(function (\Exception $exception) {
90
+        $messages = array_map(function(\Exception $exception) {
91 91
             return $exception->getMessage();
92 92
         }, $this->exceptions);
93 93
         return implode(PHP_EOL, $messages);
Please login to merge, or discard this patch.
src/Soap/SoapBase.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,6 @@
 block discarded – undo
17 17
 
18 18
 use NFePHP\Common\Certificate;
19 19
 use NFePHP\Common\Soap\SoapInterface;
20
-use NFePHP\Common\Exception\SoapException;
21 20
 use NFePHP\Common\Exception\RuntimeException;
22 21
 use NFePHP\Common\Strings;
23 22
 use League\Flysystem\Filesystem;
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
     /**
280 280
      * Set security protocol
281 281
      * @param int $protocol
282
-     * @return type Description
282
+     * @return integer Description
283 283
      */
284 284
     public function protocol($protocol = self::SSL_DEFAULT)
285 285
     {
@@ -330,6 +330,7 @@  discard block
 block discarded – undo
330 330
      * @param string $request
331 331
      * @param array $namespaces
332 332
      * @param \SOAPHeader $header
333
+     * @param integer $soapver
333 334
      * @return string
334 335
      */
335 336
     protected function makeEnvelopeSoap(
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -373,9 +373,9 @@  discard block
 block discarded – undo
373 373
             );
374 374
         }
375 375
         $this->certsdir = $this->certificate->getCnpj() . '/certs/';
376
-        $this->prifile = $this->certsdir. Strings::randomString(10).'.pem';
377
-        $this->pubfile = $this->certsdir . Strings::randomString(10).'.pem';
378
-        $this->certfile = $this->certsdir . Strings::randomString(10).'.pem';
376
+        $this->prifile = $this->certsdir . Strings::randomString(10) . '.pem';
377
+        $this->pubfile = $this->certsdir . Strings::randomString(10) . '.pem';
378
+        $this->certfile = $this->certsdir . Strings::randomString(10) . '.pem';
379 379
         $ret = true;
380 380
         //cria uma senha temporária ALEATÓRIA para salvar a chave primaria
381 381
         //portanto mesmo que localizada e identificada não estará acessível
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
         );
397 397
         $ret &= $this->filesystem->put(
398 398
             $this->certfile,
399
-            $this->certificate->privateKey.$this->certificate->publicKey
399
+            $this->certificate->privateKey . $this->certificate->publicKey
400 400
         );
401 401
         if (!$ret) {
402 402
             throw new RuntimeException(
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
         //utilize a API. Outra solução para remover arquivos "perdidos" pode ser
423 423
         //encontrada oportunamente.
424 424
         $dt = new \DateTime();
425
-        $tint = new \DateInterval("PT".$this->waitingTime."M");
425
+        $tint = new \DateInterval("PT" . $this->waitingTime . "M");
426 426
         $tint->invert = true;
427 427
         $tsLimit = $dt->add($tint)->getTimestamp();
428 428
         foreach ($contents as $item) {
Please login to merge, or discard this patch.
src/Validator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,10 +39,10 @@
 block discarded – undo
39 39
         $dom->formatOutput = false;
40 40
         $dom->loadXML($xml, LIBXML_NOBLANKS | LIBXML_NOEMPTYTAG);
41 41
         libxml_clear_errors();
42
-        if (! $dom->schemaValidate($xsd)) {
42
+        if (!$dom->schemaValidate($xsd)) {
43 43
             $msg = '';
44 44
             foreach (libxml_get_errors() as $error) {
45
-                $msg .= $error->message."\n";
45
+                $msg .= $error->message . "\n";
46 46
             }
47 47
             throw new RuntimeException($msg);
48 48
         }
Please login to merge, or discard this patch.
src/Certificate/Oids.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
      */
52 52
     private static function loadOids()
53 53
     {
54
-        $json = file_get_contents(__DIR__ .'/oids.json');
54
+        $json = file_get_contents(__DIR__ . '/oids.json');
55 55
         self::$oidsTable = (array) json_decode($json, true);
56 56
     }
57 57
 }
Please login to merge, or discard this patch.
src/Certificate/PublicKey.php 2 patches
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -93,8 +93,7 @@
 block discarded – undo
93 93
         $detail = openssl_x509_parse($resource, false);
94 94
         $this->commonName = $detail['subject']['commonName'];
95 95
         $this->emailAddress = !empty($detail['subject']['emailAddress']) ?
96
-            $detail['subject']['emailAddress'] :
97
-            '';
96
+            $detail['subject']['emailAddress'] : '';
98 97
         $this->cspName = $detail['issuer']['organizationalUnitName'];
99 98
         $this->serialNumber = $detail['serialNumber'];
100 99
         $this->validFrom = \DateTime::createFromFormat('ymdHis\Z', $detail['validFrom']);
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
     /**
64 64
      * Load class with certificate content
65 65
      * @param string $content
66
-     * @return \static
66
+     * @return PublicKey
67 67
      */
68 68
     public static function createFromContent($content)
69 69
     {
Please login to merge, or discard this patch.
src/Strings.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
     public static function replaceSpecialsChars($string)
24 24
     {
25 25
         $string = trim($string);
26
-        $aFind = ['&','á','à','ã','â','é','ê','í','ó','ô','õ','ú','ü',
27
-            'ç','Á','À','Ã','Â','É','Ê','Í','Ó','Ô','Õ','Ú','Ü','Ç'];
28
-        $aSubs = ['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 = ['&', 'á', 'à', 'ã', 'â', 'é', 'ê', 'í', 'ó', 'ô', 'õ', 'ú', 'ü',
27
+            'ç', 'Á', 'À', 'Ã', 'Â', 'É', 'Ê', 'Í', 'Ó', 'Ô', 'Õ', 'Ú', 'Ü', 'Ç'];
28
+        $aSubs = ['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
         $newstr = str_replace($aFind, $aSubs, $string);
31 31
         $newstr = preg_replace("/[^a-zA-Z0-9 @,-.;:\/]/", "", $newstr);
32 32
         return $newstr;
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
     public static function clearProtocoledXML($string)
85 85
     {
86 86
         $procXML = self::clearXmlString($string);
87
-        $aApp = array('nfe','cte','mdfe');
87
+        $aApp = array('nfe', 'cte', 'mdfe');
88 88
         foreach ($aApp as $app) {
89 89
             $procXML = str_replace(
90
-                'xmlns="http://www.portalfiscal.inf.br/'.$app.'" xmlns="http://www.w3.org/2000/09/xmldsig#"',
91
-                'xmlns="http://www.portalfiscal.inf.br/'.$app.'"',
90
+                'xmlns="http://www.portalfiscal.inf.br/' . $app . '" xmlns="http://www.w3.org/2000/09/xmldsig#"',
91
+                'xmlns="http://www.portalfiscal.inf.br/' . $app . '"',
92 92
                 $procXML
93 93
             );
94 94
         }
Please login to merge, or discard this patch.
src/Soap/SoapClientExtended.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
      */
31 31
     public function __doRequest($request, $location, $action, $version, $oneWay = 0)
32 32
     {
33
-        $search = [":ns1","ns1:","\n","\r"];
33
+        $search = [":ns1", "ns1:", "\n", "\r"];
34 34
         return parent::__doRequest(
35 35
             str_replace($search, '', $request),
36 36
             $location,
Please login to merge, or discard this patch.
src/Soap/SoapCode.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 {
23 23
     public static function info($code)
24 24
     {
25
-        $codes = (array) json_decode(file_get_contents(__DIR__.'/httpcodes.json'), true);
25
+        $codes = (array) json_decode(file_get_contents(__DIR__ . '/httpcodes.json'), true);
26 26
         if (array_key_exists($code, $codes)) {
27 27
             return $codes[$code];
28 28
         }
Please login to merge, or discard this patch.