From dbd85a9a6f6ac820e9c61df8d6de0ebcfc6bd60c Mon Sep 17 00:00:00 2001 From: JP Rodrigues <70jprodrigues@gmail.com> Date: Thu, 21 Jan 2021 10:54:32 -0300 Subject: [PATCH] Fix folders name and code pattern --- src/MySoapClient.php | 13 ++++++---- src/NfseSsa.php | 3 +-- src/NfseSsaServiceProvider.php | 7 +++--- src/{request => Request}/Error.php | 2 +- src/{request => Request}/Response.php | 3 +-- src/Response.php | 2 +- src/{services => Services}/RequestService.php | 24 +++++++++++-------- .../SignatureService.php | 8 +++---- src/helpers.php | 2 +- 9 files changed, 34 insertions(+), 30 deletions(-) rename src/{request => Request}/Error.php (99%) rename src/{request => Request}/Response.php (99%) rename src/{services => Services}/RequestService.php (94%) rename src/{services => Services}/SignatureService.php (95%) diff --git a/src/MySoapClient.php b/src/MySoapClient.php index 1700603..375f28a 100644 --- a/src/MySoapClient.php +++ b/src/MySoapClient.php @@ -8,10 +8,13 @@ * Remove algumas tags para adequar a comunicação * ao padrão Windows utilizado */ -class MySoapClient extends \SoapClient { +class MySoapClient extends \SoapClient +{ public $soapRequest; - public function __doRequest($request, $location, $action, $version, $one_way = 0) { + + public function __doRequest($request, $location, $action, $version, $one_way = 0) + { $request = str_replace('xmlns:ns2=""', '', $request); $request = str_replace(':ns1', '', $request); @@ -27,7 +30,8 @@ public function __doRequest($request, $location, $action, $version, $one_way = 0 return (parent::__doRequest($request, $location, $action, $version)); } - function sanitizeOutput($buffer) { + function sanitizeOutput($buffer) + { $search = array( '/\>[^\S ]+/s', // strip whitespaces after tags, except space @@ -47,5 +51,4 @@ function sanitizeOutput($buffer) { return $buffer; } - -} //fim da classe NFSeSOAPClient +} diff --git a/src/NfseSsa.php b/src/NfseSsa.php index 2ab642d..7150167 100644 --- a/src/NfseSsa.php +++ b/src/NfseSsa.php @@ -97,5 +97,4 @@ public function consultarNfse($dados) return $result; } - -} \ No newline at end of file +} diff --git a/src/NfseSsaServiceProvider.php b/src/NfseSsaServiceProvider.php index 8e94a84..f84463d 100644 --- a/src/NfseSsaServiceProvider.php +++ b/src/NfseSsaServiceProvider.php @@ -13,9 +13,9 @@ class NfseSsaServiceProvider extends ServiceProvider */ public function boot() { - $this->publishes([ __DIR__ . '/config/nfse-ssa.php' => config_path('nfse-ssa.php')]); + $this->publishes([__DIR__ . '/config/nfse-ssa.php' => config_path('nfse-ssa.php')]); - $this->loadViewsFrom(__DIR__.'/templates', 'nfse-ssa'); + $this->loadViewsFrom(__DIR__ . '/templates', 'nfse-ssa'); } /** @@ -26,7 +26,8 @@ public function boot() public function register() { $this->mergeConfigFrom( - __DIR__ . '/config/nfse-ssa.php', 'nfse-ssa' + __DIR__ . '/config/nfse-ssa.php', + 'nfse-ssa' ); } } diff --git a/src/request/Error.php b/src/Request/Error.php similarity index 99% rename from src/request/Error.php rename to src/Request/Error.php index 9164c92..9a51e52 100644 --- a/src/request/Error.php +++ b/src/Request/Error.php @@ -20,4 +20,4 @@ class Error * @var */ public $correcao; -} \ No newline at end of file +} diff --git a/src/request/Response.php b/src/Request/Response.php similarity index 99% rename from src/request/Response.php rename to src/Request/Response.php index 70e53cb..23b9ff5 100644 --- a/src/request/Response.php +++ b/src/Request/Response.php @@ -64,5 +64,4 @@ public function setData($data) { $this->data = $data; } - -} \ No newline at end of file +} diff --git a/src/Response.php b/src/Response.php index 5e9650e..7e17a1c 100644 --- a/src/Response.php +++ b/src/Response.php @@ -30,4 +30,4 @@ public function setStatus($status) { $this->status = $status; } -} \ No newline at end of file +} diff --git a/src/services/RequestService.php b/src/Services/RequestService.php similarity index 94% rename from src/services/RequestService.php rename to src/Services/RequestService.php index c8e3cba..86fd1e3 100644 --- a/src/services/RequestService.php +++ b/src/Services/RequestService.php @@ -52,7 +52,6 @@ public function __construct() 'cache_wsdl' => WSDL_CACHE_NONE, 'stream_context' => $context ]; - } /** @@ -62,7 +61,8 @@ public function __construct() * @param $return * @return Response */ - private function consult($wsdlSuffix, $xml, $method, $return){ + private function consult($wsdlSuffix, $xml, $method, $return) + { $wsdl = $this->urlBase . $wsdlSuffix; $client = new MySoapClient($wsdl, $this->soapOptions); @@ -88,12 +88,11 @@ private function consult($wsdlSuffix, $xml, $method, $return){ $error->correcao = $arr['Correcao']; $response->addError($error); } - } else { $response->setStatus(true); $json = json_encode($xmlObj); - $data = json_decode($json,true); + $data = json_decode($json, true); $response->setData($data); } @@ -132,7 +131,8 @@ public function enviarLoteRps($xml) $wsdlSuffix, $finalXml, 'EnviarLoteRPS', - 'EnviarLoteRPSResult'); + 'EnviarLoteRPSResult' + ); return $response; } @@ -151,7 +151,8 @@ public function consultarSituacaoLoteRps($xml) $wsdlSuffix, $finalXml, 'ConsultarSituacaoLoteRPS', - 'ConsultarSituacaoLoteRPSResult'); + 'ConsultarSituacaoLoteRPSResult' + ); return $response; } @@ -170,7 +171,8 @@ public function consultarLoteRps($xml) $wsdlSuffix, $finalXml, 'ConsultarLoteRPS', - 'ConsultarLoteRPSResult'); + 'ConsultarLoteRPSResult' + ); return $response; } @@ -189,7 +191,8 @@ public function consultarNfseRps($xml) $wsdlSuffix, $finalXml, 'ConsultarNfseRPS', - 'ConsultarNfseRPSResult'); + 'ConsultarNfseRPSResult' + ); return $response; } @@ -204,8 +207,9 @@ public function consultarNfse($xml) $wsdlSuffix, $finalXml, 'ConsultarNfse', - 'ConsultarNfseResult'); + 'ConsultarNfseResult' + ); return $response; } -} \ No newline at end of file +} diff --git a/src/services/SignatureService.php b/src/Services/SignatureService.php similarity index 95% rename from src/services/SignatureService.php rename to src/Services/SignatureService.php index 2aa5251..e1bbfbe 100644 --- a/src/services/SignatureService.php +++ b/src/Services/SignatureService.php @@ -32,7 +32,7 @@ public function __construct() * @return string * @throws \Exception */ - public function signXml($xml, $signRoot=true, $tags=[]) + public function signXml($xml, $signRoot = true, $tags = []) { // Load the XML to be signed $doc = new \DOMDocument(); @@ -57,7 +57,7 @@ public function signXml($xml, $signRoot=true, $tags=[]) ); // Create a new (private) Security key - $objKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type'=>'private')); + $objKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type' => 'private')); // Load the private key $objKey->loadKey($this->certificatePrivate, TRUE); @@ -83,7 +83,5 @@ public function signXml($xml, $signRoot=true, $tags=[]) // The signed XML return $doc->saveXML(); - - } -} \ No newline at end of file +} diff --git a/src/helpers.php b/src/helpers.php index a5390c3..7b567c6 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -51,4 +51,4 @@ function array_xml_get($array, $key) return null; } -} \ No newline at end of file +}