本文整理汇总了PHP中Guzzle\Service\Client::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::factory方法的具体用法?PHP Client::factory怎么用?PHP Client::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guzzle\Service\Client
的用法示例。
在下文中一共展示了Client::factory方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: factory
public static function factory($config = [])
{
$config['request.options'] = ['exceptions' => false];
$client = parent::factory($config);
$descriptionPath = realpath(__DIR__ . '/../api/index.json');
$description = ServiceDescription::factory($descriptionPath);
$client->setSession(new Session($client));
$client->setId($config['client_id']);
$client->setSecret($config['client_secret']);
$client->setDescription($description);
$client->addSubscriber($client->getSession());
return $client;
}
示例2: testFactoryDoesNotRequireBaseUrl
public function testFactoryDoesNotRequireBaseUrl()
{
$client = Client::factory();
}
示例3: __construct
/**
* @param GuzzleServiceDescription $description
* @param array $config
*/
public function __construct(GuzzleServiceDescription $description, array $config = array())
{
$this->client = GuzzleClient::factory($config);
$this->client->setDescription($description);
}
示例4: testFactoryCreatesClient
/**
* @covers Guzzle\Service\Client::factory
*/
public function testFactoryCreatesClient()
{
$client = Client::factory(array('base_url' => 'http://www.test.com/', 'test' => '123'));
$this->assertEquals('http://www.test.com/', $client->getBaseUrl());
$this->assertEquals('123', $client->getConfig('test'));
}
示例5: factory
public static function factory($config = array())
{
$config['base_url'] = 'http://api.example.com';
// for Guzzle <= 3.0.1
return parent::factory($config);
}
示例6: factory
/**
* @param array $config
*
* @return BaseClient
*/
public static function factory($config = array())
{
$client = parent::factory($config);
$client->identity = $config['identity'];
return $client;
}