<commit_before><?php namespace PostcodeAnywhere\php;

/**
 * PostcodeAnywhere API Wrapper for Laravel
 * Test file
 *
 * @author <NAME>
 */
class PostcodeAnywhere
{


    /*
    |--------------------------------------------------------------------------
    | Parameters
    |--------------------------------------------------------------------------
    | Service key - required
    | The key to use to authenticate to the service
    | String  - AA11-AA11-AA11-AA11
    |
    | Postcode - required
    | The postcode to search with find.
    |
    |
    */
    public $params;

    /*
    |--------------------------------------------------------------------------
    | Request data
    |--------------------------------------------------------------------------
    | Holds request data
    */
    public $request = [];

    /*
    |--------------------------------------------------------------------------
    | Web service URL
    |--------------------------------------------------------------------------
    */
    public $url;


    /*
    |--------------------------------------------------------------------------
    | Array of available services
    |--------------------------------------------------------------------------
    */
    public $services;

    /*
    |--------------------------------------------------------------------------
    | Service Url
    |--------------------------------------------------------------------------
    */
    public $serviceUrl;


    /*
    |--------------------------------------------------------------------------
    | Request type
    |--------------------------------------------------------------------------
    |
    | find - get data for given postcode
    | retrive - get full address data for give postcode ID
    */
    public $requestType;


    /*
    |--------------------------------------------------------------------------
    | Request end point
    |--------------------------------------------------------------------------
    |
    */
    public $requestEndPoint;


    /*
    |--------------------------------------------------------------------------
    | Available end points
    |--------------------------------------------------------------------------
    |
    */
    public $endPoints;


    /*
    |--------------------------------------------------------------------------
    | Request URL
    |--------------------------------------------------------------------------
    |
    | final service URL with parameters build in
    */
    public $requestUrl;


    /*
    |--------------------------------------------------------------------------
    | Config file
    |--------------------------------------------------------------------------
    |
    */
    public $config;


    /**
     * Class constructor
     */
    public function __construct($config = [])
    {
        $this->config = $config;
        $this->validateConfig();
    }
    /***/

    /**
     * Validate configuration file
     * @throws \ErrorException
     */
    protected function validateConfig()
    {
        // Validate Key parameter
        if (!array_key_exists('params', $this->config)
            || !array_key_exists('key', $this->config['params'])
            || empty($this->config['params']['key'])) {
            throw new \ErrorException('Postcode Anywhere Key must be set in config file.');
        }

        // Validate Key parameter
        if (
            !array_key_exists('url', $this->config) ||
            !is_array($this->config['url']) ||
            count($this->config['url']) < 1
        ) {
            throw new \ErrorException('Web service URL is not set in config file.');
        }

        // Validate Service URL parameters
        if (
            !array_key_exists('services', $this->config) ||
            !is_array($this->config['services']) ||
            count($this->config['services']) < 1
        ) {
            throw new \ErrorException('Service URLs must be set in config file');
        }


        // Validate Endpoint
        if (
            !array_key_exists('endpoint', $this->config) ||<commit_msg>Test config file<commit_after><?php namespace PostcodeAnywhere\php;

/**
 * PostcodeAnywhere API Wrapper for Laravel
 * Test file
 *
 * @author <NAME>
 */
class PostcodeAnywhere
{


    /*
    |--------------------------------------------------------------------------
    | Parameters
    |--------------------------------------------------------------------------
    | Service key - required
    | The key to use to authenticate to the service
    | String  - AA11-AA11-AA11-AA11
    |
    | Postcode - required
    | The postcode to search with find.
    |
    |
    */
    public $params;

    /*
    |--------------------------------------------------------------------------
    | Request data
    |--------------------------------------------------------------------------
    | Holds request data
    */
    public $request = [];

    /*
    |--------------------------------------------------------------------------
    | Web service URL
    |--------------------------------------------------------------------------
    */
    public $url;


    /*
    |--------------------------------------------------------------------------
    | Array of available services
    |--------------------------------------------------------------------------
    */
    public $services;

    /*
    |--------------------------------------------------------------------------
    | Service Url
    |--------------------------------------------------------------------------
    */
    public $serviceUrl;


    /*
    |--------------------------------------------------------------------------
    | Request type
    |--------------------------------------------------------------------------
    |
    | find - get data for given postcode
    | retrive - get full address data for give postcode ID
    */
    public $requestType;


    /*
    |--------------------------------------------------------------------------
    | Request end point
    |--------------------------------------------------------------------------
    |
    */
    public $requestEndPoint;


    /*
    |--------------------------------------------------------------------------
    | Available end points
    |--------------------------------------------------------------------------
    |
    */
    public $endPoints;


    /*
    |--------------------------------------------------------------------------
    | Request URL
    |--------------------------------------------------------------------------
    |
    | final service URL with parameters build in
    */
    public $requestUrl;


    /*
    |--------------------------------------------------------------------------
    | Config file
    |--------------------------------------------------------------------------
    |
    */
    public $config;


    /**
     * Class constructor
     */
    public function __construct($config = [])
    {
        $this->config = $config;
        $this->validateConfig();
    }
    /***/

    /**
     * Validate configuration file
     * @throws \ErrorException
     */
    protected function validateConfig()
    {
        // Validate Key parameter
        if (!array_key_exists('params', $this->config)
            || !array_key_exists('key', $this->config['params'])
            || empty($this->config['params']['key'])) {
            throw new \ErrorException('Postcode Anywhere Key must be set in config file.');
        }

        // Validate Key parameter
        if (
            !array_key_exists('url', $this->config) ||
            empty($this->config['url'])
        ) {
            throw new \ErrorException('Web service URL is not set in config file.');
        }

        // Validate Service URL parameters
        if (
            !array_key_exists('services', $this->config) ||
            !is_array($this->config['services']) ||
            count($this->config['services']) < 1
        ) {
            throw new \ErrorException('Service URLs must be set in config file');
        }


        // Validate Endpoint
        if (
            !array_key_exists('endpoint', $this->config) ||
{'fraction_non_alphanumeric': 0.4415347137637028, 'fraction_numerical': 0.0023142509135200976, 'mean_word_length': 0.6415433826469412, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4526585', 'n_tokens_mistral': 1610, 'n_tokens_neox': 1524, 'n_words': 372}