Completed
Pull Request — master (#270)
by Marc
03:17 queued 55s
created

ArgumentDefinition::isEscaped()   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 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
namespace TYPO3Fluid\Fluid\Core\ViewHelper;
3
4
/*
5
 * This file belongs to the package "TYPO3 Fluid".
6
 * See LICENSE.txt that was shipped with this package.
7
 */
8
9
/**
10
 * Argument definition of each view helper argument
11
 */
12
class ArgumentDefinition
13
{
14
15
    /**
16
     * Name of argument
17
     *
18
     * @var string
19
     */
20
    protected $name;
21
22
    /**
23
     * Type of argument
24
     *
25
     * @var string
26
     */
27
    protected $type;
28
29
    /**
30
     * Description of argument
31
     *
32
     * @var string
33
     */
34
    protected $description;
35
36
    /**
37
     * Is argument required?
38
     *
39
     * @var boolean
40
     */
41
    protected $required = false;
42
43
    /**
44
     * Default value for argument
45
     *
46
     * @var mixed
47
     */
48
    protected $defaultValue = null;
49
50
    /**
51
     * Defines, if the ObjectAccessNodes inside this argument gets escaped
52
     *
53
     * @var boolean
54
     */
55
    protected $escaping = false;
56
57
    /**
58
     * Constructor for this argument definition.
59
     *
60
     * @param string $name Name of argument
61
     * @param string $type Type of argument
62
     * @param string $description Description of argument
63
     * @param boolean $required TRUE if argument is required
64
     * @param mixed $defaultValue Default value
65
     */
66
    public function __construct($name, $type, $description = null, $required = false, $defaultValue = null)
67
    {
68
        $this->name = $name;
69
        $this->type = $type;
70
        $this->description = $description;
71
        $this->required = $required;
72
        $this->defaultValue = $defaultValue;
73
    }
74
75
    /**
76
     * Get the name of the argument
77
     *
78
     * @return string Name of argument
79
     */
80
    public function getName()
81
    {
82
        return $this->name;
83
    }
84
85
    /**
86
     * Get the type of the argument
87
     *
88
     * @return string Type of argument
89
     */
90
    public function getType()
91
    {
92
        return $this->type;
93
    }
94
95
    /**
96
     * Get the description of the argument
97
     *
98
     * @return string Description of argument
99
     */
100
    public function getDescription()
101
    {
102
        return $this->description;
103
    }
104
105
    /**
106
     * @param string $description
107
     * @return ArgumentDefinition
108
     */
109
    public function setDescription($description)
110
    {
111
        $this->description = $description;
112
        return $this;
113
    }
114
115
    /**
116
     * Get the optionality of the argument
117
     *
118
     * @return boolean TRUE if argument is optional
119
     */
120
    public function isRequired()
121
    {
122
        return $this->required;
123
    }
124
125
    /**
126
     * Make this argument required
127
     *
128
     * @param bool $required
129
     * @return ArgumentDefinition
130
     */
131
    public function setRequired($required)
132
    {
133
        $this->required = $required;
134
        return $this;
135
    }
136
137
    /**
138
     * Get the default value, if set
139
     *
140
     * @return mixed Default value
141
     */
142
    public function getDefaultValue()
143
    {
144
        return $this->defaultValue;
145
    }
146
147
    /**
148
     * Sets a default value for this argument
149
     *
150
     * @param mixed $defaultValue
151
     * @return ArgumentDefinition
152
     */
153
    public function setDefaultValue($defaultValue)
154
    {
155
        $this->defaultValue = $defaultValue;
156
        return $this;
157
    }
158
159
    /**
160
     * @return bool
161
     */
162
    public function isEscaped()
163
    {
164
        return $this->escaping;
165
    }
166
167
    /**
168
     * @param bool $escaping
169
     * @return ArgumentDefinition
170
     */
171
    public function setEscaping($escaping)
172
    {
173
        $this->escaping = $escaping;
174
        return $this;
175
    }
176
177
}
178