public static function factory($config = array()) { $config = Collection::fromConfig($config, self::getDefaultConfig(), ['api_token', 'service_description']); $client = new self($config->get('base_url'), $config); $client->setDescription($client->getServiceDescriptionFromFile($config->get('service_description'))); $client->setDefaultOption('auth', [$config->get('api_token'), null, 'basic']); $client->addSubscriber($client); $client->setErrorHandler(); return $client; }