Completed
Branch master (29a47a)
by Christophe
04:01 queued 02:04
created

Radio::setHitPagesUrls()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
ccs 7
cts 7
cp 1
rs 9.4285
cc 3
eloc 5
nc 3
nop 1
crap 3
1
<?php
2
3
namespace AudioCoreEntity\Entity;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\ORM\Mapping as ORM;
7
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
8
9
/**
10
 * Radio.
11
 *
12
 * @ORM\Table()
13
 * @ORM\Entity
14
 * @UniqueEntity("name")
15
 */
16
class Radio
17
{
18
    /**
19
     * @var int
20
     *
21
     * @ORM\Column(name="id", type="integer")
22
     * @ORM\Id
23
     * @ORM\GeneratedValue(strategy="AUTO")
24
     */
25
    private $id;
26
27
    /**
28
     * @var string
29
     *
30
     * @ORM\Column(name="name", type="string", length=255, unique=true)
31
     */
32
    private $name;
33
34
    /**
35
     *
36
     * @todo refactor in favour of hitPagesUrls
37
     * @var ArrayCollection
38
     *
39
     * @ORM\Column(name="hitPages", type="json_array")
40
     */
41
    private $hitPagesUrls;
42
43 1
    public function __construct()
44
    {
45 1
        $this->hitPagesUrls = new ArrayCollection();
46 1
    }
47
48
    /**
49
     * Get id.
50
     *
51
     * @return int
52
     */
53 1
    public function getId()
54
    {
55 1
        return $this->id;
56
    }
57
58
    /**
59
     * Set name.
60
     *
61
     * @param string $name
62
     *
63
     * @return Radio
64
     */
65 1
    public function setName($name)
66
    {
67 1
        $this->name = $name;
68
69 1
        return $this;
70
    }
71
72
    /**
73
     * Get name.
74
     *
75
     * @return string
76
     */
77 1
    public function getName()
78
    {
79 1
        return $this->name;
80
    }
81
82
    /**
83
     * Set hitPages.
84
     *
85
     * @param array $hitPagesUrls
86
     *
87
     * @return Radio
88
     */
89 1
    public function setHitPagesUrls(array $hitPagesUrls)
90
    {
91 1
        foreach ($hitPagesUrls as $hitPage) {
92 1
            if (filter_var($hitPage, FILTER_VALIDATE_URL)) {
93 1
                $this->hitPagesUrls[] = $hitPage;
94 1
            }
95 1
        }
96
97 1
        return $this;
98
    }
99
100
    /**
101
     * Get hitPages.
102
     *
103
     * @return array
104
     */
105 1
    public function getHitPagesUrls()
106
    {
107 1
        return $this->hitPagesUrls;
108
    }
109
}
110