Completed
Push — master ( e553d9...156fb9 )
by Jonathan
41:51
created

TagTrait::hasTag()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Drupal\DrupalExtension;
4
5
/**
6
 * Helper methods to check the tags that are present on a feature or scenario.
7
 */
8
trait TagTrait
9
{
10
    use FeatureTrait, ScenarioTrait;
11
12
    /**
13
     * Returns all tags for the current scenario and feature.
14
     *
15
     * @return string[]
16
     */
17
    protected function getTags()
18
    {
19
        $featureTags = $this->getFeature()->getTags();
20
        $scenarioTags = $this->getScenario()->getTags();
21
        return array_unique(array_merge($featureTags, $scenarioTags));
22
    }
23
24
    /**
25
     * Checks whether the current scenario or feature has the given tag.
26
     *
27
     * @param string $tag
28
     *
29
     * @return bool
30
     */
31
    protected function hasTag($tag)
32
    {
33
        return in_array($tag, $this->getTags());
34
    }
35
}
36