Security update for permissions_by_term
[yaffs-website] / vendor / behat / gherkin / src / Behat / Gherkin / Node / FeatureNode.php
1 <?php
2
3 /*
4  * This file is part of the Behat Gherkin.
5  * (c) Konstantin Kudryashov <ever.zet@gmail.com>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 namespace Behat\Gherkin\Node;
12
13 /**
14  * Represents Gherkin Feature.
15  *
16  * @author Konstantin Kudryashov <ever.zet@gmail.com>
17  */
18 class FeatureNode implements KeywordNodeInterface, TaggedNodeInterface
19 {
20     /**
21      * @var null|string
22      */
23     private $title;
24     /**
25      * @var null|string
26      */
27     private $description;
28     /**
29      * @var string[]
30      */
31     private $tags = array();
32     /**
33      * @var null|BackgroundNode
34      */
35     private $background;
36     /**
37      * @var ScenarioInterface[]
38      */
39     private $scenarios = array();
40     /**
41      * @var string
42      */
43     private $keyword;
44     /**
45      * @var string
46      */
47     private $language;
48     /**
49      * @var null|string
50      */
51     private $file;
52     /**
53      * @var integer
54      */
55     private $line;
56
57     /**
58      * Initializes feature.
59      *
60      * @param null|string         $title
61      * @param null|string         $description
62      * @param string[]            $tags
63      * @param null|BackgroundNode $background
64      * @param ScenarioInterface[] $scenarios
65      * @param string              $keyword
66      * @param string              $language
67      * @param null|string         $file
68      * @param integer             $line
69      */
70     public function __construct(
71         $title,
72         $description,
73         array $tags,
74         BackgroundNode $background = null,
75         array $scenarios,
76         $keyword,
77         $language,
78         $file,
79         $line
80     ) {
81         $this->title = $title;
82         $this->description = $description;
83         $this->tags = $tags;
84         $this->background = $background;
85         $this->scenarios = $scenarios;
86         $this->keyword = $keyword;
87         $this->language = $language;
88         $this->file = $file;
89         $this->line = $line;
90     }
91
92     /**
93      * Returns node type string
94      *
95      * @return string
96      */
97     public function getNodeType()
98     {
99         return 'Feature';
100     }
101
102     /**
103      * Returns feature title.
104      *
105      * @return null|string
106      */
107     public function getTitle()
108     {
109         return $this->title;
110     }
111
112     /**
113      * Checks if feature has a description.
114      *
115      * @return Boolean
116      */
117     public function hasDescription()
118     {
119         return !empty($this->description);
120     }
121
122     /**
123      * Returns feature description.
124      *
125      * @return null|string
126      */
127     public function getDescription()
128     {
129         return $this->description;
130     }
131
132     /**
133      * Checks if feature is tagged with tag.
134      *
135      * @param string $tag
136      *
137      * @return Boolean
138      */
139     public function hasTag($tag)
140     {
141         return in_array($tag, $this->tags);
142     }
143
144     /**
145      * Checks if feature has tags.
146      *
147      * @return Boolean
148      */
149     public function hasTags()
150     {
151         return 0 < count($this->tags);
152     }
153
154     /**
155      * Returns feature tags.
156      *
157      * @return string[]
158      */
159     public function getTags()
160     {
161         return $this->tags;
162     }
163
164     /**
165      * Checks if feature has background.
166      *
167      * @return Boolean
168      */
169     public function hasBackground()
170     {
171         return null !== $this->background;
172     }
173
174     /**
175      * Returns feature background.
176      *
177      * @return null|BackgroundNode
178      */
179     public function getBackground()
180     {
181         return $this->background;
182     }
183
184     /**
185      * Checks if feature has scenarios.
186      *
187      * @return Boolean
188      */
189     public function hasScenarios()
190     {
191         return 0 < count($this->scenarios);
192     }
193
194     /**
195      * Returns feature scenarios.
196      *
197      * @return ScenarioInterface[]
198      */
199     public function getScenarios()
200     {
201         return $this->scenarios;
202     }
203
204     /**
205      * Returns feature keyword.
206      *
207      * @return string
208      */
209     public function getKeyword()
210     {
211         return $this->keyword;
212     }
213
214     /**
215      * Returns feature language.
216      *
217      * @return string
218      */
219     public function getLanguage()
220     {
221         return $this->language;
222     }
223
224     /**
225      * Returns feature file.
226      *
227      * @return null|string
228      */
229     public function getFile()
230     {
231         return $this->file;
232     }
233
234     /**
235      * Returns feature declaration line number.
236      *
237      * @return integer
238      */
239     public function getLine()
240     {
241         return $this->line;
242     }
243 }