<commit_before><?php

namespace PayantNG\Payant;

use GuzzleHttp;
use PayantNG\Payant\Exception;
use \Exception as phpException;

class Payant {
	/**
	 * @var $private_key
	 */
	protected $private_key;
	/**
	 * @var $api_url
	 */
	protected $api_url = 'https://api.payant.ng';
	/**
	 * @var $demo_api_url
	 */
	protected $demo_api_url = 'https://api.demo.payant.ng';
	/**
	 * @var $client
	 */
	protected $client;

	public function __construct($private_key, $demo=false)
	{
		// Trim Key
		$private_key = trim($private_key);
		$this->private_key = $private_key;

		// Generate Authorization String
		$authorization_string = "Bearer {$this->private_key}";

		//Specify Api Url to use - Demo or Live
		$base_uri = '';
		if($demo === true){
			$base_uri = $this->demo_api_url;
		}else{
			$base_uri = $this->api_url;
		}

		//Set up Guzzle
		$this->client = new GuzzleHttp\Client( [
			'base_uri' => $base_uri,
			'protocols' => ['https'],
			'headers' => [
				'Authorization' => $authorization_string,
				'Content-Type' => 'application/json'
			]
		]);
	}
	/**
	 * [getStates Get States in a country (Nigeria)]
	 * @return [object] [list of states and their respective state_ids]
	 */
	public function getStates(){
		return $this->sendRequest('get', '/states');
	}

	/**
	 * [getLGAs Get LGAs in a state]
	 * @param  [string] $state_id [description]
	 */
	public function getLGAs($state_id=null){
		if(!$state_id){
			throw new Exception\IsNullOrInvalid("Error Processing Request - Null/Invalid State Id");
		}

		$post_data = ['state_id' => $state_id];

		$url = '/lga';

		return $this->sendRequest('post', $url, ['form_params' => $post_data]);
	}

    /**
     * [addClient description]
     * @param array $client_data [description]
     * Required fields - 'first_name', 'last_name', 'email', 'phone'
     * Optional - 'address', 'company_name', 'lga', 'state'
     */
     public function addClient( array $client_data){
         // Mandatory fields
         $required_values = ['first_name', 'last_name', 'email', 'phone'];

         if(!array_keys_exist($client_data, $required_values)){
             throw new Exception\RequiredValuesMissing("Missing required values :(");
         }

         $url = '/clients';
 
         return $this->sendRequest('post', $url, ['form_params' => $client_data]);
     }

    /**
     * [getClient Get client Details]
     * @param  [string] $client_id
     * @return [object]
     */
	public function getClient($client_id = null){
		if(!$client_id){
			throw new Exception\IsNullOrInvalid("Error Processing Request - Null/Invalid Client Id");
		}

		$url = "/clients/{$client_id}";

		return $this->sendRequest('get', $url);
	}

      /**
       * [editClient - Edit Existing Client]
       * @param [string] $client_id
       * @param [array] $client_data
       *        Required fields - 'first_name', 'last_name', 'email', 'phone'
       *        Optional - 'address', 'company_name', 'lga', 'state'
       */
       public function editClient( $client_id, array $client_data){
           if(!$client_id){
               throw new Exception\IsNullOrInvalid("Error Processing Request - Null/Invalid Client Id");
           }

           $url = "/clients/{$client_id}";

           // Mandatory fields
           $required_values = ['first_name', 'last_name', 'email', 'phone'];

            if(!array_keys_exist($client_data, $required_values)){
                 throw new Exception\RequiredValuesMissing("Missing required values :(");
            }

           return $this->sendRequest('put', $url, ['form_params' => $client_data]);
       }

