Plugin   A
last analyzed

Complexity

Total Complexity 16

Size/Duplication

Total Lines 184
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 16
lcom 2
cbo 1
dl 0
loc 184
ccs 36
cts 36
cp 1
rs 10
c 2
b 0
f 0

15 Methods

Rating   Name   Duplication   Size   Complexity  
A getDateInstall() 0 4 1
A getTitle() 0 4 1
A getFilename() 0 4 2
A setLogo() 0 6 1
A getLogo() 0 4 1
A setDateInstall() 0 6 1
A getDownloadPath() 0 4 1
A getLogoWebPath() 0 4 1
A __construct() 0 4 1
A setName() 0 6 1
A getName() 0 4 1
A setTitle() 0 6 1
A setDescription() 0 6 1
A getDescription() 0 4 1
A setFilename() 0 5 1
1
<?php
2
/**
3
 * AnimeDb package.
4
 *
5
 * @author    Peter Gribanov <[email protected]>
6
 * @copyright Copyright (c) 2011, Peter Gribanov
7
 * @license   http://opensource.org/licenses/GPL-3.0 GPL v3
8
 */
9
namespace AnimeDb\Bundle\AppBundle\Entity;
10
11
use Doctrine\ORM\Mapping as ORM;
12
use Symfony\Component\Validator\Constraints as Assert;
13
use AnimeDb\Bundle\AppBundle\Service\Downloader\Entity\BaseEntity;
14
use AnimeDb\Bundle\AppBundle\Service\Downloader\Entity\ImageInterface;
15
16
/**
17
 * Installed plugin.
18
 *
19
 * @ORM\Entity
20
 * @ORM\Table(name="plugin")
21
 */
22
class Plugin extends BaseEntity implements ImageInterface
23
{
24
    /**
25
     * @ORM\Id
26
     * @ORM\Column(type="string")
27
     *
28
     * @var string
29
     */
30
    protected $name = '';
31
32
    /**
33
     * @ORM\Column(type="text")
34
     * @Assert\NotBlank()
35
     *
36
     * @var string
37
     */
38
    protected $title = '';
39
40
    /**
41
     * @ORM\Column(type="text")
42
     * @Assert\NotBlank()
43
     *
44
     * @var string
45
     */
46
    protected $description = '';
47
48
    /**
49
     * @ORM\Column(type="string", length=256, nullable=true)
50
     *
51
     * @var string
52
     */
53
    protected $logo = '';
54
55
    /**
56
     * @ORM\Column(type="datetime")
57
     * @Assert\DateTime()
58
     *
59
     * @var \DateTime
60
     */
61
    protected $date_install;
62
63 29
    public function __construct()
64
    {
65 29
        $this->date_install = new \DateTime();
66 29
    }
67
68
    /**
69
     * @param string $name
70
     *
71
     * @return Plugin
72
     */
73 7
    public function setName($name)
74
    {
75 7
        $this->name = $name;
76
77 7
        return $this;
78
    }
79
80
    /**
81
     * @return string
82
     */
83 7
    public function getName()
84
    {
85 7
        return $this->name;
86
    }
87
88
    /**
89
     * @param string $title
90
     *
91
     * @return Plugin
92
     */
93 5
    public function setTitle($title)
94
    {
95 5
        $this->title = $title;
96
97 5
        return $this;
98
    }
99
100
    /**
101
     * @return string
102
     */
103 5
    public function getTitle()
104
    {
105 5
        return $this->title;
106
    }
107
108
    /**
109
     * @param string $description
110
     *
111
     * @return Plugin
112
     */
113 5
    public function setDescription($description)
114
    {
115 5
        $this->description = $description;
116
117 5
        return $this;
118
    }
119
120
    /**
121
     * @return string
122
     */
123 5
    public function getDescription()
124
    {
125 5
        return $this->description;
126
    }
127
128
    /**
129
     * @param string $logo
130
     *
131
     * @return Plugin
132
     */
133 2
    public function setLogo($logo)
134
    {
135 2
        $this->setFilename($logo);
136
137 2
        return $this;
138
    }
139
140
    /**
141
     * @return string
142
     */
143 2
    public function getLogo()
144
    {
145 2
        return $this->getFilename();
146
    }
147
148
    /**
149
     * @return string
150
     */
151 3
    public function getFilename()
152
    {
153 3
        return $this->logo ?: parent::getFilename();
154
    }
155
156
    /**
157
     * @param string $filename
158
     */
159 3
    public function setFilename($filename)
160
    {
161 3
        $this->logo = $filename;
162 3
        parent::setFilename($filename);
163 3
    }
164
165
    /**
166
     * @param \DateTime $date_install
167
     *
168
     * @return Plugin
169
     */
170 1
    public function setDateInstall(\DateTime $date_install)
171
    {
172 1
        $this->date_install = $date_install;
173
174 1
        return $this;
175
    }
176
177
    /**
178
     * @return \DateTime
179
     */
180 1
    public function getDateInstall()
181
    {
182 1
        return $this->date_install;
183
    }
184
185
    /**
186
     * @return string
187
     */
188 2
    public function getDownloadPath()
189
    {
190 2
        return parent::getDownloadPath().'/plugin/'.$this->getName();
191
    }
192
193
    /**
194
     * Get logo web path.
195
     *
196
     * @deprecated use getWebPath()
197
     * @codeCoverageIgnore
198
     *
199
     * @return string
200
     */
201
    public function getLogoWebPath()
202
    {
203
        return $this->getWebPath();
204
    }
205
}
206