Template::createCached()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 4
crap 1
1
<?php
2
3
namespace Zenstruck\ControllerUtil;
4
5
/**
6
 * Helper class to ease creation of template views.
7
 *
8
 * @author Kevin Bond <[email protected]>
9
 */
10
class Template extends View
11
{
12
    /**
13
     * @param string|array $template
14
     * @param int          $sharedMaxAge
15
     * @param array        $parameters
16
     * @param int          $statusCode
17
     *
18
     * @return static
19
     */
20 1
    public static function createCached($template, $sharedMaxAge, $parameters = array(), $statusCode = self::DEFAULT_STATUS_CODE)
21
    {
22 1
        return new static($template, $parameters, $statusCode, array('s_maxage' => $sharedMaxAge));
23
    }
24
25
    /**
26
     * @param string|array $template
27
     * @param mixed        $parameters
28
     * @param int          $statusCode
29
     * @param array        $cache
30
     * @param array        $headers
31
     */
32 5
    public function __construct(
33
        $template,
34
        $parameters = array(),
35
        $statusCode = self::DEFAULT_STATUS_CODE,
36
        array $cache = array(),
37
        array $headers = array()
38
    ) {
39 5
        parent::__construct($parameters, $statusCode, $template, $cache, $headers);
40 5
    }
41
}
42