本文整理汇总了PHP中Guzzle\Http\ClientInterface::hasLogger方法的典型用法代码示例。如果您正苦于以下问题:PHP ClientInterface::hasLogger方法的具体用法?PHP ClientInterface::hasLogger怎么用?PHP ClientInterface::hasLogger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guzzle\Http\ClientInterface
的用法示例。
在下文中一共展示了ClientInterface::hasLogger方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: factory
/**
* Factory method which allows for easy service creation
*
* @param ClientInterface $client
* @return self
*/
public static function factory(ClientInterface $client)
{
$identity = new self();
if (($client instanceof Base || $client instanceof OpenStack) && $client->hasLogger()) {
$identity->setLogger($client->getLogger());
}
$identity->setClient($client);
$identity->setEndpoint(clone $client->getAuthUrl());
return $identity;
}
示例2: factory
/**
* Factory method which allows for easy service creation
*
* @param ClientInterface $client
* @return self
*/
public static function factory(\Guzzle\Http\ClientInterface $client)
{
$tempAuth = new self();
if (($client instanceof \OpenCloud\Common\Base || $client instanceof \OpenCloud\OpenStack) && $client->hasLogger()) {
$tempAuth->setLogger($client->getLogger());
}
$tempAuth->setClient($client);
$tempAuth->setEndpoint(clone $client->getAuthUrl());
return $tempAuth;
}
示例3: __construct
/**
* Creates a service object, based off the specified client.
*
* The service's URL is defined in the client's serviceCatalog; it
* uses the $type, $name, $region, and $urlType to find the proper endpoint
* and set it. If it cannot find a URL in the service catalog that matches
* the criteria, then an exception is thrown.
*
* @param Client $client Client object
* @param string $type Service type (e.g. 'compute')
* @param string $name Service name (e.g. 'cloudServersOpenStack')
* @param string $region Service region (e.g. 'DFW', 'ORD', 'IAD', 'LON', 'SYD' or 'HKG')
* @param string $urlType Either 'publicURL' or 'internalURL'
*/
public function __construct(ClientInterface $client, $type = null, $name = null, $region = null, $urlType = null)
{
if (($client instanceof Base || $client instanceof OpenStack) && $client->hasLogger()) {
$this->setLogger($client->getLogger());
}
$this->setClient($client);
$this->name = $name ?: static::DEFAULT_NAME;
$this->region = $region;
$this->region = $region;
if ($this->regionless !== true && !$this->region) {
throw new Exceptions\ServiceException(sprintf('The %s service must have a region set. You can either pass in a region string as an argument param, or' . ' set a default region for your user account by executing User::setDefaultRegion and ::update().', $this->name));
}
$this->type = $type ?: static::DEFAULT_TYPE;
$this->urlType = $urlType ?: static::DEFAULT_URL_TYPE;
$this->setEndpoint($this->findEndpoint());
$this->client->setBaseUrl($this->getBaseUrl());
if ($this instanceof EventSubscriberInterface) {
$this->client->getEventDispatcher()->addSubscriber($this);
}
}