        /**
         * [deleteClient]
         * @param  [string] $client_id [description]
         */
        public function deleteClient($client_id = null){
            if(!$client_id){
                throw new Exception\IsNullOrInvalid("Error Processing Request - Null/Invalid Client Id");
            }

            $url = "/clients/{$client_id}";

            return $this->sendRequest('delete', $url);<commit_msg>Removed Deprecated Methods [States, LGA], Added Banks<commit_after><?php

namespace PayantNG\Payant;

use GuzzleHttp;
use PayantNG\Payant\Exception;
use \Exception as phpException;

class Payant {
	/**
	 * @var $private_key
	 */
	protected $private_key;
	/**
	 * @var $api_url
	 */
	protected $api_url = 'https://api.payant.ng';
	/**
	 * @var $demo_api_url
	 */
	protected $demo_api_url = 'https://api.demo.payant.ng';
	/**
	 * @var $client
	 */
	protected $client;

	public function __construct($private_key, $demo=false)
	{
		// Trim Key
		$private_key = trim($private_key);
		$this->private_key = $private_key;

		// Generate Authorization String
		$authorization_string = "Bearer {$this->private_key}";

		//Specify Api Url to use - Demo or Live
		$base_uri = '';
		if($demo === true){
			$base_uri = $this->demo_api_url;
		}else{
			$base_uri = $this->api_url;
		}

		//Set up Guzzle
		$this->client = new GuzzleHttp\Client( [
			'base_uri' => $base_uri,
			'protocols' => ['https'],
			'headers' => [
				'Authorization' => $authorization_string,
				'Content-Type' => 'application/json'
			]
		]);
	}
	/**
	 * [getStates Get States in a country (Nigeria)]
	 * @return [object] [list of banks and their respective bank_ids]
	 */
	public function getBanks(){
		return $this->sendRequest('get', '/banks');
	}

    /**
     * [addClient description]
     * @param array $client_data [description]
     * Required fields - 'first_name', 'last_name', 'email', 'phone'
     * Optional - 'address', 'company_name', 'type', 'settlement_bank', 'account_number'
     */
     public function addClient( array $client_data){
         // Mandatory fields
         $required_values = ['first_name', 'last_name', 'email', 'phone'];

         if(!array_keys_exist($client_data, $required_values)){
             throw new Exception\RequiredValuesMissing("Missing required values :(");
         }

         $url = '/clients';
 
         return $this->sendRequest('post', $url, ['form_params' => $client_data]);
     }

    /**
     * [getClient Get client Details]
     * @param  [string] $client_id
     * @return [object]
     */
	public function getClient($client_id = null){
		if(!$client_id){
			throw new Exception\IsNullOrInvalid("Error Processing Request - Null/Invalid Client Id");
		}

		$url = "/clients/{$client_id}";

		return $this->sendRequest('get', $url);
	}

      /**
       * [editClient - Edit Existing Client]
       * @param [string] $client_id
       * @param [array] $client_data
       *        Required fields - 'first_name', 'last_name', 'email', 'phone'
       *        Optional - 'address', 'company_name', 'type', 'settlement_bank', 'account_number'
       */
       public function editClient( $client_id, array $client_data){
           if(!$client_id){
               throw new Exception\IsNullOrInvalid("Error Processing Request - Null/Invalid Client Id");
           }

           $url = "/clients/{$client_id}";

           // Mandatory fields
           $required_values = ['first_name', 'last_name', 'email', 'phone'];

            if(!array_keys_exist($client_data, $required_values)){
                 throw new Exception\RequiredValuesMissing("Missing required values :(");
            }

           return $this->sendRequest('put', $url, ['form_params' => $client_data]);
       }

        /**
         * [deleteClient]
         * @param  [string] $client_id [description]
         */
        public function deleteClient($client_id = null){
            if(!$client_id){
                throw new Exception\IsNullOrInvalid("Error Processing Request - Null/Invalid Client Id");
            }

            $url = "/clients/{$client_id}";

            return $this->sendRequest('delete', $url);
{'fraction_non_alphanumeric': 0.15475113122171946, 'fraction_numerical': 0.0, 'mean_word_length': 2.748062015503876, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 40, 'https://': 4, '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': '753114', 'n_tokens_mistral': 2544, 'n_tokens_neox': 2376, 'n_words': 539}