<commit_before><?php
namespace PhpSigep\Services\Real;

use PhpSigep\Model\ConsultaCepResposta;
use PhpSigep\Services\Result;

/**
 * @author: Stavarengo
 */
class ConsultaCep
{

    public function execute($cep)
    {
        $cep = preg_replace('/[^\d]/', '', $cep);

        $soapArgs = array(
            'cep' => $cep,
        );

        $r = SoapClientFactory::getSoapClient()->consultaCep($soapArgs);

        $errorCode = null;
        $errorMsg  = null;
        $result    = new Result();
        if (!$r) {
            $errorCode = 0;
        } else if ($r instanceof \SoapFault) {
            $errorCode = $r->getCode();
            $errorMsg  = SoapClientFactory::convertEncoding($r->getMessage());
            $result->setSoapFault($r);
        } else if ($r instanceof \stdClass) {
             if (property_exists($r, 'return') && $r->return instanceof \stdClass) {
                $consultaCepResposta = new ConsultaCepResposta();
                $consultaCepResposta->setBairro(SoapClientFactory::convertEncoding($r->return->bairro));
                $consultaCepResposta->setCep($r->return->cep);
                $consultaCepResposta->setCidade(SoapClientFactory::convertEncoding($r->return->cidade));
                if (isset($r->return->complemento1)) {
                    $consultaCepResposta->setComplemento1(SoapClientFactory::convertEncoding($r->return->complemento));
                if (isset($r->return->complemento2)) {
                    $consultaCepResposta->setComplemento2(SoapClientFactory::convertEncoding($r->return->complemento2));
                }
                if (isset($r->return->end)) {
                    $consultaCepResposta->setEndereco(SoapClientFactory::convertEncoding($r->return->end));
                }
                if (isset($r->return->id)) {
                    $consultaCepResposta->setId($r->return->id);
                }
                $consultaCepResposta->setUf($r->return->uf);
                
                 <commit_msg>Correção de bug na validação de dados da consulta de cep<commit_after><?php
namespace PhpSigep\Services\Real;

use PhpSigep\Model\ConsultaCepResposta;
use PhpSigep\Services\Result;

/**
 * @author: Stavarengo
 */
class ConsultaCep
{

    public function execute($cep)
    {
        $cep = preg_replace('/[^\d]/', '', $cep);

        $soapArgs = array(
            'cep' => $cep,
        );

        $r = SoapClientFactory::getSoapClient()->consultaCep($soapArgs);

        $errorCode = null;
        $errorMsg  = null;
        $result    = new Result();
        if (!$r) {
            $errorCode = 0;
        } else if ($r instanceof \SoapFault) {
            $errorCode = $r->getCode();
            $errorMsg  = SoapClientFactory::convertEncoding($r->getMessage());
            $result->setSoapFault($r);
        } else if ($r instanceof \stdClass) {
             if (property_exists($r, 'return') && $r->return instanceof \stdClass) {
                $consultaCepResposta = new ConsultaCepResposta();
                $consultaCepResposta->setBairro(SoapClientFactory::convertEncoding($r->return->bairro));
                $consultaCepResposta->setCep($r->return->cep);
                $consultaCepResposta->setCidade(SoapClientFactory::convertEncoding($r->return->cidade));
                if (isset($r->return->complemento1)) {
                    $consultaCepResposta->setComplemento1(SoapClientFactory::convertEncoding($r->return->complemento));
                }
                if (isset($r->return->complemento2)) {
                    $consultaCepResposta->setComplemento2(SoapClientFactory::convertEncoding($r->return->complemento2));
                }
                if (isset($r->return->end)) {
                    $consultaCepResposta->setEndereco(SoapClientFactory::convertEncoding($r->return->end));
                }
                if (isset($r->return->id)) {
                    $consultaCepResposta->setId($r->return->id);
                }
                $consultaCepResposta->setUf($r->return->uf);
                
                 
{'fraction_non_alphanumeric': 0.1467324290998767, 'fraction_numerical': 0.002959309494451295, 'mean_word_length': 2.1152073732718892, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 79, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5925517', 'n_tokens_mistral': 1273, 'n_tokens_neox': 1231, 'n_words': 158}