Completed
Push — theme-bundle ( aad440...af4cdd )
by Kamil
15:45
created

TemplatePathsCacheClearer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 27
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A clear() 0 8 2
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sylius\Bundle\ThemeBundle\Templating\Cache\Clearer;
13
14
use Doctrine\Common\Cache\Cache;
15
use Doctrine\Common\Cache\ClearableCache;
16
use Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface;
17
18
/**
19
 * @author Kamil Kokot <[email protected]>
20
 */
21
final class TemplatePathsCacheClearer implements CacheClearerInterface
22
{
23
    /**
24
     * @var Cache
25
     */
26
    private $cache;
27
28
    /**
29
     * @param Cache $cache
30
     */
31
    public function __construct(Cache $cache)
32
    {
33
        $this->cache = $cache;
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function clear($cacheDir)
40
    {
41
        if (!$this->cache instanceof ClearableCache) {
42
            return;
43
        }
44
45
        $this->cache->deleteAll();
46
    }
47
}
48