Total Complexity | 3 |
Total Lines | 24 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
25 | class Vocabulary extends CecilCollection implements ItemInterface |
||
26 | { |
||
27 | /** |
||
28 | * Adds a term to a Vocabulary collection. |
||
29 | * {@inheritdoc} |
||
30 | */ |
||
31 | 1 | public function add(ItemInterface $item): CollectionInterface |
|
32 | { |
||
33 | 1 | if ($this->has($item->getId())) { |
|
34 | // return if already exists |
||
35 | 1 | return $this; |
|
36 | } |
||
37 | |||
38 | 1 | $this->items[] = $item; |
|
39 | |||
40 | 1 | return $this; |
|
41 | } |
||
42 | |||
43 | /** |
||
44 | * {@inheritdoc} |
||
45 | */ |
||
46 | 1 | public function get(string $id): Term |
|
49 | } |
||
50 | } |
||
51 |