public static function factory(array $config)
    {
        if ( ! array_key_exists('apiKey', $config)) {
            throw new \Exception('Api factory requires $apiKey parameter.');
        }

        $client = new Client([
            'defaults' => [
                'headers' => [
                    'X-ApiKey' => $config['apiKey'],
                ],
            ],
        ], [], $config);

        $description = self::getDescriptionFromConfig($config);

        $apiVersion = isset($config['apiVersion']) ? $config['apiVersion'] : 1;

        return new self($client, $description, ['defaults' => ['api_version' => $apiVersion]]);
    }
public static function factory(array $config)
    {
        if ( ! array_key_exists('apiKey', $config)) {
            throw new \Exception('Api factory requires $apiKey parameter.');
        }

        $client = new Client([
            'defaults' => [
                'headers' => [
                    'X-ApiKey' => $config['apiKey'],
                ],
            ],
        ], [], $config);

        $description = self::getDescriptionFromConfig($config);

        $apiVersion = isset($config['apiVersion']) ? $config['apiVersion'] : 1;

        return new self($client, $description, ['defaults' => ['api_version' => $apiVersion]]);
    }
public static function factory ( array $ config ) { if ( ! array_key_exists ( 'apiKey' , $ config ) ) { throw new \ Exception ( 'Api factory requires $apiKey parameter.' ) ; } $ client = new Client ( [ 'defaults' => [ 'headers' => [ 'X-ApiKey' => $ config [ 'apiKey' ] , ] , ] , ] , [ ] , $ config ) ; $ description = self :: getDescriptionFromConfig ( $ config ) ; $ apiVersion = isset ( $ config [ 'apiVersion' ] ) ? $ config [ 'apiVersion' ] : 1 ; return new self ( $ client , $ description , [ 'defaults' => [ 'api_version' => $ apiVersion ] ] ) ; }
Creates and returns an Api client instance

@param array $config
@return Api
@throws \Exception
Creates and returns an Api client instance