Feature   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 21
dl 0
loc 71
rs 10
c 1
b 0
f 1
wmc 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A setIcon() 0 5 1
A getIcon() 0 3 1
A addProperty() 0 8 2
A removeProperty() 0 8 2
A getName() 0 3 1
A getProperties() 0 3 1
A setName() 0 5 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Entity;
6
7
use App\Entity\Traits\EntityIdTrait;
8
use Doctrine\Common\Collections\ArrayCollection;
9
use Doctrine\Common\Collections\Collection;
10
use Doctrine\ORM\Mapping as ORM;
11
12
/**
13
 * @ORM\Entity(repositoryClass="App\Repository\FeatureRepository")
14
 */
15
class Feature
16
{
17
    use EntityIdTrait;
18
19
    /**
20
     * @ORM\Column(type="string", length=255)
21
     */
22
    private ?string $name;
23
24
    /**
25
     * @ORM\ManyToMany(targetEntity="App\Entity\Property", mappedBy="features")
26
     */
27
    private $properties;
28
29
    /**
30
     * @ORM\Column(type="text", nullable=true)
31
     */
32
    private ?string $icon;
33
34
    public function __construct()
35
    {
36
        $this->properties = new ArrayCollection();
37
    }
38
39
    public function getName(): ?string
40
    {
41
        return $this->name;
42
    }
43
44
    public function setName(string $name): self
45
    {
46
        $this->name = $name;
47
48
        return $this;
49
    }
50
51
    public function getProperties(): Collection
52
    {
53
        return $this->properties;
54
    }
55
56
    public function addProperty(Property $property): self
57
    {
58
        if (!$this->properties->contains($property)) {
59
            $this->properties[] = $property;
60
            $property->addFeature($this);
61
        }
62
63
        return $this;
64
    }
65
66
    public function removeProperty(Property $property): self
67
    {
68
        if ($this->properties->contains($property)) {
69
            $this->properties->removeElement($property);
70
            $property->removeFeature($this);
71
        }
72
73
        return $this;
74
    }
75
76
    public function getIcon(): ?string
77
    {
78
        return $this->icon;
79
    }
80
81
    public function setIcon(?string $icon): self
82
    {
83
        $this->icon = $icon;
84
85
        return $this;
86
    }
87
}
88