Radio::setHitPagesUrls()   A
last analyzed

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 0
Metric Value
dl 0
loc 10
ccs 7
cts 7
cp 1
rs 9.4285
c 0
b 0
f 0
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
use Gedmo\Mapping\Annotation as Gedmo;
9
use Gedmo\Timestampable\Traits\TimestampableEntity;
10
11
/**
12
 * Radio.
13
 *
14
 * @ORM\Table()
15
 * @ORM\Entity
16
 * @UniqueEntity("name")
17
 */
18
class Radio
19
{
20
    use TimestampableEntity;
21
22
    /**
23
     * @var int
24
     *
25
     * @ORM\Column(name="id", type="integer")
26
     * @ORM\Id
27
     * @ORM\GeneratedValue(strategy="AUTO")
28
     */
29
    private $id;
30
31
    /**
32
     * @var string
33
     *
34
     * @ORM\Column(name="name", type="string", length=255, unique=true)
35
     */
36
    private $name;
37
38
    /**
39
     * @var string
40
     * @Gedmo\Slug(fields={"name"}, unique=true)
41
     * @ORM\Column(type="string", length=128, unique=true)
42
     */
43
    protected $slug;
44
45
    /**
46
     *
47
     * @todo refactor in favour of hitPagesUrls
48
     * @var ArrayCollection
49
     *
50
     * @ORM\Column(name="hitPages", type="json_array")
51
     */
52
    private $hitPagesUrls;
53
54 1
    public function __construct()
55
    {
56 1
        $this->hitPagesUrls = new ArrayCollection();
57 1
    }
58
59
    /**
60
     * Get id.
61
     *
62
     * @return int
63
     */
64 1
    public function getId()
65
    {
66 1
        return $this->id;
67
    }
68
69
    /**
70
     * Set name.
71
     *
72
     * @param string $name
73
     *
74
     * @return Radio
75
     */
76 1
    public function setName($name)
77
    {
78 1
        $this->name = $name;
79
80 1
        return $this;
81
    }
82
83
    /**
84
     * Get name.
85
     *
86
     * @return string
87
     */
88 1
    public function getName()
89
    {
90 1
        return $this->name;
91
    }
92
93
    /**
94
     * Set hitPages.
95
     *
96
     * @param array $hitPagesUrls
97
     *
98
     * @return Radio
99
     */
100 1
    public function setHitPagesUrls(array $hitPagesUrls)
101
    {
102 1
        foreach ($hitPagesUrls as $hitPage) {
103 1
            if (filter_var($hitPage, FILTER_VALIDATE_URL)) {
104 1
                $this->hitPagesUrls[] = $hitPage;
105 1
            }
106 1
        }
107
108 1
        return $this;
109
    }
110
111
    /**
112
     * Get hitPages.
113
     *
114
     * @return array
115
     */
116 1
    public function getHitPagesUrls()
117
    {
118 1
        return $this->hitPagesUrls;
119
    }
120
121
    /**
122
     * @return string
123
     */
124
    public function getSlug()
125
    {
126
        return $this->slug;
127
    }
128
}
129