@@ -53,7 +53,7 @@ |
||
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) |
@@ -40,7 +40,7 @@ |
||
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) |
@@ -63,7 +63,7 @@ discard block |
||
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 |
||
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) |
@@ -93,8 +93,7 @@ |
||
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']); |
@@ -55,7 +55,7 @@ |
||
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 | { |
@@ -125,9 +125,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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++; |
@@ -32,7 +32,6 @@ |
||
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) |
@@ -71,7 +71,7 @@ |
||
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); |
@@ -17,7 +17,6 @@ |
||
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; |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | /** |
276 | 276 | * Set security protocol |
277 | 277 | * @param int $protocol |
278 | - * @return type Description |
|
278 | + * @return integer Description |
|
279 | 279 | */ |
280 | 280 | public function protocol($protocol = self::SSL_DEFAULT) |
281 | 281 | { |
@@ -327,6 +327,7 @@ discard block |
||
327 | 327 | * @param string $operation |
328 | 328 | * @param array $namespaces |
329 | 329 | * @param \SOAPHeader $header |
330 | + * @param integer $soapver |
|
330 | 331 | * @return string |
331 | 332 | */ |
332 | 333 | protected function makeEnvelopeSoap( |
@@ -374,9 +374,9 @@ discard block |
||
374 | 374 | ); |
375 | 375 | } |
376 | 376 | $this->certsdir = $this->certificate->getCnpj() . '/certs/'; |
377 | - $this->prifile = $this->certsdir. Strings::randomString(10).'.pem'; |
|
378 | - $this->pubfile = $this->certsdir . Strings::randomString(10).'.pem'; |
|
379 | - $this->certfile = $this->certsdir . Strings::randomString(10).'.pem'; |
|
377 | + $this->prifile = $this->certsdir . Strings::randomString(10) . '.pem'; |
|
378 | + $this->pubfile = $this->certsdir . Strings::randomString(10) . '.pem'; |
|
379 | + $this->certfile = $this->certsdir . Strings::randomString(10) . '.pem'; |
|
380 | 380 | $ret = true; |
381 | 381 | //cria uma senha temporária ALEATÓRIA para salvar a chave primaria |
382 | 382 | //portanto mesmo que localizada e identificada não estará acessível |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | //utilize a API. Outra solução para remover arquivos "perdidos" pode ser |
424 | 424 | //encontrada oportunamente. |
425 | 425 | $dt = new \DateTime(); |
426 | - $tint = new \DateInterval("PT".$this->waitingTime."M"); |
|
426 | + $tint = new \DateInterval("PT" . $this->waitingTime . "M"); |
|
427 | 427 | $tint->invert = true; |
428 | 428 | $tsLimit = $dt->add($tint)->getTimestamp(); |
429 | 429 | foreach ($contents as $item) { |
@@ -39,10 +39,10 @@ |
||
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 | } |
@@ -78,7 +78,7 @@ discard block |
||
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 |
||
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 |
||
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) { |
@@ -39,7 +39,7 @@ discard block |
||
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,8 +88,6 @@ discard block |
||
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 | 92 | * @return integer |
95 | 93 | */ |
@@ -142,7 +140,7 @@ discard block |
||
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 | { |
@@ -51,7 +51,7 @@ |
||
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 | } |