This class seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
22
{
23
protected $keywords;
24
25
public function getKeywords(): Collection
26
{
27
return $this->keywords;
28
}
29
30
public function setKeywords(Collection $keywords): void
31
{
32
$this->keywords = $keywords;
33
}
34
35
public function addKeyword(KeywordInterface $keyword): void
36
{
37
if (!$this->hasKeyword($keyword)) {
38
$this->keywords->add($keyword);
39
}
40
}
41
42
public function removeKeyword(KeywordInterface $keyword): void
43
{
44
if ($this->hasKeyword($keyword)) {
45
$this->keywords->removeElement($keyword);
46
}
47
}
48
49
public function hasKeyword(KeywordInterface $keyword): bool
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.