Completed
Push — develop ( 3bf98d...ad187c )
by Jaap
06:26
created

ConfigureCacheHandler::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of phpDocumentor.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @copyright 2010-2015 Mike van Riel<[email protected]>
9
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
10
 * @link      http://phpdoc.org
11
 */
12
13
namespace phpDocumentor\DomainModel;
14
15
use phpDocumentor\DomainModel\ConfigureCache;
16
use Stash\Pool;
17
18
final class ConfigureCacheHandler
19
{
20
    /** @var Pool */
21
    private $pool;
22
23
    /**
24
     * ConfigureCacheHandler constructor.
25
     */
26
    public function __construct(Pool $pool)
27
    {
28
        $this->pool = $pool;
29
    }
30
31
    public function __invoke(ConfigureCache $command)
32
    {
33
        $this->pool->getDriver()->setOptions(['path' => $command->location()]);
34
        if ($command->enabled() === false) {
35
            $this->pool->flush();
36
        }
37
    }
38
}
39