mirror of
https://github.com/guzzle/guzzle.git
synced 2025-02-13 03:45:22 +01:00
[Service] Removing extraneous code from Guzzle\Service\ServiceBuilder
This commit is contained in:
parent
d081e30d59
commit
1dce958700
@ -26,26 +26,14 @@ class ServiceBuilder
|
||||
*/
|
||||
protected $clients = array();
|
||||
|
||||
/**
|
||||
* @var CacheAdapterInterface Cache adapter to use for Service caching
|
||||
*/
|
||||
protected $cache;
|
||||
|
||||
/**
|
||||
* @var int Cache entry TTL
|
||||
*/
|
||||
protected $ttl;
|
||||
|
||||
/**
|
||||
* Create a new ServiceBuilder using an XML configuration file to configure
|
||||
* the registered ServiceBuilder builder objects
|
||||
*
|
||||
* @param string $filename Full path to the XML configuration file
|
||||
* @param CacheAdapterInterface $cacheAdapter (optional) Pass a cache
|
||||
* adapter to cache the service configuration settings loaded from the
|
||||
* XML and to cache dynamically built services.
|
||||
* @param int $ttl (optional) How long to cache items in the cache
|
||||
* adapter (defaults to 24 hours).
|
||||
* adapter to cache the XML service configuration settings
|
||||
* @param int $ttl (optional) How long to cache the parsed XML data
|
||||
*
|
||||
* @return ServiceBuilder
|
||||
* @throws RuntimeException if the file cannot be openend
|
||||
@ -108,10 +96,6 @@ class ServiceBuilder
|
||||
}
|
||||
|
||||
$builder = new self($config);
|
||||
if ($cacheAdapter) {
|
||||
// Always share the cache
|
||||
$builder->setCache($cacheAdapter, $ttl);
|
||||
}
|
||||
|
||||
return $builder;
|
||||
}
|
||||
@ -129,27 +113,6 @@ class ServiceBuilder
|
||||
$this->builderConfig = $serviceBuilderConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the CacheAdapter to pass to generated builders which will allow the
|
||||
* builders to access the CacheAdapter. This is helpul for speeding up
|
||||
* the process of parsing and loading dynamically generated clients.
|
||||
*
|
||||
* @param CacheAdapterInterface $cacheAdapter (optional) Pass a cache
|
||||
* adapter to cache the service configuration settings loaded from the
|
||||
* XML and to cache dynamically built services.
|
||||
* @param int $ttl (optional) How long to cache items in the cache
|
||||
* adapter (defaults to 24 hours).
|
||||
*
|
||||
* @return ServiceBuilder
|
||||
*/
|
||||
public function setCache(CacheAdapterInterface $cacheAdapter, $ttl = 86400)
|
||||
{
|
||||
$this->cache = $cacheAdapter;
|
||||
$this->ttl = $ttl ?: 86400;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a client using a registered builder
|
||||
*
|
||||
|
@ -105,7 +105,6 @@ EOT;
|
||||
|
||||
/**
|
||||
* @covers Guzzle\Service\ServiceBuilder::factory
|
||||
* @covers Guzzle\Service\ServiceBuilder::setCache
|
||||
* @covers Guzzle\Service\ServiceBuilder
|
||||
*/
|
||||
public function testFactoryUsesCacheAdapterWhenAvailable()
|
||||
@ -124,9 +123,6 @@ EOT;
|
||||
|
||||
$builder = ServiceBuilder::factory($this->tempFile);
|
||||
$this->assertEquals($s1, $s2);
|
||||
|
||||
$this->assertSame($s1, $s1->setCache($adapter, 86400));
|
||||
$client = $s1->get('michael.mock');
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user