Completed
Push — 3.x ( 799626...732596 )
by Grégoire
04:11
created

TemplateRegistry::getTemplate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Sonata Project package.
5
 *
6
 * (c) Thomas Rabaix <[email protected]>
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 Sonata\AdminBundle\Templating;
13
14
/**
15
 * @author Timo Bakx <[email protected]>
16
 */
17
final class TemplateRegistry implements MutableTemplateRegistryInterface
18
{
19
    private $templates = [];
20
21
    public function __construct(array $templates = [])
22
    {
23
        $this->templates = $templates;
24
    }
25
26
    public function getTemplates()
27
    {
28
        return $this->templates;
29
    }
30
31
    public function setTemplates(array $templates)
32
    {
33
        $this->templates = $templates;
34
    }
35
36
    public function getTemplate($name)
37
    {
38
        if (isset($this->templates[$name])) {
39
            return $this->templates[$name];
40
        }
41
    }
42
43
    public function setTemplate($name, $template)
44
    {
45
        $this->templates[$name] = $template;
46
    }
47
}
48