Code Duplication    Length = 39-39 lines in 2 locations

src/Connection/NamespacedCachePoolFactory.php 1 location

@@ 35-73 (lines=39) @@
32
 * @link      https://github.com/techdivision/import
33
 * @link      http://www.techdivision.com
34
 */
35
class NamespacedCachePoolFactory implements CachePoolFactoryInterface
36
{
37
38
    /**
39
     * The configuration instance.
40
     *
41
     * @var \TechDivision\Import\ConfigurationInterface
42
     */
43
    protected $configuration;
44
45
    /**
46
     * The cache factory instance.
47
     *
48
     * @var \TechDivision\Import\Connection\CachePoolFactoryInterface
49
     */
50
    protected $cachePoolFactory;
51
52
    /**
53
     * Initialize the cache adapter factory with the passed configuration instances.
54
     * .
55
     * @param \TechDivision\Import\ConfigurationInterface               $configuration    The configuration instance
56
     * @param \TechDivision\Import\Connection\CachePoolFactoryInterface $cachePoolFactory The cache factory instance
57
     */
58
    public function __construct(ConfigurationInterface $configuration, CachePoolFactoryInterface $cachePoolFactory)
59
    {
60
        $this->configuration = $configuration;
61
        $this->cachePoolFactory = $cachePoolFactory;
62
    }
63
64
    /**
65
     * Creates and returns the cache pool instance.
66
     *
67
     * @return \Cache\Namespaced\NamespacedCachePool The namespaced cache pool instance
68
     */
69
    public function createCachePool()
70
    {
71
        return new NamespacedCachePool($this->cachePoolFactory->createCachePool(), $this->configuration->getSerial());
72
    }
73
}
74

src/Connection/PrefixedCachePoolFactory.php 1 location

@@ 35-73 (lines=39) @@
32
 * @link      https://github.com/techdivision/import
33
 * @link      http://www.techdivision.com
34
 */
35
class PrefixedCachePoolFactory
36
{
37
38
    /**
39
     * The configuration instance.
40
     *
41
     * @var \TechDivision\Import\ConfigurationInterface
42
     */
43
    protected $configuration;
44
45
    /**
46
     * The cache factory instance.
47
     *
48
     * @var \TechDivision\Import\Connection\CachePoolFactoryInterface
49
     */
50
    protected $cachePoolFactory;
51
52
    /**
53
     * Initialize the cache adapter factory with the passed configuration instances.
54
     * .
55
     * @param \TechDivision\Import\ConfigurationInterface               $configuration    The configuration instance
56
     * @param \TechDivision\Import\Connection\CachePoolFactoryInterface $cachePoolFactory The cache factory instance
57
     */
58
    public function __construct(ConfigurationInterface $configuration, CachePoolFactoryInterface $cachePoolFactory)
59
    {
60
        $this->configuration = $configuration;
61
        $this->cachePoolFactory = $cachePoolFactory;
62
    }
63
64
    /**
65
     * Creates and returns the cache pool instance.
66
     *
67
     * @return \Cache\Prefixed\PrefixedCachePool The prefixed cache pool instance
68
     */
69
    public function createCachePool()
70
    {
71
        return new PrefixedCachePool($this->cachePoolFactory->createCachePool(), sprintf('%s_', $this->configuration->getSerial()));
72
    }
73
}
74