Security update for permissions_by_term
[yaffs-website] / vendor / behat / gherkin / src / Behat / Gherkin / Node / ScenarioNode.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 Scenario.
15  *
16  * @author Konstantin Kudryashov <ever.zet@gmail.com>
17  */
18 class ScenarioNode implements ScenarioInterface
19 {
20     /**
21      * @var string
22      */
23     private $title;
24     /**
25      * @var array
26      */
27     private $tags = array();
28     /**
29      * @var StepNode[]
30      */
31     private $steps = array();
32     /**
33      * @var string
34      */
35     private $keyword;
36     /**
37      * @var integer
38      */
39     private $line;
40
41     /**
42      * Initializes scenario.
43      *
44      * @param null|string $title
45      * @param array       $tags
46      * @param StepNode[]  $steps
47      * @param string      $keyword
48      * @param integer     $line
49      */
50     public function __construct($title, array $tags, array $steps, $keyword, $line)
51     {
52         $this->title = $title;
53         $this->tags = $tags;
54         $this->steps = $steps;
55         $this->keyword = $keyword;
56         $this->line = $line;
57     }
58
59     /**
60      * Returns node type string
61      *
62      * @return string
63      */
64     public function getNodeType()
65     {
66         return 'Scenario';
67     }
68
69     /**
70      * Returns scenario title.
71      *
72      * @return null|string
73      */
74     public function getTitle()
75     {
76         return $this->title;
77     }
78
79     /**
80      * Checks if scenario is tagged with tag.
81      *
82      * @param string $tag
83      *
84      * @return Boolean
85      */
86     public function hasTag($tag)
87     {
88         return in_array($tag, $this->getTags());
89     }
90
91     /**
92      * Checks if scenario has tags (both inherited from feature and own).
93      *
94      * @return Boolean
95      */
96     public function hasTags()
97     {
98         return 0 < count($this->getTags());
99     }
100
101     /**
102      * Returns scenario tags (including inherited from feature).
103      *
104      * @return array
105      */
106     public function getTags()
107     {
108         return $this->tags;
109     }
110
111     /**
112      * Checks if scenario has steps.
113      *
114      * @return Boolean
115      */
116     public function hasSteps()
117     {
118         return 0 < count($this->steps);
119     }
120
121     /**
122      * Returns scenario steps.
123      *
124      * @return StepNode[]
125      */
126     public function getSteps()
127     {
128         return $this->steps;
129     }
130
131     /**
132      * Returns scenario keyword.
133      *
134      * @return string
135      */
136     public function getKeyword()
137     {
138         return $this->keyword;
139     }
140
141     /**
142      * Returns scenario declaration line number.
143      *
144      * @return integer
145      */
146     public function getLine()
147     {
148         return $this->line;
149     }
150 }