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

Template::setPaginationDir()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
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