CacheClearer   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 31
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A clear() 0 8 2
1
<?php
2
/**
3
 * AnimeDb package.
4
 *
5
 * @author    Peter Gribanov <[email protected]>
6
 * @copyright Copyright (c) 2011, Peter Gribanov
7
 * @license   http://opensource.org/licenses/GPL-3.0 GPL v3
8
 */
9
namespace AnimeDb\Bundle\AppBundle\Service;
10
11
use Symfony\Component\Filesystem\Exception\IOException;
12
use Symfony\Component\Filesystem\Filesystem;
13
14
class CacheClearer
15
{
16
    /**
17
     * @var string
18
     */
19
    protected $root;
20
21
    /**
22
     * @var Filesystem
23
     */
24
    protected $fs;
25
26
    /**
27
     * @param Filesystem $fs
28
     * @param string $root
29
     */
30 2
    public function __construct(Filesystem $fs, $root)
31
    {
32 2
        $this->fs = $fs;
33 2
        $this->root = $root;
34 2
    }
35
36 2
    public function clear()
37
    {
38
        try {
39 2
            $this->fs->remove($this->root.'/cache/'); // so quickly
40 1
        } catch (IOException $e) {
41
            // is not a critical error
42
        }
43 2
    }
44
}
45