Completed
Push — master ( 832ce2...0a3e21 )
by Thierry
01:57
created

Template   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 41
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 4 1
A addViewNamespace() 0 4 1
A setPaginationDir() 0 4 1
1
<?php
2
3
/**
4
 * Template.php - Trait for template functions
5
 *
6
 * @package jaxon-core
7
 * @author Thierry Feuzeu <[email protected]>
8
 * @copyright 2016 Thierry Feuzeu <[email protected]>
9
 * @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
10
 * @link https://github.com/jaxon-php/jaxon-core
11
 */
12
13
namespace Jaxon\Utils\Traits;
14
15
use Jaxon\Utils\Container;
16
17
trait Template
18
{
19
    /**
20
     * Render a template
21
     *
22
     * @param string        $sTemplate            The name of template to be rendered
23
     * @param string        $aVars                The template vars
24
     *
25
     * @return string        The template content
26
     */
27
    public function render($sTemplate, array $aVars = array())
28
    {
29
        return Container::getInstance()->getTemplate()->render($sTemplate, $aVars);
30
    }
31
32
    /**
33
     * Add a namespace to the template system
34
     *
35
     * @param string        $sNamespace         The namespace name
36
     * @param string        $sDirectory         The namespace directory
37
     * @param string        $sExtension         The extension to append to template names
38
     *
39
     * @return void
40
     */
41
    public function addViewNamespace($sNamespace, $sDirectory, $sExtension = '')
42
    {
43
        return Container::getInstance()->getTemplate()->addNamespace($sNamespace, $sDirectory, $sExtension);
44
    }
45
46
    /**
47
     * Set a new directory for pagination templates
48
     *
49
     * @param string        $sDirectory             The directory path
50
     *
51
     * @return void
52
     */
53
    public function setPaginationDir($sDirectory)
54
    {
55
        return Container::getInstance()->getTemplate()->setPaginationDir($sDirectory);
56
    }
57
}
58