Completed
Push — master ( a70ca2...b8c2a5 )
by Daniel
14:22
created

MethodRouterCacheWarmer   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A warmUp() 0 6 2
A isOptional() 0 4 1
1
<?php
2
3
namespace Cmobi\RabbitmqBundle\Routing\CacheWarmer;
4
5
use Cmobi\RabbitmqBundle\Routing\MethodRouter;
6
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
7
use Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface;
8
9
10
class MethodRouterCacheWarmer implements CacheWarmerInterface
11
{
12
    protected $router;
13
14
    public function __construct(MethodRouter $router)
15
    {
16
        $this->router = $router;
17
    }
18
19
    public function warmUp($cacheDir)
20
    {
21
        if ($this->router instanceof WarmableInterface) {
22
            $this->router->warmUp($cacheDir);
23
        }
24
    }
25
26
    public function isOptional()
27
    {
28
        return true;
29
    }
30
}
31