<commit_before><?php

namespace lib;



use GuzzleHttp\Client;

class PesquisaCodigoPostalAPI {


	function __construct()
	{
		$this->apiConnect = new Client();
		$this->url = 'http://codigos-postais';

		$this->options = [ 'headers' => [ 'X-Auth-Token' => \Config::get('api-codigopostal-laravel::token')]];

	}

	 function obterConcelhos(){

		return var_dump(\Config::get('api-codigopostal-laravel::token'));
	}

	public function codigoPostalExiste($cp4, $cp3){

		$url 		= $this->url.'/v1/cp/exists/'.$cp4.'/'.$cp3;


		$page_data 	= $this->apiConnect->get($url,$this->options);
		$response 	= $page_data->json();

		return $response;
	}

	public function codigoPostal($cp4,$cp3,$offset){

		$url 		= $this->url.'/v1/cp/'.$cp4.'/'.$cp3.'?offset='.$offset;

		$page_data 	= $this->apiConnect->get($url,$this->options);

		$response 	= $page_data->json();

		return $response;
	}

	public function codigoPostal4Digitos($cp4,$offset){

		$url 		= $this->url.'/v1/cp/'.$cp4.'?offset='.$offset;

		$page_data 	= $this->apiConnect->get($url,$this->options);

		$response 	= $page_data->json();

		return $response;
	}

	public function obterCodigoPostalPorMoradaELocalidade($morada,$localidade){

		return $morada." -". $localidade;
	}

	public function countCodigoPostalPrincipal($cp4){



		$url 		= $this->url.'/v1/cp/count/'.$cp4.'';

		$page_data 	= $this->apiConnect->get($url,$this->options);

		$response 	= $page_data->json();

		return $response;

	}

	public function countCodigoPostal($cp4,$cp3){

		$url 		= $this->url.'/v1/cp/count/'.$cp4.'/'.$cp3.'';


		$page_data 	= $this->apiConnect->get($url,$this->options);

		$response 	= $page_data->json();

		return $response;

	}

}<commit_msg> refactor & count<commit_after><?php

namespace lib;



use GuzzleHttp\Client;

class PesquisaCodigoPostalAPI {


	function __construct()
	{
		$this->apiConnect = new Client();
		$this->url = 'http://codigos-postais';

		$this->options = [ 'headers' => [ 'X-Auth-Token' => \Config::get('api-codigopostal-laravel::token')]];

	}

	 function obterConcelhos(){

		return var_dump(\Config::get('api-codigopostal-laravel::token'));
	}

	private function call($url){

		$page_data 	= $this->apiConnect->get($url,$this->options);
		$response 	= $page_data->json();

		return $response;
	}

	public function codigoPostalExiste($cp4, $cp3){

		$url 		= $this->url.'/v1/cp/exists/'.$cp4.'/'.$cp3;

		return $this->call($url);
	}

	public function codigoPostal($cp4,$cp3,$offset){

		$url 		= $this->url.'/v1/cp/'.$cp4.'/'.$cp3.'?offset='.$offset;

		return $this->call($url);

	}

	public function codigoPostal4Digitos($cp4,$offset){

		$url 		= $this->url.'/v1/cp/'.$cp4.'?offset='.$offset;

		return $this->call($url);

	}

	public function obterCodigoPostalPorMoradaELocalidade($morada,$localidade, $offset){

		$url 		= $this->url.'/v1/morada/'.$morada.'/localidade/'.$localidade.'?offset='.$offset;

		return $this->call($url);

	}

	public function obterCodigoPostalPorMorada($morada, $offset){

		$url 		= $this->url.'/v1/morada/'.$morada.'?offset='.$offset;

		return $this->call($url);

	}
	public function countCodigoPostalPorMoradaELocalidade($morada, $localidade){

		$url 		= $this->url.'/v1/count/morada/'.$morada.'/localidade/'.$localidade;

		return $this->call($url);

	}

	public function countCodigoPostalPorMorada($morada){
		$url 		= $this->url.'/v1/count/morada/'.$morada;

		return $this->call($url);
	}

	public function countCodigoPostalPrincipal($cp4){


		$url 		= $this->url.'/v1/cp/count/'.$cp4.'';

		return $this->call($url);


	}

	public function countCodigoPostal($cp4,$cp3){

		$url 		= $this->url.'/v1/cp/count/'.$cp4.'/'.$cp3.'';

		return $this->call($url);


	}

}
{'fraction_non_alphanumeric': 0.2165674066053059, 'fraction_numerical': 0.012994044396318355, 'mean_word_length': 4.068587105624142, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 60, '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': '1063284', 'n_tokens_mistral': 1592, 'n_tokens_neox': 1448, 'n_words': 184}