src/Ant/ChateaClient/Service/Client/ChateaOAuth2Client.php
public static function factory($config = array())
    {
        // Provide a hash of default client configuration options
        $default = array(
            'Accept'=>'application/json',
            'environment'=>'prod',
            'service-description-name' => Client::NAME_SERVICE_AUTH,
            'ssl'=>false
        );
        $required = array(
            'base_url',
            'Accept',
            'environment',
            'client_id',
            'secret',
            'ssl'
        );

        // Merge in default settings and validate the config
        $config = Collection::fromConfig($config, $default, $required);

        if($config['environment'] == 'dev' && $config['ssl'] ==  false ){
            $config['ssl.certificate_authority'] = 'system';
            $config['curl.options'] = array(CURLOPT_SSL_VERIFYHOST=>false,CURLOPT_SSL_VERIFYPEER=>false);
        }

        // Create a new ChateaOAuth2 client
        $client = new ChateaOAuth2Client ($config->get('base_url'),$config
        );
        $client->addSubscriber(new AcceptHeaderPluging($config->toArray()));
        return $client;
    }
public static function factory($config = array())
    {
        // Provide a hash of default client configuration options
        $default = array(
            'Accept'=>'application/json',
            'environment'=>'prod',
            'service-description-name' => Client::NAME_SERVICE_AUTH,
            'ssl'=>false
        );
        $required = array(
            'base_url',
            'Accept',
            'environment',
            'client_id',
            'secret',
            'ssl'
        );

        // Merge in default settings and validate the config
        $config = Collection::fromConfig($config, $default, $required);

        if($config['environment'] == 'dev' && $config['ssl'] ==  false ){
            $config['ssl.certificate_authority'] = 'system';
            $config['curl.options'] = array(CURLOPT_SSL_VERIFYHOST=>false,CURLOPT_SSL_VERIFYPEER=>false);
        }

        // Create a new ChateaOAuth2 client
        $client = new ChateaOAuth2Client ($config->get('base_url'),$config
        );
        $client->addSubscriber(new AcceptHeaderPluging($config->toArray()));
        return $client;
    }
public static function factory ( $ config = array ( ) ) { // Provide a hash of default client configuration options $ default = array ( 'Accept' => 'application/json' , 'environment' => 'prod' , 'service-description-name' => Client :: NAME_SERVICE_AUTH , 'ssl' => false ) ; $ required = array ( 'base_url' , 'Accept' , 'environment' , 'client_id' , 'secret' , 'ssl' ) ; // Merge in default settings and validate the config $ config = Collection :: fromConfig ( $ config , $ default , $ required ) ; if ( $ config [ 'environment' ] == 'dev' && $ config [ 'ssl' ] == false ) { $ config [ 'ssl.certificate_authority' ] = 'system' ; $ config [ 'curl.options' ] = array ( CURLOPT_SSL_VERIFYHOST => false , CURLOPT_SSL_VERIFYPEER => false ) ; } // Create a new ChateaOAuth2 client $ client = new ChateaOAuth2Client ( $ config -> get ( 'base_url' ) , $ config ) ; $ client -> addSubscriber ( new AcceptHeaderPluging ( $ config -> toArray ( ) ) ) ; return $ client ; }
Build new class ChateaOAuth2Client, this provides user authentication for ApiChateaClient

@param array $config Associative array can configure the client. The parameters are:
client_id   The public key of client. This parameter is required
secret      The private key of client. This parameter is required
base_url    The server endpoind url. This parameter is optional
Accept      The accept header, default value is json. This parameter is optional
environment Set mode production [prod] or developing [dev] default value is prod. This parameter is optional
scheme      Set server schema communication [http|https] for default https. This parameter is optional
subdomain   Set server subdomain if this exist. For default is api. This parameter is optional


@return ChateaOAuth2Client|\Guzzle\Service\Client
Build new class ChateaOAuth2Client this provides user authentication for ApiChateaClient