original_string: public static function factory($config = array()) {
          $defaults = array(
              'base_url' => self::API_URL,
              'version' => 'v2.1',
              'command.params' => array(
                  'command.on_complete' => function($command) {
                      $response = $command->getResult();
  
                      // We don't need the meta blocks
                      unset($response['meta']);
  
                      // If we're down to a single element (events, talks etc)
                      // return only this element
                      if (count($response) == 1) {
                          $command->setResult(reset($response));
                      }
                  }
              )
          );
  
          $required = array(
              'base_url',
              'version',
          );
  
          $config = Collection::fromConfig($config, $defaults, $required);
  
          $client = new self($config->get('base_url'), $config);
  
          // Attach a service description to the client
          $description = ServiceDescription::factory(__DIR__ . '/client.json');
          $client->setDescription($description);
  
          return $client;
      }
code: public static function factory($config = array()) {
          $defaults = array(
              'base_url' => self::API_URL,
              'version' => 'v2.1',
              'command.params' => array(
                  'command.on_complete' => function($command) {
                      $response = $command->getResult();
  
                      // We don't need the meta blocks
                      unset($response['meta']);
  
                      // If we're down to a single element (events, talks etc)
                      // return only this element
                      if (count($response) == 1) {
                          $command->setResult(reset($response));
                      }
                  }
              )
          );
  
          $required = array(
              'base_url',
              'version',
          );
  
          $config = Collection::fromConfig($config, $defaults, $required);
  
          $client = new self($config->get('base_url'), $config);
  
          // Attach a service description to the client
          $description = ServiceDescription::factory(__DIR__ . '/client.json');
          $client->setDescription($description);
  
          return $client;
      }
code_tokens: public static function factory ( $ config = array ( ) ) { $ defaults = array ( 'base_url' => self :: API_URL , 'version' => 'v2.1' , 'command.params' => array ( 'command.on_complete' => function ( $ command ) { $ response = $ command -> getResult ( ) ; // We don't need the meta blocks unset ( $ response [ 'meta' ] ) ; // If we're down to a single element (events, talks etc) // return only this element if ( count ( $ response ) == 1 ) { $ command -> setResult ( reset ( $ response ) ) ; } } ) ) ; $ required = array ( 'base_url' , 'version' , ) ; $ config = Collection :: fromConfig ( $ config , $ defaults , $ required ) ; $ client = new self ( $ config -> get ( 'base_url' ) , $ config ) ; // Attach a service description to the client $ description = ServiceDescription :: factory ( __DIR__ . '/client.json' ) ; $ client -> setDescription ( $ description ) ; return $ client ; }
docstring: Factory method to create a new client.
  
  @param  array|Collection $config Configuration data
  @return Client
docstring_tokens: Factory method to create a new client .