@@ -17,9 +17,9 @@ |
||
17 | 17 | { |
18 | 18 | $msg = ''; |
19 | 19 | foreach ($errors as $error) { |
20 | - $msg .= $error->message."\n"; |
|
20 | + $msg .= $error->message . "\n"; |
|
21 | 21 | } |
22 | - return new static('This XML is not valid. '.$msg); |
|
22 | + return new static('This XML is not valid. ' . $msg); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | public static function isNotXml() |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | curl_setopt($oCurl, CURLOPT_SSLKEY, $this->tempdir . $this->prifile); |
98 | 98 | curl_setopt($oCurl, CURLOPT_KEYPASSWD, $this->temppass); |
99 | 99 | curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1); |
100 | - if (! empty($envelope)) { |
|
100 | + if (!empty($envelope)) { |
|
101 | 101 | curl_setopt($oCurl, CURLOPT_POST, 1); |
102 | 102 | curl_setopt($oCurl, CURLOPT_POSTFIELDS, $envelope); |
103 | 103 | curl_setopt($oCurl, CURLOPT_HTTPHEADER, $parameters); |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | if ($this->proxyIP != '') { |
137 | 137 | curl_setopt($oCurl, CURLOPT_HTTPPROXYTUNNEL, 1); |
138 | 138 | curl_setopt($oCurl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); |
139 | - curl_setopt($oCurl, CURLOPT_PROXY, $this->proxyIP.':'.$this->proxyPort); |
|
139 | + curl_setopt($oCurl, CURLOPT_PROXY, $this->proxyIP . ':' . $this->proxyPort); |
|
140 | 140 | if ($this->proxyUser != '') { |
141 | - curl_setopt($oCurl, CURLOPT_PROXYUSERPWD, $this->proxyUser.':'.$this->proxyPass); |
|
141 | + curl_setopt($oCurl, CURLOPT_PROXYUSERPWD, $this->proxyUser . ':' . $this->proxyPass); |
|
142 | 142 | curl_setopt($oCurl, CURLOPT_PROXYAUTH, CURLAUTH_BASIC); |
143 | 143 | } |
144 | 144 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * Make Signature tag |
39 | 39 | * @param string $content |
40 | 40 | * @param string $tagname |
41 | - * @param string $marker for URI |
|
41 | + * @param string $mark for URI |
|
42 | 42 | * @param string $algorithm |
43 | 43 | * @param array $canonical parameters to format node for signature |
44 | 44 | * @param string $rootname name of tag to insert signature block |
@@ -104,7 +104,6 @@ discard block |
||
104 | 104 | |
105 | 105 | /** |
106 | 106 | * Verify if xml signature is valid |
107 | - * @param string $content xml content |
|
108 | 107 | * @param string $tagname tag for sign |
109 | 108 | * @return boolean |
110 | 109 | */ |
@@ -241,8 +240,6 @@ discard block |
||
241 | 240 | /** |
242 | 241 | * digestCheck |
243 | 242 | * Verify digest value |
244 | - * @param string $content |
|
245 | - * @param string $tagid |
|
246 | 243 | * @return boolean |
247 | 244 | * @throws SignerException |
248 | 245 | */ |
@@ -25,7 +25,6 @@ |
||
25 | 25 | use NFePHP\Common\Certificate; |
26 | 26 | use NFePHP\Common\Certificate\PublicKey; |
27 | 27 | use NFePHP\Common\Exception\SignerException; |
28 | -use NFePHP\Common\Strings; |
|
29 | 28 | use DOMDocument; |
30 | 29 | use DOMNode; |
31 | 30 | use DOMElement; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | class Signer |
34 | 34 | { |
35 | - private static $canonical = [false,false,null,null]; |
|
35 | + private static $canonical = [false, false, null, null]; |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * Make Signature tag |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $tagname = '', |
52 | 52 | $mark = 'Id', |
53 | 53 | $algorithm = OPENSSL_ALGO_SHA1, |
54 | - $canonical = [false,false,null,null], |
|
54 | + $canonical = [false, false, null, null], |
|
55 | 55 | $rootname = '' |
56 | 56 | ) { |
57 | 57 | if (!empty($canonical)) { |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | if (empty($node) || empty($root)) { |
70 | 70 | throw SignerException::tagNotFound($tagname); |
71 | 71 | } |
72 | - if (! self::existsSignature($dom)) { |
|
72 | + if (!self::existsSignature($dom)) { |
|
73 | 73 | $dom = self::createSignature( |
74 | 74 | $certificate, |
75 | 75 | $dom, |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | DOMNode $node, |
136 | 136 | $mark, |
137 | 137 | $algorithm = OPENSSL_ALGO_SHA1, |
138 | - $canonical = [false,false,null,null] |
|
138 | + $canonical = [false, false, null, null] |
|
139 | 139 | ) { |
140 | 140 | $nsDSIG = 'http://www.w3.org/2000/09/xmldsig#'; |
141 | 141 | $nsCannonMethod = 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315'; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $nsSignatureMethod = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'; |
148 | 148 | $nsDigestMethod = 'http://www.w3.org/2001/04/xmlenc#sha256'; |
149 | 149 | } |
150 | - $nsTransformMethod1 ='http://www.w3.org/2000/09/xmldsig#enveloped-signature'; |
|
150 | + $nsTransformMethod1 = 'http://www.w3.org/2000/09/xmldsig#enveloped-signature'; |
|
151 | 151 | $nsTransformMethod2 = 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315'; |
152 | 152 | $idSigned = trim($node->getAttribute($mark)); |
153 | 153 | $digestValue = self::makeDigest($node, $digestAlgorithm, $canonical); |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | { |
249 | 249 | $node = $dom->getElementsByTagName($tagname)->item(0); |
250 | 250 | if (empty($node)) { |
251 | - throw new \RuntimeException('Tag not found ' .$tagname); |
|
251 | + throw new \RuntimeException('Tag not found ' . $tagname); |
|
252 | 252 | } |
253 | 253 | $signature = $dom->getElementsByTagName('Signature')->item(0); |
254 | 254 | if (empty($signature)) { |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * @param array $canonical |
286 | 286 | * @return string |
287 | 287 | */ |
288 | - private static function makeDigest(DOMElement $node, $algorithm, $canonical = [false,false,null,null]) |
|
288 | + private static function makeDigest(DOMElement $node, $algorithm, $canonical = [false, false, null, null]) |
|
289 | 289 | { |
290 | 290 | //calcular o hash dos dados |
291 | 291 | $c14n = $node->C14N( |
@@ -19,7 +19,6 @@ |
||
19 | 19 | use NFePHP\Common\Soap\SoapBase; |
20 | 20 | use NFePHP\Common\Soap\SoapInterface; |
21 | 21 | use NFePHP\Common\Exception\SoapException; |
22 | -use SoapHeader; |
|
23 | 22 | use SoapFault; |
24 | 23 | use NFePHP\Common\Certificate; |
25 | 24 | use Psr\Log\LoggerInterface; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | //get length of OID data |
78 | 78 | $len = self::getLength((string) $data); |
79 | 79 | //get only a string with bytes belongs to OID |
80 | - $oidData = substr($data, 2 + $bytes, $len-($bytes)); |
|
80 | + $oidData = substr($data, 2 + $bytes, $len - ($bytes)); |
|
81 | 81 | //parse OID data many possibel formats and structures |
82 | 82 | $head = strlen($oidData) - strlen($xcv) - 2; |
83 | 83 | $ret = substr($oidData, -$head); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | if ($num == 0) { |
122 | 122 | $bun = 40 * $partes[$num]; |
123 | 123 | } elseif ($num == 1) { |
124 | - $bun += $partes[$num]; |
|
124 | + $bun += $partes[$num]; |
|
125 | 125 | $abBinary[] = $bun; |
126 | 126 | } else { |
127 | 127 | $abBinary = self::xBase128((array) $abBinary, (integer) $partes[$num], true); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | { |
146 | 146 | $abc = $abIn; |
147 | 147 | if ($qIn > 127) { |
148 | - $abc = self::xBase128($abc, floor($qIn/128), false); |
|
148 | + $abc = self::xBase128($abc, floor($qIn / 128), false); |
|
149 | 149 | } |
150 | 150 | $qIn2 = $qIn % 128; |
151 | 151 | if ($flag) { |