Completed
Push — master ( 0a7932...aee286 )
by Maksim
13s
created

ImagineHelper   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2
Metric Value
dl 0
loc 37
wmc 3
lcom 1
cbo 2
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A filter() 0 4 1
A getName() 0 4 1
1
<?php
2
3
namespace Liip\ImagineBundle\Templating\Helper;
4
5
use Liip\ImagineBundle\Imagine\Cache\CacheManager;
6
use Symfony\Component\Templating\Helper\Helper;
7
8
class ImagineHelper extends Helper
9
{
10
    /**
11
     * @var CacheManager
12
     */
13
    protected $cacheManager;
14
15
    /**
16
     * @param CacheManager $cacheManager
17
     */
18
    public function __construct(CacheManager $cacheManager)
19
    {
20
        $this->cacheManager = $cacheManager;
21
    }
22
23
    /**
24
     * Gets the browser path for the image and filter to apply.
25
     *
26
     * @param string $path
27
     * @param string $filter
28
     * @param array  $runtimeConfig
29
     *
30
     * @return string
31
     */
32
    public function filter($path, $filter, array $runtimeConfig = array())
33
    {
34
        return $this->cacheManager->getBrowserPath($path, $filter, $runtimeConfig);
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function getName()
41
    {
42
        return 'liip_imagine';
43
    }
44
}
45