@@ -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 | } |
@@ -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) { |
@@ -39,7 +39,7 @@ |
||
39 | 39 | * @param Certificate $certificate |
40 | 40 | * @param string $content |
41 | 41 | * @param string $tagname |
42 | - * @param string $marker for URI |
|
42 | + * @param string $mark for URI |
|
43 | 43 | * @param string $algorithm |
44 | 44 | * @param array $canonical parameters to format node for signature |
45 | 45 | * @param string $rootname name of tag to insert signature block |
@@ -25,10 +25,8 @@ |
||
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 | -use DOMElement; |
|
32 | 30 | |
33 | 31 | class Signer |
34 | 32 | { |
@@ -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 |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $tagname = '', |
53 | 53 | $mark = 'Id', |
54 | 54 | $algorithm = OPENSSL_ALGO_SHA1, |
55 | - $canonical = [false,false,null,null], |
|
55 | + $canonical = [false, false, null, null], |
|
56 | 56 | $rootname = '' |
57 | 57 | ) { |
58 | 58 | if (!empty($canonical)) { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | if (empty($node) || empty($root)) { |
71 | 71 | throw SignerException::tagNotFound($tagname); |
72 | 72 | } |
73 | - if (! self::existsSignature($dom)) { |
|
73 | + if (!self::existsSignature($dom)) { |
|
74 | 74 | $dom = self::createSignature( |
75 | 75 | $certificate, |
76 | 76 | $dom, |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | DOMNode $node, |
137 | 137 | $mark, |
138 | 138 | $algorithm = OPENSSL_ALGO_SHA1, |
139 | - $canonical = [false,false,null,null] |
|
139 | + $canonical = [false, false, null, null] |
|
140 | 140 | ) { |
141 | 141 | $nsDSIG = 'http://www.w3.org/2000/09/xmldsig#'; |
142 | 142 | $nsCannonMethod = 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315'; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $nsSignatureMethod = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'; |
149 | 149 | $nsDigestMethod = 'http://www.w3.org/2001/04/xmlenc#sha256'; |
150 | 150 | } |
151 | - $nsTransformMethod1 ='http://www.w3.org/2000/09/xmldsig#enveloped-signature'; |
|
151 | + $nsTransformMethod1 = 'http://www.w3.org/2000/09/xmldsig#enveloped-signature'; |
|
152 | 152 | $nsTransformMethod2 = 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315'; |
153 | 153 | $idSigned = trim($node->getAttribute($mark)); |
154 | 154 | $digestValue = self::makeDigest($node, $digestAlgorithm, $canonical); |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | { |
250 | 250 | $node = $dom->getElementsByTagName($tagname)->item(0); |
251 | 251 | if (empty($node)) { |
252 | - throw new \RuntimeException('Tag not found ' .$tagname); |
|
252 | + throw new \RuntimeException('Tag not found ' . $tagname); |
|
253 | 253 | } |
254 | 254 | $signature = $dom->getElementsByTagName('Signature')->item(0); |
255 | 255 | if (empty($signature)) { |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | * @param array $canonical |
287 | 287 | * @return string |
288 | 288 | */ |
289 | - private static function makeDigest(DOMNode $node, $algorithm, $canonical = [false,false,null,null]) |
|
289 | + private static function makeDigest(DOMNode $node, $algorithm, $canonical = [false, false, null, null]) |
|
290 | 290 | { |
291 | 291 | //calcular o hash dos dados |
292 | 292 | $c14n = $node->C14N( |