Test Failed
Branch develop (47adb0)
by Stone
04:36
created

VideoType::getVideo()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace App\Entity;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\Common\Collections\Collection;
7
use Doctrine\ORM\Mapping as ORM;
8
9
/**
10
 * @ORM\Entity(repositoryClass="App\Repository\VideoTypeRepository")
11
 */
12
class VideoType
13
{
14
    /**
15
     * @ORM\Id()
16
     * @ORM\GeneratedValue()
17
     * @ORM\Column(type="integer")
18
     */
19
    private $id;
20
21
    /**
22
     * @ORM\Column(type="string", length=255)
23
     */
24
    private $site;
25
26
    /**
27
     * @ORM\Column(type="text")
28
     */
29
    private $code;
30
31
    /**
32
     * @ORM\OneToMany(targetEntity="App\Entity\Video", mappedBy="videoType")
33
     */
34
    private $video;
35
36
    /**
37
     * @ORM\Column(type="string", length=255, nullable=true)
38
     */
39
    private $imageCode;
40
41
    public function __construct()
42
    {
43
        $this->video = new ArrayCollection();
44
    }
45
46
    public function getId(): ?int
47
    {
48
        return $this->id;
49
    }
50
51
    public function getSite(): ?string
52
    {
53
        return $this->site;
54
    }
55
56
    public function setSite(string $site): self
57
    {
58
        $this->site = $site;
59
60
        return $this;
61
    }
62
63
    public function getCode(): ?string
64
    {
65
        return $this->code;
66
    }
67
68
    public function setCode(string $code): self
69
    {
70
        $this->code = $code;
71
72
        return $this;
73
    }
74
75
    /**
76
     * @return Collection|Video[]
77
     */
78
    public function getVideo(): Collection
79
    {
80
        return $this->video;
81
    }
82
83
    public function addVideo(Video $video): self
84
    {
85
        if (!$this->video->contains($video)) {
86
            $this->video[] = $video;
87
            $video->setVideoType($this);
88
        }
89
90
        return $this;
91
    }
92
93
    public function removeVideo(Video $video): self
94
    {
95
        if ($this->video->contains($video)) {
96
            $this->video->removeElement($video);
97
            // set the owning side to null (unless already changed)
98
            if ($video->getVideoType() === $this) {
99
                $video->setVideoType(null);
100
            }
101
        }
102
103
        return $this;
104
    }
105
106
    public function getImageCode(): ?string
107
    {
108
        return $this->imageCode;
109
    }
110
111
    public function setImageCode(?string $imageCode): self
112
    {
113
        $this->imageCode = $imageCode;
114
115
        return $this;
116
    }
117
118
    public function __toString()
119
    {
120
        return $this->getSite();
121
    }
122
}
123