TaggableTrait::hasTag()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Habemus\Definition\Tag;
5
6
trait TaggableTrait
7
{
8
9
    /**
10
     * @var array
11
     */
12
    protected $tags = [];
13
14
    public function addTag(string $tag)
15
    {
16
        $this->tags[] = $tag;
17
        return $this;
18
    }
19
20
    public function hasTag(string $tag): bool
21
    {
22
        return in_array($tag, $this->tags);
23
    }
24
25
    public function getTags(): array
26
    {
27
        return $this->tags;
28
    }
29
}
30