Completed
Push — master ( 84cd59...e7d66f )
by Roberto
04:59 queued 02:31
created
src/Certificate.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
      * Read PFX and return this class
54 54
      * @param string $content
55 55
      * @param string $password
56
-     * @return \static
56
+     * @return Certificate
57 57
      * @throws CertificateException
58 58
      */
59 59
     public static function readPfx($content, $password)
Please login to merge, or discard this patch.
src/Certificate/Asn1.php 2 patches
Doc Comments   +3 added lines, -5 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      * type "sequence", as the first element of the structure
40 40
      * @param string $publickeyUnformated
41 41
      * @param string $oidNumber OID formated number
42
-     * @return array
42
+     * @return string
43 43
      */
44 44
     public static function getOIDdata($oidNumber, $publickeyUnformated)
45 45
     {
@@ -88,10 +88,8 @@  discard block
 block discarded – undo
88 88
     
89 89
     /**
90 90
      * Get length of data field of a sequency from certifcate
91
-     * @param integer $len
92
-     * @param integer $bytes
93 91
      * @param string $data
94
-     * @return void
92
+     * @return integer
95 93
      */
96 94
     protected static function getLength($data)
97 95
     {
@@ -142,7 +140,7 @@  discard block
 block discarded – undo
142 140
      * @param array $abIn
143 141
      * @param integer $qIn
144 142
      * @param boolean $flag
145
-     * @return integer
143
+     * @return integer[]
146 144
      */
147 145
     protected static function xBase128($abIn, $qIn, $flag)
148 146
     {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
             //get length of OID data
79 79
             $len = self::getLength((string) $data);
80 80
             //get only a string with bytes belongs to OID
81
-            $oidData = substr($data, 2 + $bytes, $len-($bytes));
81
+            $oidData = substr($data, 2 + $bytes, $len - ($bytes));
82 82
             //parse OID data many possibel formats and structures
83 83
             $head = strlen($oidData) - strlen($xcv) - 2;
84 84
             $ret = substr($oidData, -$head);
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
             if ($num == 0) {
125 125
                 $bun = 40 * $partes[$num];
126 126
             } elseif ($num == 1) {
127
-                $bun +=  $partes[$num];
127
+                $bun += $partes[$num];
128 128
                 $abBinary[] = $bun;
129 129
             } else {
130 130
                 $abBinary = self::xBase128((array) $abBinary, (integer) $partes[$num], true);
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
     {
149 149
         $abc = $abIn;
150 150
         if ($qIn > 127) {
151
-            $abc = $this->xBase128($abc, floor($qIn/128), false);
151
+            $abc = $this->xBase128($abc, floor($qIn / 128), false);
152 152
         }
153 153
         $qIn2 = $qIn % 128;
154 154
         if ($flag) {
Please login to merge, or discard this patch.
src/Certificate/CertificationChain.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
     
41 41
     /**
42 42
      * Add new certificate to certification chain
43
-     * @param string $contente Certificate in DER, CER or PEM format
43
+     * @param string $content Certificate in DER, CER or PEM format
44 44
      * @return array
45 45
      */
46 46
     public function add($content)
Please login to merge, or discard this patch.
src/Certificate/PublicKey.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 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
     {
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      * @param string $data
109 109
      * @param string $signature
110 110
      * @param int $algorithm [optional] For more information see the list of Signature Algorithms.
111
-     * @return int Returns true if the signature is correct, false if it is incorrect
111
+     * @return boolean Returns true if the signature is correct, false if it is incorrect
112 112
      * @throws CertificateException An error has occurred when verify signature
113 113
      */
114 114
     public function verify($data, $signature, $algorithm = OPENSSL_ALGO_SHA1)
Please login to merge, or discard this patch.
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.
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
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
     
72 72
     public function __toString()
73 73
     {
74
-        $messages = array_map(function (\Exception $exception) {
74
+        $messages = array_map(function(\Exception $exception) {
75 75
             return $exception->getMessage();
76 76
         }, $this->exceptions);
77 77
         return implode(PHP_EOL, $messages);
Please login to merge, or discard this patch.
src/Signer.php 2 patches
Doc Comments   +1 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      * Make Signature tag
38 38
      * @param string $content
39 39
      * @param string $tagname
40
-     * @param string $marker for URI
40
+     * @param string $mark for URI
41 41
      * @param string $algorithm
42 42
      * @param array $canonical parameters to format node for signature
43 43
      * @param string $rootname name of tag to insert signature block
@@ -102,7 +102,6 @@  discard block
 block discarded – undo
102 102
     
103 103
     /**
104 104
      * Verify if xml signature is valid
105
-     * @param string $content xml content
106 105
      * @param string $tagname tag for sign
107 106
      * @return boolean
108 107
      */
@@ -237,8 +236,6 @@  discard block
 block discarded – undo
237 236
     /**
238 237
      * digestCheck
239 238
      * Verify digest value
240
-     * @param string $content
241
-     * @param string $tagid
242 239
      * @return boolean
243 240
      * @throws \NFePHP\Common\Exception\SignerException
244 241
      */
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 class Signer
33 33
 {
34
-    private static $canonical = [false,false,null,null];
34
+    private static $canonical = [false, false, null, null];
35 35
     
36 36
     /**
37 37
      * Make Signature tag
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         $tagname = '',
51 51
         $mark = 'Id',
52 52
         $algorithm = OPENSSL_ALGO_SHA1,
53
-        $canonical = [false,false,null,null],
53
+        $canonical = [false, false, null, null],
54 54
         $rootname = ''
55 55
     ) {
56 56
         //$content = Strings::clearXmlString($content, true);
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         if (empty($node) || empty($root)) {
70 70
             throw SignerException::tagNotFound($tagname . ' ' . $rootname);
71 71
         }
72
-        if (! self::existsSignature($dom)) {
72
+        if (!self::existsSignature($dom)) {
73 73
             $dom = self::createSignature(
74 74
                 $certificate,
75 75
                 $dom,
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         DOMElement $node,
134 134
         $mark,
135 135
         $algorithm = OPENSSL_ALGO_SHA1,
136
-        $canonical = [false,false,null,null]
136
+        $canonical = [false, false, null, null]
137 137
     ) {
138 138
         $nsDSIG = 'http://www.w3.org/2000/09/xmldsig#';
139 139
         $nsCannonMethod = 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315';
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
             $nsSignatureMethod = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256';
146 146
             $nsDigestMethod = 'http://www.w3.org/2001/04/xmlenc#sha256';
147 147
         }
148
-        $nsTransformMethod1 ='http://www.w3.org/2000/09/xmldsig#enveloped-signature';
148
+        $nsTransformMethod1 = 'http://www.w3.org/2000/09/xmldsig#enveloped-signature';
149 149
         $nsTransformMethod2 = 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315';
150 150
         $idSigned = trim($node->getAttribute($mark));
151 151
         $digestValue = self::makeDigest($node, $digestAlgorithm, $canonical);
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
             throw SignnerException::tagNotFound($tagname);
251 251
         }
252 252
         $signature = $dom->getElementsByTagName('Signature')->item(0);
253
-        if (! empty($signature)) {
253
+        if (!empty($signature)) {
254 254
             $clone = $signature->cloneNode(true);
255 255
         } else {
256 256
             $signature = $dom->getElementsByTagName('Signature')->item(0);
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
      * @param array $canonical
280 280
      * @return string
281 281
      */
282
-    private static function makeDigest(DOMElement $node, $algorithm, $canonical = [false,false,null,null])
282
+    private static function makeDigest(DOMElement $node, $algorithm, $canonical = [false, false, null, null])
283 283
     {
284 284
         $dados = $node->C14N(true, false, null, null);
285 285
         //calcular o hash dos dados
Please login to merge, or discard this patch.
src/Soap/SoapBase.php 3 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -207,6 +207,7 @@  discard block
 block discarded – undo
207 207
      * @param string $operation
208 208
      * @param array $namespaces
209 209
      * @param \SOAPHeader $header
210
+     * @param integer $soapver
210 211
      * @return string
211 212
      */
212 213
     protected function makeEnvelopeSoap(
@@ -275,6 +276,7 @@  discard block
 block discarded – undo
275 276
     
276 277
     /**
277 278
      * Delete all files in folder
279
+     * @param string $folder
278 280
      */
279 281
     public function removeTemporarilyFiles($folder)
280 282
     {
Please login to merge, or discard this patch.
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.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -250,9 +250,9 @@
 block discarded – undo
250 250
             );
251 251
         }
252 252
         $this->certsdir = $this->certificate->getCnpj() . '/certs/';
253
-        $this->prifile = $this->certsdir. Strings::randomString(10).'.pem';
254
-        $this->pubfile = $this->certsdir . Strings::randomString(10).'.pem';
255
-        $this->certfile = $this->certsdir . Strings::randomString(10).'.pem';
253
+        $this->prifile = $this->certsdir . Strings::randomString(10) . '.pem';
254
+        $this->pubfile = $this->certsdir . Strings::randomString(10) . '.pem';
255
+        $this->certfile = $this->certsdir . Strings::randomString(10) . '.pem';
256 256
         $ret = true;
257 257
         $ret &= $this->filesystem->put(
258 258
             $this->prifile,
Please login to merge, or discard this patch.
src/Soap/SoapFake.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,6 @@
 block discarded – undo
16 16
  */
17 17
 use NFePHP\Common\Soap\SoapBase;
18 18
 use NFePHP\Common\Soap\SoapInterface;
19
-use NFePHP\Common\Exception\SoapException;
20 19
 use NFePHP\Common\Certificate;
21 20
 use Psr\Log\LoggerInterface;
22 21
 
Please login to merge, or discard this patch.