GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Twig::setTemplate()   A
last analyzed

Complexity

Conditions 1
Paths 1

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 1
eloc 3
nc 1
nop 1
1
<?php
2
namespace Naneau\FileGen\File\Contents;
3
4
use Naneau\FileGen\File\Contents as FileContents;
5
use Naneau\FileGen\Parameterized;
6
7
use \Twig_TemplateWrapper as TwigTemplate;
8
9
/**
10
 * Use twig to get the contents for a file
11
 */
12
class Twig implements FileContents, Parameterized
13
{
14
    /**
15
     * The twig template
16
     *
17
     * @var TwigTemplate
18
     **/
19
    private $template;
20
21
    /**
22
     * The parameters
23
     *
24
     * @var array[string]string
25
     **/
26
    private $parameters;
27
28
    /**
29
     * Constructor
30
     *
31
     * @param  TwigTemplate $template
32
     * @param  array        $parameters
33
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
34
     **/
35
    public function __construct(TwigTemplate $template, array $parameters = array())
36
    {
37
        $this
38
            ->setTemplate($template)
39
            ->setParameters($parameters);
40
    }
41
42
    /**
43
     * Get the contents
44
     *
45
     * @return string
46
     **/
47
    public function getContents()
48
    {
49
        return $this->getTemplate()->render($this->getParameters());
50
    }
51
52
    /**
53
     * Get the template
54
     *
55
     * @return TwigTemplate
56
     */
57
    public function getTemplate()
58
    {
59
        return $this->template;
60
    }
61
62
    /**
63
     * Set the template
64
     *
65
     * @param  TwigTemplate $template
66
     * @return Twig
67
     */
68
    public function setTemplate(TwigTemplate $template)
69
    {
70
        $this->template = $template;
71
72
        return $this;
73
    }
74
75
    /**
76
     * Get the parameters
77
     *
78
     * @return array[string]string
0 ignored issues
show
Documentation introduced by
The doc-type array[string]string could not be parsed: Expected "]" at position 2, but found "string". (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
79
     */
80
    public function getParameters()
81
    {
82
        return $this->parameters;
83
    }
84
85
    /**
86
     * Set the parameters
87
     *
88
     * @param  array[string]string $parameters
0 ignored issues
show
Documentation introduced by
The doc-type array[string]string could not be parsed: Expected "]" at position 2, but found "string". (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
89
     * @return Twig
90
     */
91
    public function setParameters(array $parameters)
92
    {
93
        $this->parameters = $parameters;
94
95
        return $this;
96
    }
97
}
98