@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | class Signer |
| 34 | 34 | { |
| 35 | - const CANONICAL = [true,false,null,null]; |
|
| 35 | + const CANONICAL = [true, false, null, null]; |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * Make Signature tag |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $nsSignatureMethod = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'; |
| 119 | 119 | $nsDigestMethod = 'http://www.w3.org/2001/04/xmlenc#sha256'; |
| 120 | 120 | } |
| 121 | - $nsTransformMethod1 ='http://www.w3.org/2000/09/xmldsig#enveloped-signature'; |
|
| 121 | + $nsTransformMethod1 = 'http://www.w3.org/2000/09/xmldsig#enveloped-signature'; |
|
| 122 | 122 | $nsTransformMethod2 = 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315'; |
| 123 | 123 | $idSigned = trim($node->getAttribute($mark)); |
| 124 | 124 | $digestValue = self::makeDigest($node, $digestAlgorithm, $canonical); |
@@ -248,7 +248,7 @@ |
||
| 248 | 248 | |
| 249 | 249 | /** |
| 250 | 250 | * Return uid from user |
| 251 | - * @return string |
|
| 251 | + * @return integer |
|
| 252 | 252 | */ |
| 253 | 253 | protected function uid() |
| 254 | 254 | { |
@@ -236,8 +236,8 @@ discard block |
||
| 236 | 236 | . $this->uid() |
| 237 | 237 | .'/' |
| 238 | 238 | . $this->certificate->getCnpj() |
| 239 | - . '/' ; |
|
| 240 | - $folderRealPath = sys_get_temp_dir().$path; |
|
| 239 | + . '/'; |
|
| 240 | + $folderRealPath = sys_get_temp_dir() . $path; |
|
| 241 | 241 | } |
| 242 | 242 | if (substr($folderRealPath, -1) !== '/') { |
| 243 | 243 | $folderRealPath .= '/'; |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | if (!$this->filesystem->has($name)) { |
| 527 | 527 | return $name; |
| 528 | 528 | } |
| 529 | - $this->randomName($n+5); |
|
| 529 | + $this->randomName($n + 5); |
|
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | /** |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | //remove todos os arquivos antigos |
| 546 | 546 | $contents = $this->filesystem->listContents($this->certsdir, true); |
| 547 | 547 | $dt = new \DateTime(); |
| 548 | - $tint = new \DateInterval("PT".$this->waitingTime."M"); |
|
| 548 | + $tint = new \DateInterval("PT" . $this->waitingTime . "M"); |
|
| 549 | 549 | $tint->invert = 1; |
| 550 | 550 | $tsLimit = $dt->add($tint)->getTimestamp(); |
| 551 | 551 | foreach ($contents as $item) { |
@@ -25,10 +25,10 @@ discard block |
||
| 25 | 25 | public static function replaceSpecialsChars($string) |
| 26 | 26 | { |
| 27 | 27 | $string = trim($string); |
| 28 | - $aFind = ['&','á','à','ã','â','é','ê','í','ó','ô','õ','ú','ü', |
|
| 29 | - 'ç','Á','À','Ã','Â','É','Ê','Í','Ó','Ô','Õ','Ú','Ü','Ç']; |
|
| 30 | - $aSubs = ['e','a','a','a','a','e','e','i','o','o','o','u','u', |
|
| 31 | - 'c','A','A','A','A','E','E','I','O','O','O','U','U','C']; |
|
| 28 | + $aFind = ['&', 'á', 'à', 'ã', 'â', 'é', 'ê', 'í', 'ó', 'ô', 'õ', 'ú', 'ü', |
|
| 29 | + 'ç', 'Á', 'À', 'Ã', 'Â', 'É', 'Ê', 'Í', 'Ó', 'Ô', 'Õ', 'Ú', 'Ü', 'Ç']; |
|
| 30 | + $aSubs = ['e', 'a', 'a', 'a', 'a', 'e', 'e', 'i', 'o', 'o', 'o', 'u', 'u', |
|
| 31 | + 'c', 'A', 'A', 'A', 'A', 'E', 'E', 'I', 'O', 'O', 'O', 'U', 'U', 'C']; |
|
| 32 | 32 | $newstr = str_replace($aFind, $aSubs, $string); |
| 33 | 33 | $newstr = preg_replace("/[^a-zA-Z0-9 @#,-_.;:$%\/]/", "", $newstr); |
| 34 | 34 | $newstr = preg_replace("/[<>]/", "", $newstr); |
@@ -53,23 +53,23 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | //& isolated, less than, greater than, quotation marks and apostrophes |
| 55 | 55 | //should be replaced by their html equivalent |
| 56 | - $input = str_replace(['& ','<','>','"',"'"], ['& ','<','>','"','''], $input); |
|
| 56 | + $input = str_replace(['& ', '<', '>', '"', "'"], ['& ', '<', '>', '"', '''], $input); |
|
| 57 | 57 | //Carriage Return, Tab and Line Feed is not acceptable in strings |
| 58 | - $input = str_replace(["\r","\t","\n"], "", $input); |
|
| 58 | + $input = str_replace(["\r", "\t", "\n"], "", $input); |
|
| 59 | 59 | //Multiple spaces is not acceptable in strings |
| 60 | 60 | $input = preg_replace('/(?:\s\s+)/', ' ', $input); |
| 61 | 61 | //Only UTF-8 characters is acceptable |
| 62 | 62 | $input = Encoding::fixUTF8($input); |
| 63 | 63 | $input = preg_replace( |
| 64 | - '/[\x00-\x08\x10\x0B\x0C\x0E-\x19\x7F]'. |
|
| 65 | - '|[\x00-\x7F][\x80-\xBF]+'. |
|
| 66 | - '|([\xC0\xC1]|[\xF0-\xFF])[\x80-\xBF]*'. |
|
| 67 | - '|[\xC2-\xDF]((?![\x80-\xBF])|[\x80-\xBF]{2,})'. |
|
| 64 | + '/[\x00-\x08\x10\x0B\x0C\x0E-\x19\x7F]' . |
|
| 65 | + '|[\x00-\x7F][\x80-\xBF]+' . |
|
| 66 | + '|([\xC0\xC1]|[\xF0-\xFF])[\x80-\xBF]*' . |
|
| 67 | + '|[\xC2-\xDF]((?![\x80-\xBF])|[\x80-\xBF]{2,})' . |
|
| 68 | 68 | '|[\xE0-\xEF](([\x80-\xBF](?![\x80-\xBF]))|(?![\x80-\xBF]{2})|[\x80-\xBF]{3,})/S', |
| 69 | 69 | '', |
| 70 | 70 | $input |
| 71 | 71 | ); |
| 72 | - $input = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]'. |
|
| 72 | + $input = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]' . |
|
| 73 | 73 | '|\xED[\xA0-\xBF][\x80-\xBF]/S', '', $input); |
| 74 | 74 | //And no other control character is acceptable either |
| 75 | 75 | $input = preg_replace('/[[:cntrl:]]/', '', $input); |
@@ -138,11 +138,11 @@ discard block |
||
| 138 | 138 | public static function clearProtocoledXML($string) |
| 139 | 139 | { |
| 140 | 140 | $procXML = self::clearXmlString($string); |
| 141 | - $aApp = array('nfe','cte','mdfe'); |
|
| 141 | + $aApp = array('nfe', 'cte', 'mdfe'); |
|
| 142 | 142 | foreach ($aApp as $app) { |
| 143 | 143 | $procXML = str_replace( |
| 144 | - 'xmlns="http://www.portalfiscal.inf.br/'.$app.'" xmlns="http://www.w3.org/2000/09/xmldsig#"', |
|
| 145 | - 'xmlns="http://www.portalfiscal.inf.br/'.$app.'"', |
|
| 144 | + 'xmlns="http://www.portalfiscal.inf.br/' . $app . '" xmlns="http://www.w3.org/2000/09/xmldsig#"', |
|
| 145 | + 'xmlns="http://www.portalfiscal.inf.br/' . $app . '"', |
|
| 146 | 146 | $procXML |
| 147 | 147 | ); |
| 148 | 148 | } |
@@ -157,11 +157,11 @@ discard block |
||
| 157 | 157 | public static function removeSomeAlienCharsfromTxt($txt) |
| 158 | 158 | { |
| 159 | 159 | //remove CRs and TABs |
| 160 | - $txt = str_replace(["\r","\t"], "", $txt); |
|
| 160 | + $txt = str_replace(["\r", "\t"], "", $txt); |
|
| 161 | 161 | //remove multiple spaces |
| 162 | 162 | $txt = preg_replace('/(?:\s\s+)/', ' ', $txt); |
| 163 | 163 | //remove spaces at begin and end of fields |
| 164 | - $txt = str_replace(["| "," |"], "|", $txt); |
|
| 164 | + $txt = str_replace(["| ", " |"], "|", $txt); |
|
| 165 | 165 | return $txt; |
| 166 | 166 | } |
| 167 | 167 | |