Created
September 18, 2018 19:27
-
-
Save devLopez/ab778b0c21acd6f018ae74bb84dcb9a7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use SimpleXMLElement; | |
/** | |
* CaixaResponseReader | |
* | |
* Realiza o parsing do xml retornado pelo webservice da caixa | |
* | |
* @author Matheus Lopes Santos <[email protected]> | |
* @version 1.0.0 | |
* @since 18/09/2018 | |
*/ | |
class CaixaResponseReader | |
{ | |
/** | |
* Realiza o parsing do XML recebido do WebService da caixa | |
* | |
* Remove todos os namespaces conhecidos, deixando o xml flat, fazendo com que | |
* a string seja lida de forma correta | |
* | |
* @param string $xml O XML a ser lido | |
* @return SimpleXMLElement | |
*/ | |
public static function parseFromRetorno($xml) | |
{ | |
clean_xml = str_ireplace([ | |
'SOAP-ENV:', | |
'SOAP:', | |
'soapenv:', | |
'sibar_base:', | |
'manutencaocobrancabancaria:' | |
], '', $xml); | |
return new SimpleXMLElement($clean_xml); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment