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

TemplateLocator::locate()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 17
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 17
rs 9.2
cc 4
eloc 9
nc 4
nop 3
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\Locator;
13
14
use Sylius\Bundle\ThemeBundle\Locator\ResourceLocatorInterface;
15
use Sylius\Bundle\ThemeBundle\Model\ThemeInterface;
16
use Symfony\Component\Templating\TemplateReferenceInterface;
17
18
/**
19
 * @author Kamil Kokot <[email protected]>
20
 */
21
final class TemplateLocator implements TemplateLocatorInterface
22
{
23
    /**
24
     * @var ResourceLocatorInterface
25
     */
26
    private $resourceLocator;
27
28
    /**
29
     * @param ResourceLocatorInterface $resourceLocator
30
     */
31
    public function __construct(ResourceLocatorInterface $resourceLocator)
32
    {
33
        $this->resourceLocator = $resourceLocator;
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function locateTemplate(TemplateReferenceInterface $template, ThemeInterface $theme)
40
    {
41
        return $this->resourceLocator->locateResource($template->getPath(), $theme);
42
    }
43
}
44