4 * This file is part of the Behat Gherkin.
5 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
11 namespace Behat\Gherkin\Node;
14 * Represents Gherkin Feature.
16 * @author Konstantin Kudryashov <ever.zet@gmail.com>
18 class FeatureNode implements KeywordNodeInterface, TaggedNodeInterface
31 private $tags = array();
33 * @var null|BackgroundNode
37 * @var ScenarioInterface[]
39 private $scenarios = array();
58 * Initializes feature.
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
70 public function __construct(
74 BackgroundNode $background = null,
81 $this->title = $title;
82 $this->description = $description;
84 $this->background = $background;
85 $this->scenarios = $scenarios;
86 $this->keyword = $keyword;
87 $this->language = $language;
93 * Returns node type string
97 public function getNodeType()
103 * Returns feature title.
105 * @return null|string
107 public function getTitle()
113 * Checks if feature has a description.
117 public function hasDescription()
119 return !empty($this->description);
123 * Returns feature description.
125 * @return null|string
127 public function getDescription()
129 return $this->description;
133 * Checks if feature is tagged with tag.
139 public function hasTag($tag)
141 return in_array($tag, $this->tags);
145 * Checks if feature has tags.
149 public function hasTags()
151 return 0 < count($this->tags);
155 * Returns feature tags.
159 public function getTags()
165 * Checks if feature has background.
169 public function hasBackground()
171 return null !== $this->background;
175 * Returns feature background.
177 * @return null|BackgroundNode
179 public function getBackground()
181 return $this->background;
185 * Checks if feature has scenarios.
189 public function hasScenarios()
191 return 0 < count($this->scenarios);
195 * Returns feature scenarios.
197 * @return ScenarioInterface[]
199 public function getScenarios()
201 return $this->scenarios;
205 * Returns feature keyword.
209 public function getKeyword()
211 return $this->keyword;
215 * Returns feature language.
219 public function getLanguage()
221 return $this->language;
225 * Returns feature file.
227 * @return null|string
229 public function getFile()
235 * Returns feature declaration line number.
239 public function getLine()