ConfigFileCacheWarmer::isOptional()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Dekalee\AdbackAnalyticsBundle\CacheWarmer;
4
5
use Dekalee\AdbackAnalytics\Query\ScriptUrlQuery;
6
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
7
8
/**
9
 * Class ConfigFileCacheWarmer
10
 */
11
class ConfigFileCacheWarmer implements CacheWarmerInterface
12
{
13
    protected $query;
14
15
    /**
16
     * @param ScriptUrlQuery $query
17
     */
18 3
    public function __construct(ScriptUrlQuery $query)
19
    {
20 3
        $this->query = $query;
21 3
    }
22
23
    /**
24
     * Checks whether this warmer is optional or not.
25
     *
26
     * Optional warmers can be ignored on certain conditions.
27
     *
28
     * A warmer should return true if the cache can be
29
     * generated incrementally and on-demand.
30
     *
31
     * @return bool true if the warmer is optional, false otherwise
32
     */
33 1
    public function isOptional()
34
    {
35 1
        return false;
36
    }
37
38
    /**
39
     * Warms up the cache.
40
     *
41
     * @param string $cacheDir The cache directory
42
     */
43 1
    public function warmUp($cacheDir)
44
    {
45 1
        $this->query->execute();
46 1
    }
47
}
48