Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like Tools often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Tools, and based on these observations, apply Extract Interface, too.
| 1 | <?php  | 
            ||
| 32 | class Tools extends BaseTools  | 
            ||
| 33 | { | 
            ||
| 34 | /**  | 
            ||
| 35 | * errrors  | 
            ||
| 36 | *  | 
            ||
| 37 | * @var string  | 
            ||
| 38 | */  | 
            ||
| 39 | public $errors = array();  | 
            ||
| 40 | /**  | 
            ||
| 41 | * soapDebug  | 
            ||
| 42 | *  | 
            ||
| 43 | * @var string  | 
            ||
| 44 | */  | 
            ||
| 45 | public $soapDebug = '';  | 
            ||
| 46 | /**  | 
            ||
| 47 | * urlPortal  | 
            ||
| 48 | * Instância do WebService  | 
            ||
| 49 | *  | 
            ||
| 50 | * @var string  | 
            ||
| 51 | */  | 
            ||
| 52 | protected $urlPortal = 'http://www.portalfiscal.inf.br/mdfe';  | 
            ||
| 53 | /**  | 
            ||
| 54 | * aLastRetEvent  | 
            ||
| 55 | *  | 
            ||
| 56 | * @var array  | 
            ||
| 57 | */  | 
            ||
| 58 | private $aLastRetEvent = array();  | 
            ||
| 59 | /**  | 
            ||
| 60 | * imprime  | 
            ||
| 61 | * Imprime o documento eletrônico (MDFe, CCe, Inut.)  | 
            ||
| 62 | *  | 
            ||
| 63 | * @param string $pathXml  | 
            ||
| 64 | * @param string $pathDestino  | 
            ||
| 65 | * @param string $printer  | 
            ||
| 66 | * @return string  | 
            ||
| 67 | */  | 
            ||
| 68 | public function imprime($pathXml = '', $pathDestino = '', $printer = '')  | 
            ||
| 74 | /**  | 
            ||
| 75 | * enviaMail  | 
            ||
| 76 | * Envia a MDFe por email aos destinatários  | 
            ||
| 77 | * Caso $aMails esteja vazio serão obtidos os email do destinatário e  | 
            ||
| 78 | * os emails que estiverem registrados nos campos obsCont do xml  | 
            ||
| 79 | *  | 
            ||
| 80 | * @param string $pathXml  | 
            ||
| 81 | * @param array $aMails  | 
            ||
| 82 | * @param string $templateFile path completo ao arquivo template html do corpo do email  | 
            ||
| 83 | * @param boolean $comPdf se true o sistema irá renderizar o DANFE e anexa-lo a mensagem  | 
            ||
| 84 | * @return boolean  | 
            ||
| 85 | */  | 
            ||
| 86 | public function enviaMail($pathXml = '', $aMails = array(), $templateFile = '', $comPdf = false)  | 
            ||
| 94 | |||
| 95 | /**  | 
            ||
| 96 | * addProtocolo  | 
            ||
| 97 | * Adiciona o protocolo de autorização de uso da MDFe  | 
            ||
| 98 | * NOTA: exigência da SEFAZ, a MDFe somente é válida com o seu respectivo protocolo  | 
            ||
| 99 | *  | 
            ||
| 100 | * @param string $pathMDFefile  | 
            ||
| 101 | * @param string $pathProtfile  | 
            ||
| 102 | * @param boolean $saveFile  | 
            ||
| 103 | * @return string  | 
            ||
| 104 | * @throws Exception\RuntimeException  | 
            ||
| 105 | */  | 
            ||
| 106 | public function addProtocolo($pathMDFefile = '', $pathProtfile = '', $saveFile = false)  | 
            ||
| 107 |     { | 
            ||
| 108 | //carrega a MDFe  | 
            ||
| 109 | $docmdfe = new Dom();  | 
            ||
| 110 | $docmdfe->loadXMLFile($pathMDFefile);  | 
            ||
| 111 |         $nodemdfe = $docmdfe->getNode('MDFe', 0); | 
            ||
| 112 |         if ($nodemdfe == '') { | 
            ||
| 113 | $msg = "O arquivo indicado como MDFe não é um xml de MDFe!";  | 
            ||
| 114 | throw new Exception\RuntimeException($msg);  | 
            ||
| 115 | }  | 
            ||
| 116 |         if ($docmdfe->getNode('Signature') == '') { | 
            ||
| 117 | $msg = "O MDFe não está assinado!";  | 
            ||
| 118 | throw new Exception\RuntimeException($msg);  | 
            ||
| 119 | }  | 
            ||
| 120 | //carrega o protocolo  | 
            ||
| 121 | $docprot = new Dom();  | 
            ||
| 122 | $docprot->loadXMLFile($pathProtfile);  | 
            ||
| 123 |         $nodeprots = $docprot->getElementsByTagName('protMDFe'); | 
            ||
| 124 |         if ($nodeprots->length == 0) { | 
            ||
| 125 | $msg = "O arquivo indicado não contêm um protocolo de autorização!";  | 
            ||
| 126 | throw new Exception\RuntimeException($msg);  | 
            ||
| 127 | }  | 
            ||
| 128 | //carrega dados da MDFe  | 
            ||
| 129 |         $tpAmb = $docmdfe->getNodeValue('tpAmb'); | 
            ||
| 130 | $anomes = date(  | 
            ||
| 131 | 'Ym',  | 
            ||
| 132 |             DateTime::convertSefazTimeToTimestamp($docmdfe->getNodeValue('dhEmi')) | 
            ||
| 133 | );  | 
            ||
| 134 |         $infMDFe = $docmdfe->getNode("infMDFe", 0); | 
            ||
| 135 |         $versao = $infMDFe->getAttribute("versao"); | 
            ||
| 136 |         $chaveId = $infMDFe->getAttribute("Id"); | 
            ||
| 137 |         $chaveMDFe = preg_replace('/[^0-9]/', '', $chaveId); | 
            ||
| 138 |         $digValueMDFe = $docmdfe->getNodeValue('DigestValue'); | 
            ||
| 139 | //carrega os dados do protocolo  | 
            ||
| 140 |         for ($i = 0; $i < $nodeprots->length; $i++) { | 
            ||
| 141 | $nodeprot = $nodeprots->item($i);  | 
            ||
| 142 |             $protver = $nodeprot->getAttribute("versao"); | 
            ||
| 143 |             $chaveProt = $nodeprot->getElementsByTagName("chMDFe")->item(0)->nodeValue; | 
            ||
| 144 |             $digValueProt = $nodeprot->getElementsByTagName("digVal")->item(0)->nodeValue; | 
            ||
| 145 |             $infProt = $nodeprot->getElementsByTagName("infProt")->item(0); | 
            ||
| 146 |             if ($digValueMDFe == $digValueProt && $chaveMDFe == $chaveProt) { | 
            ||
| 147 | break;  | 
            ||
| 148 | }  | 
            ||
| 149 | }  | 
            ||
| 150 |         if ($digValueMDFe != $digValueProt) { | 
            ||
| 151 | $msg = "Inconsistência! O DigestValue do MDFe não combina com o"  | 
            ||
| 152 | . " do digVal do protocolo indicado!";  | 
            ||
| 153 | throw new Exception\RuntimeException($msg);  | 
            ||
| 154 | }  | 
            ||
| 155 |         if ($chaveMDFe != $chaveProt) { | 
            ||
| 156 | $msg = "O protocolo indicado pertence a outro MDFe. Os números das chaves não combinam !";  | 
            ||
| 157 | throw new Exception\RuntimeException($msg);  | 
            ||
| 158 | }  | 
            ||
| 159 | //cria a MDFe processada com a tag do protocolo  | 
            ||
| 160 |         $procmdfe = new \DOMDocument('1.0', 'utf-8'); | 
            ||
| 161 | $procmdfe->formatOutput = false;  | 
            ||
| 162 | $procmdfe->preserveWhiteSpace = false;  | 
            ||
| 163 | //cria a tag mdfeProc  | 
            ||
| 164 |         $mdfeProc = $procmdfe->createElement('mdfeProc'); | 
            ||
| 165 | $procmdef->appendChild($mdfeProc);  | 
            ||
| 166 | //estabele o atributo de versão  | 
            ||
| 167 |         $mdfeProcAtt1 = $mdfeProc->appendChild($procmdfe->createAttribute('versao')); | 
            ||
| 168 | $mdfeProcAtt1->appendChild($procmdfe->createTextNode($protver));  | 
            ||
| 169 | //estabelece o atributo xmlns  | 
            ||
| 170 |         $mdfeProcAtt2 = $mdfeProc->appendChild($procmdfe->createAttribute('xmlns')); | 
            ||
| 171 | $mdfeProcAtt2->appendChild($procmdfe->createTextNode($this->urlPortal));  | 
            ||
| 172 | //inclui a tag MDFe  | 
            ||
| 173 | $node = $procmdef->importNode($nodemdfe, true);  | 
            ||
| 174 | $mdfeProc->appendChild($node);  | 
            ||
| 175 | //cria tag protMDFe  | 
            ||
| 176 |         $protMDFe = $procmdfe->createElement('protMDFe'); | 
            ||
| 177 | $mdfeProc->appendChild($protMDFe);  | 
            ||
| 178 | //estabele o atributo de versão  | 
            ||
| 179 |         $protMDFeAtt1 = $protMDFe->appendChild($procmdfe->createAttribute('versao')); | 
            ||
| 180 | $protMDFeAtt1->appendChild($procmdef->createTextNode($versao));  | 
            ||
| 181 | //cria tag infProt  | 
            ||
| 182 | $nodep = $procmdfe->importNode($infProt, true);  | 
            ||
| 183 | $protMDFe->appendChild($nodep);  | 
            ||
| 184 | //salva o xml como string em uma variável  | 
            ||
| 185 | $procXML = $procmdfe->saveXML();  | 
            ||
| 186 | //remove as informações indesejadas  | 
            ||
| 187 | $procXML = Strings::clearProt($procXML);  | 
            ||
| 188 | View Code Duplication |         if ($saveFile) { | 
            |
| 189 | $filename = "$chaveMDFe-protMDFe.xml";  | 
            ||
| 190 | $this->zGravaFile(  | 
            ||
| 191 | 'mdfe',  | 
            ||
| 192 | $tpAmb,  | 
            ||
| 193 | $filename,  | 
            ||
| 194 | $procXML,  | 
            ||
| 195 | 'enviadas'.DIRECTORY_SEPARATOR.'aprovadas',  | 
            ||
| 196 | $anomes  | 
            ||
| 197 | );  | 
            ||
| 198 | }  | 
            ||
| 199 | return $procXML;  | 
            ||
| 200 | }  | 
            ||
| 201 | |||
| 202 | /**  | 
            ||
| 203 | * addCancelamento  | 
            ||
| 204 | * Adiciona a tga de cancelamento a uma MDFe já autorizada  | 
            ||
| 205 | * NOTA: não é requisito da SEFAZ, mas auxilia na identificação das MDFe que foram canceladas  | 
            ||
| 206 | *  | 
            ||
| 207 | * @param string $pathMDFefile  | 
            ||
| 208 | * @param string $pathCancfile  | 
            ||
| 209 | * @param bool $saveFile  | 
            ||
| 210 | * @return string  | 
            ||
| 211 | * @throws Exception\RuntimeException  | 
            ||
| 212 | */  | 
            ||
| 213 | public function addCancelamento($pathMDFefile = '', $pathCancfile = '', $saveFile = false)  | 
            ||
| 214 |     { | 
            ||
| 215 | $procXML = '';  | 
            ||
| 216 | //carrega a MDFe  | 
            ||
| 217 | $docmdfe = new Dom();  | 
            ||
| 218 | $docmdfe->loadXMLFile($pathMDFefile);  | 
            ||
| 219 |         $nodemdfe = $docmdfe->getNode('MDFe', 0); | 
            ||
| 220 |         if ($nodemdfe == '') { | 
            ||
| 221 | $msg = "O arquivo indicado como MDFe não é um xml de MDFe!";  | 
            ||
| 222 | throw new Exception\RuntimeException($msg);  | 
            ||
| 223 | }  | 
            ||
| 224 |         $proMDFe = $docmdfe->getNode('protMDFe'); | 
            ||
| 225 |         if ($proMDFe == '') { | 
            ||
| 226 | $msg = "O MDFe não está protocolado ainda!!";  | 
            ||
| 227 | throw new Exception\RuntimeException($msg);  | 
            ||
| 228 | }  | 
            ||
| 229 |         $chaveMDFe = $proMDFe->getElementsByTagName('chMDFe')->item(0)->nodeValue; | 
            ||
| 230 |         //$nProtMDFe = $proMDFe->getElementsByTagName('nProt')->item(0)->nodeValue; | 
            ||
| 231 |         $tpAmb = $docmdfe->getNodeValue('tpAmb'); | 
            ||
| 232 | $anomes = date(  | 
            ||
| 233 | 'Ym',  | 
            ||
| 234 |             DateTime::convertSefazTimeToTimestamp($docmdfe->getNodeValue('dhEmi')) | 
            ||
| 235 | );  | 
            ||
| 236 | //carrega o cancelamento  | 
            ||
| 237 | //pode ser um evento ou resultado de uma consulta com multiplos eventos  | 
            ||
| 238 | $doccanc = new Dom();  | 
            ||
| 239 | $doccanc->loadXMLFile($pathCancfile);  | 
            ||
| 240 |         $eventos = $doccanc->getElementsByTagName('infEvento'); | 
            ||
| 241 |         foreach ($eventos as $evento) { | 
            ||
| 242 | //evento  | 
            ||
| 243 |             $cStat = $evento->getElementsByTagName('cStat')->item(0)->nodeValue; | 
            ||
| 244 |             $tpAmb = $evento->getElementsByTagName('tpAmb')->item(0)->nodeValue; | 
            ||
| 245 |             $chaveEvento = $evento->getElementsByTagName('chNFe')->item(0)->nodeValue; | 
            ||
| 246 |             $tpEvento = $evento->getElementsByTagName('tpEvento')->item(0)->nodeValue; | 
            ||
| 247 |             //$nProtEvento = $evento->getElementsByTagName('nProt')->item(0)->nodeValue; | 
            ||
| 248 | //verifica se conferem os dados  | 
            ||
| 249 | //cStat = 135 ==> evento homologado  | 
            ||
| 250 | //tpEvento = 110111 ==> Cancelamento  | 
            ||
| 251 | //chave do evento == chave da NFe  | 
            ||
| 252 | //protocolo do evento == protocolo da NFe  | 
            ||
| 253 | if ($cStat == '135'  | 
            ||
| 254 | && $tpEvento == '110111'  | 
            ||
| 255 | && $chaveEvento == $chaveMDFe  | 
            ||
| 256 |             ) { | 
            ||
| 257 |                 $proMDFe->getElementsByTagName('cStat')->item(0)->nodeValue = '101'; | 
            ||
| 258 |                 $proMDFe->getElementsByTagName('xMotivo')->item(0)->nodeValue = 'Cancelamento de NF-e homologado'; | 
            ||
| 259 | $procXML = $docmdfe->saveXML();  | 
            ||
| 260 | //remove as informações indesejadas  | 
            ||
| 261 | $procXML = Strings::clearProt($procXML);  | 
            ||
| 262 | View Code Duplication |                 if ($saveFile) { | 
            |
| 263 | $filename = "$chaveMDFe-protMDFe.xml";  | 
            ||
| 264 | $this->zGravaFile(  | 
            ||
| 265 | 'mdfe',  | 
            ||
| 266 | $tpAmb,  | 
            ||
| 267 | $filename,  | 
            ||
| 268 | $procXML,  | 
            ||
| 269 | 'enviadas'.DIRECTORY_SEPARATOR.'aprovadas',  | 
            ||
| 270 | $anomes  | 
            ||
| 271 | );  | 
            ||
| 272 | }  | 
            ||
| 273 | break;  | 
            ||
| 274 | }  | 
            ||
| 275 | }  | 
            ||
| 276 | return (string) $procXML;  | 
            ||
| 277 | }  | 
            ||
| 278 | |||
| 279 | |||
| 280 | /**  | 
            ||
| 281 | * verificaValidade  | 
            ||
| 282 | *  | 
            ||
| 283 | * @param string $pathXmlFile  | 
            ||
| 284 | * @param array $aRetorno  | 
            ||
| 285 | * @return boolean  | 
            ||
| 286 | * @throws Exception\InvalidArgumentException  | 
            ||
| 287 | */  | 
            ||
| 288 | public function verificaValidade($pathXmlFile = '', &$aRetorno = array())  | 
            ||
| 289 |     { | 
            ||
| 290 | $aRetorno = array();  | 
            ||
| 291 |         if (!file_exists($pathXmlFile)) { | 
            ||
| 292 | $msg = "Arquivo não localizado!!";  | 
            ||
| 293 | throw new Exception\InvalidArgumentException($msg);  | 
            ||
| 294 | }  | 
            ||
| 295 | //carrega a MDFe  | 
            ||
| 296 | $xml = Files\FilesFolders::readFile($pathXmlFile);  | 
            ||
| 297 | $this->oCertificate->verifySignature($xml, 'infMDFe');  | 
            ||
| 298 | //obtem o chave da MDFe  | 
            ||
| 299 | $docmdfe = new Dom();  | 
            ||
| 300 | $docmdfe->loadXMLFile($pathXmlFile);  | 
            ||
| 301 |         $tpAmb = $docmdfe->getNodeValue('tpAmb'); | 
            ||
| 302 |         $chMDFe  = $docmdfe->getChave('infMDFe'); | 
            ||
| 303 | $this->sefazConsultaChave($chMDFe, $tpAmb, $aRetorno);  | 
            ||
| 304 |         if ($aRetorno['cStat'] != '100') { | 
            ||
| 305 | return false;  | 
            ||
| 306 | }  | 
            ||
| 307 | return true;  | 
            ||
| 308 | }  | 
            ||
| 309 | |||
| 310 | /**  | 
            ||
| 311 | * assina  | 
            ||
| 312 | *  | 
            ||
| 313 | * @param string $xml  | 
            ||
| 314 | * @param boolean $saveFile  | 
            ||
| 315 | * @return string  | 
            ||
| 316 | * @throws Exception\RuntimeException  | 
            ||
| 317 | */  | 
            ||
| 318 | public function assina($xml = '', $saveFile = false)  | 
            ||
| 322 | |||
| 323 | /**  | 
            ||
| 324 | * sefazEnviaLote  | 
            ||
| 325 | *  | 
            ||
| 326 | * @param string $xml  | 
            ||
| 327 | * @param string $tpAmb  | 
            ||
| 328 | * @param string $idLote  | 
            ||
| 329 | * @param array $aRetorno  | 
            ||
| 330 | * @return string  | 
            ||
| 331 | * @throws Exception\InvalidArgumentException  | 
            ||
| 332 | * @throws Exception\RuntimeException  | 
            ||
| 333 | * @internal function zLoadServico (Common\Base\BaseTools)  | 
            ||
| 334 | */  | 
            ||
| 335 | public function sefazEnviaLote(  | 
            ||
| 389 | |||
| 390 | /**  | 
            ||
| 391 | * sefazConsultaRecibo  | 
            ||
| 392 | *  | 
            ||
| 393 | * @param string $recibo  | 
            ||
| 394 | * @param string $tpAmb  | 
            ||
| 395 | * @param array $aRetorno  | 
            ||
| 396 | * @return string  | 
            ||
| 397 | * @throws Exception\InvalidArgumentException  | 
            ||
| 398 | * @throws Exception\RuntimeException  | 
            ||
| 399 | * @internal function zLoadServico (Common\Base\BaseTools)  | 
            ||
| 400 | */  | 
            ||
| 401 | public function sefazConsultaRecibo($recibo = '', $tpAmb = '2', &$aRetorno = array())  | 
            ||
| 453 | |||
| 454 | /**  | 
            ||
| 455 | * sefazConsultaChave  | 
            ||
| 456 | * Consulta o status da MDFe pela chave de 44 digitos  | 
            ||
| 457 | *  | 
            ||
| 458 | * @param string $chave  | 
            ||
| 459 | * @param string $tpAmb  | 
            ||
| 460 | * @param array $aRetorno  | 
            ||
| 461 | * @return string  | 
            ||
| 462 | * @throws Exception\InvalidArgumentException  | 
            ||
| 463 | * @throws Exception\RuntimeException  | 
            ||
| 464 | * @internal function zLoadServico (Common\Base\BaseTools)  | 
            ||
| 465 | */  | 
            ||
| 466 | public function sefazConsultaChave($chave = '', $tpAmb = '2', &$aRetorno = array())  | 
            ||
| 521 | |||
| 522 | /**  | 
            ||
| 523 | * sefazStatus  | 
            ||
| 524 | * Verifica o status do serviço da SEFAZ  | 
            ||
| 525 | * NOTA : Este serviço será removido no futuro, segundo da Receita/SEFAZ devido  | 
            ||
| 526 | * ao excesso de mau uso !!!  | 
            ||
| 527 | *  | 
            ||
| 528 | * @param string $siglaUF sigla da unidade da Federação  | 
            ||
| 529 | * @param string $tpAmb tipo de ambiente 1-produção e 2-homologação  | 
            ||
| 530 | * @param array $aRetorno parametro passado por referencia contendo a resposta da consulta em um array  | 
            ||
| 531 | * @return mixed string XML do retorno do webservice, ou false se ocorreu algum erro  | 
            ||
| 532 | * @throws Exception\RuntimeException  | 
            ||
| 533 | * @internal function zLoadServico (Common\Base\BaseTools)  | 
            ||
| 534 | */  | 
            ||
| 535 | View Code Duplication | public function sefazStatus($siglaUF = '', $tpAmb = '2', &$aRetorno = array())  | 
            |
| 584 | |||
| 585 | /**  | 
            ||
| 586 | * sefazCancela  | 
            ||
| 587 | *  | 
            ||
| 588 | * @param string $chave  | 
            ||
| 589 | * @param string $tpAmb  | 
            ||
| 590 | * @param string $xJust  | 
            ||
| 591 | * @param string $nProt  | 
            ||
| 592 | * @param array $aRetorno  | 
            ||
| 593 | * @return string  | 
            ||
| 594 | * @throws Exception\InvalidArgumentException  | 
            ||
| 595 | */  | 
            ||
| 596 | public function sefazCancela(  | 
            ||
| 634 | |||
| 635 | /**  | 
            ||
| 636 | * sefazEncerra  | 
            ||
| 637 | *  | 
            ||
| 638 | * @param string $chave  | 
            ||
| 639 | * @param string $tpAmb  | 
            ||
| 640 | * @param string $nProt  | 
            ||
| 641 | * @param string $cUF  | 
            ||
| 642 | * @param string $cMun  | 
            ||
| 643 | * @param array $aRetorno  | 
            ||
| 644 | * @return string  | 
            ||
| 645 | * @throws Exception\InvalidArgumentException  | 
            ||
| 646 | */  | 
            ||
| 647 | public function sefazEncerra(  | 
            ||
| 683 | |||
| 684 | /**  | 
            ||
| 685 | * sefazIncluiCondutor  | 
            ||
| 686 | *  | 
            ||
| 687 | * @param string $chave  | 
            ||
| 688 | * @param string $tpAmb  | 
            ||
| 689 | * @param string $nSeqEvento  | 
            ||
| 690 | * @param string $xNome  | 
            ||
| 691 | * @param string $cpf  | 
            ||
| 692 | * @param array $aRetorno  | 
            ||
| 693 | * @return string  | 
            ||
| 694 | * @throws Exception\InvalidArgumentException  | 
            ||
| 695 | */  | 
            ||
| 696 | public function sefazIncluiCondutor(  | 
            ||
| 730 | |||
| 731 | /**  | 
            ||
| 732 | * sefazConsultaNaoEncerrados  | 
            ||
| 733 | *  | 
            ||
| 734 | * @param string $tpAmb  | 
            ||
| 735 | * @param string $cnpj  | 
            ||
| 736 | * @param array $aRetorno  | 
            ||
| 737 | * @return string  | 
            ||
| 738 | * @throws Exception\RuntimeException  | 
            ||
| 739 | */  | 
            ||
| 740 | View Code Duplication | public function sefazConsultaNaoEncerrados($tpAmb = '2', $cnpj = '', &$aRetorno = array())  | 
            |
| 790 | |||
| 791 | /**  | 
            ||
| 792 | * zSefazEvento  | 
            ||
| 793 | *  | 
            ||
| 794 | * @param string $siglaUF  | 
            ||
| 795 | * @param string $chave  | 
            ||
| 796 | * @param string $tpAmb  | 
            ||
| 797 | * @param string $tpEvento  | 
            ||
| 798 | * @param string $nSeqEvento  | 
            ||
| 799 | * @param string $tagAdic  | 
            ||
| 800 | * @return string  | 
            ||
| 801 | * @throws Exception\RuntimeException  | 
            ||
| 802 | * @internal function zLoadServico (Common\Base\BaseTools)  | 
            ||
| 803 | */  | 
            ||
| 804 | protected function zSefazEvento(  | 
            ||
| 882 | |||
| 883 | /**  | 
            ||
| 884 | * zTpEv  | 
            ||
| 885 | *  | 
            ||
| 886 | * @param string $tpEvento  | 
            ||
| 887 | * @return array  | 
            ||
| 888 | * @throws Exception\RuntimeException  | 
            ||
| 889 | */  | 
            ||
| 890 | private function zTpEv($tpEvento = '')  | 
            ||
| 916 | |||
| 917 | /**  | 
            ||
| 918 | * validarXml  | 
            ||
| 919 | * Valida qualquer xml do sistema MDFe com seu xsd  | 
            ||
| 920 | * NOTA: caso não exista um arquivo xsd apropriado retorna false  | 
            ||
| 921 | *  | 
            ||
| 922 | * @param string $xml path ou conteudo do xml  | 
            ||
| 923 | * @return boolean  | 
            ||
| 924 | */  | 
            ||
| 925 | public function validarXml($xml = '')  | 
            ||
| 949 | }  | 
            ||
| 950 | 
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignorePhpDoc annotation to the duplicate definition and it will be ignored.