Passed
Push — master ( d5f45e...403c65 )
by Roberto
49s
created
src/Common/Standardize.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function toStd($xml = null)
57 57
     {
58
-        if (! empty($xml)) {
58
+        if (!empty($xml)) {
59 59
             $this->whichIs($xml);
60 60
         }
61 61
         $sxml       = simplexml_load_string($this->node);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      */
79 79
     public function whichIs($xml)
80 80
     {
81
-        if (! Validator::isXML($xml)) {
81
+        if (!Validator::isXML($xml)) {
82 82
             throw new InvalidArgumentException(
83 83
                 "O argumento passado não é um XML válido."
84 84
             );
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
         $dom->formatOutput       = false;
89 89
         $dom->loadXML($xml);
90 90
         foreach ($this->rootTagList as $key) {
91
-            $node = ! empty($dom->getElementsByTagName($key)->item(0))
91
+            $node = !empty($dom->getElementsByTagName($key)->item(0))
92 92
                 ? $dom->getElementsByTagName($key)->item(0)
93 93
                 : '';
94
-            if (! empty($node)) {
94
+            if (!empty($node)) {
95 95
                 $this->node = $dom->saveXML($node);
96 96
 
97 97
                 return $key;
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      */
122 122
     public function toJson($xml = null)
123 123
     {
124
-        if (! empty($xml)) {
124
+        if (!empty($xml)) {
125 125
             $this->toStd($xml);
126 126
         }
127 127
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      */
138 138
     public function toYaml($xml = null)
139 139
     {
140
-        if (! empty($xml)) {
140
+        if (!empty($xml)) {
141 141
             $this->toStd($xml);
142 142
         }
143 143
         $array = $this->toArray();
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
      */
155 155
     public function toArray($xml = null)
156 156
     {
157
-        if (! empty($xml)) {
157
+        if (!empty($xml)) {
158 158
             $this->toStd($xml);
159 159
         }
160 160
 
Please login to merge, or discard this patch.
src/Common/Factory.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         //set properties from config
148 148
         $stdConf    = json_decode($config);
149 149
         $this->date = new DateTime();
150
-        if (! empty($date)) {
150
+        if (!empty($date)) {
151 151
             $this->date = new DateTime($date);
152 152
         }
153 153
         $this->tpAmb       = $stdConf->tpAmb;
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         $this->nmRazao     = $stdConf->empregador->nmRazao;
159 159
         $this->layoutStr   = $this->strLayoutVer($this->layout);
160 160
         $this->certificate = $certificate;
161
-        if (empty($std) || ! is_object($std)) {
161
+        if (empty($std) || !is_object($std)) {
162 162
             throw new \InvalidArgumentException(
163 163
                 'Você deve passar os parâmetros num stdClass.'
164 164
             );
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
             .$this->evtName
170 170
             .".schema"
171 171
         );
172
-        $this->schema     = realpath(
172
+        $this->schema = realpath(
173 173
             __DIR__
174 174
             ."/../../schemes/$this->layoutStr/"
175 175
             .$this->evtName
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
         $fils = explode('.', $layout);
199 199
         $str  = 'v';
200 200
         foreach ($fils as $fil) {
201
-            $str .= str_pad($fil, 2, '0', STR_PAD_LEFT).'_';
201
+            $str .= str_pad($fil, 2, '0', STR_PAD_LEFT) . '_';
202 202
         }
203 203
 
204 204
         return substr($str, 0, -1);
@@ -236,12 +236,12 @@  discard block
 block discarded – undo
236 236
      */
237 237
     protected function validInputData($data)
238 238
     {
239
-        if (! is_file($this->jsonschema)) {
239
+        if (!is_file($this->jsonschema)) {
240 240
             return true;
241 241
         }
242 242
         $validator = new JsonValid();
243
-        $validator->check($data, (object) ['$ref' => 'file://'.$this->jsonschema]);
244
-        if (! $validator->isValid()) {
243
+        $validator->check($data, (object) ['$ref' => 'file://' . $this->jsonschema]);
244
+        if (!$validator->isValid()) {
245 245
             $msg = "JSON does not validate. Violations:\n";
246 246
             foreach ($validator->getErrors() as $error) {
247 247
                 $msg .= sprintf("[%s] %s\n", $error['property'], $error['message']);
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
      */
399 399
     public function standardizeProperties(stdClass $data)
400 400
     {
401
-        if (! is_file($this->jsonschema)) {
401
+        if (!is_file($this->jsonschema)) {
402 402
             return $data;
403 403
         }
404 404
         $jsonSchemaObj = json_decode(file_get_contents($this->jsonschema));
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
     {
415 415
         $xml = $this->dom->saveXML($this->eSocial);
416 416
         $xml = Strings::clearXmlString($xml);
417
-        if (! empty($this->certificate)) {
417
+        if (!empty($this->certificate)) {
418 418
             $xml = Signer::sign(
419 419
                 $this->certificate,
420 420
                 $xml,
Please login to merge, or discard this patch.
src/Common/Soap/SoapBase.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     ) {
187 187
         $this->logger      = $logger;
188 188
         $this->certificate = $this->checkCertValidity($certificate);
189
-        $this->setTemporaryFolder(sys_get_temp_dir().'/sped/');
189
+        $this->setTemporaryFolder(sys_get_temp_dir() . '/sped/');
190 190
     }
191 191
 
192 192
     /**
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         if ($this->disableCertValidation) {
203 203
             return $certificate;
204 204
         }
205
-        if (! empty($certificate)) {
205
+        if (!empty($certificate)) {
206 206
             if ($certificate->isExpired()) {
207 207
                 throw new RuntimeException(
208 208
                     'The validity of the certificate has expired.'
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         //utilize a API. Outra solução para remover arquivos "perdidos" pode ser
262 262
         //encontrada oportunamente.
263 263
         $dt           = new \DateTime();
264
-        $tint         = new \DateInterval("PT".$this->waitingTime."M");
264
+        $tint         = new \DateInterval("PT" . $this->waitingTime . "M");
265 265
         $tint->invert = true;
266 266
         $tsLimit      = $dt->add($tint)->getTimestamp();
267 267
         foreach ($contents as $item) {
@@ -431,15 +431,15 @@  discard block
 block discarded – undo
431 431
      */
432 432
     public function saveTemporarilyKeyFiles()
433 433
     {
434
-        if (! is_object($this->certificate)) {
434
+        if (!is_object($this->certificate)) {
435 435
             throw new RuntimeException(
436 436
                 'Certificate not found.'
437 437
             );
438 438
         }
439
-        $this->certsdir = $this->certificate->getCnpj().'/certs/';
440
-        $this->prifile  = $this->certsdir.Strings::randomString(10).'.pem';
441
-        $this->pubfile  = $this->certsdir.Strings::randomString(10).'.pem';
442
-        $this->certfile = $this->certsdir.Strings::randomString(10).'.pem';
439
+        $this->certsdir = $this->certificate->getCnpj() . '/certs/';
440
+        $this->prifile  = $this->certsdir . Strings::randomString(10) . '.pem';
441
+        $this->pubfile  = $this->certsdir . Strings::randomString(10) . '.pem';
442
+        $this->certfile = $this->certsdir . Strings::randomString(10) . '.pem';
443 443
         $ret            = true;
444 444
         $private        = $this->certificate->privateKey;
445 445
         if ($this->encriptPrivateKey) {
@@ -464,9 +464,9 @@  discard block
 block discarded – undo
464 464
         );
465 465
         $ret &= $this->filesystem->put(
466 466
             $this->certfile,
467
-            $private."{$this->certificate}"
467
+            $private . "{$this->certificate}"
468 468
         );
469
-        if (! $ret) {
469
+        if (!$ret) {
470 470
             throw new RuntimeException(
471 471
                 'Unable to save temporary key files in folder.'
472 472
             );
@@ -484,19 +484,19 @@  discard block
 block discarded – undo
484 484
      */
485 485
     public function saveDebugFiles($operation, $request, $response)
486 486
     {
487
-        if (! $this->debugmode) {
487
+        if (!$this->debugmode) {
488 488
             return;
489 489
         }
490
-        $this->debugdir = $this->certificate->getCnpj().'/debug/';
490
+        $this->debugdir = $this->certificate->getCnpj() . '/debug/';
491 491
         $now            = \DateTime::createFromFormat('U.u', microtime(true));
492 492
         $time           = substr($now->format("ymdHisu"), 0, 16);
493 493
         try {
494 494
             $this->filesystem->put(
495
-                $this->debugdir.$time."_".$operation."_sol.txt",
495
+                $this->debugdir . $time . "_" . $operation . "_sol.txt",
496 496
                 $request
497 497
             );
498 498
             $this->filesystem->put(
499
-                $this->debugdir.$time."_".$operation."_res.txt",
499
+                $this->debugdir . $time . "_" . $operation . "_res.txt",
500 500
                 $response
501 501
             );
502 502
         } catch (Exception $e) {
@@ -526,10 +526,10 @@  discard block
 block discarded – undo
526 526
         foreach ($namespaces as $key => $value) {
527 527
             $envelope .= " $key=\"$value\"";
528 528
         }
529
-        $envelope   .= ">";
529
+        $envelope .= ">";
530 530
         $soapheader = "<$prefix:Header/>";
531
-        if (! empty($header)) {
532
-            $ns         = ! empty($header->namespace) ? $header->namespace : '';
531
+        if (!empty($header)) {
532
+            $ns         = !empty($header->namespace) ? $header->namespace : '';
533 533
             $name       = $header->name;
534 534
             $soapheader = "<$prefix:Header>";
535 535
             $soapheader .= "<$name xmlns=\"$ns\">";
Please login to merge, or discard this patch.
src/Common/FakePretty.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
     public static function prettyPrint($response, $save = '')
8 8
     {
9 9
         $std = json_decode($response);
10
-        if (! empty($save)) {
10
+        if (!empty($save)) {
11 11
             file_put_contents(
12 12
                 "/var/www/sped/sped-nfe/tests/fixtures/xml/$save.xml",
13 13
                 $std->body
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         $html .= $std->header;
43 43
         $html .= "<br>";
44 44
         $html .= '<h2>namespaces</h2>';
45
-        $an   = json_decode(json_encode($std->namespaces), true);
45
+        $an = json_decode(json_encode($std->namespaces), true);
46 46
         foreach ($an as $key => $nam) {
47 47
             $html .= "[$key] => $nam <br>";
48 48
         }
Please login to merge, or discard this patch.