Completed
Push — master ( 6d6774...64f3ed )
by Jeroen
11:23 queued 05:13
created

AbstractTag::setLocale()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Kunstmaan\ArticleBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Gedmo\Mapping\Annotation as Gedmo;
7
use Gedmo\Translatable\Translatable;
8
use Kunstmaan\AdminBundle\Entity\AbstractEntity;
9
use Symfony\Component\Validator\Constraints as Assert;
10
11 View Code Duplication
class AbstractTag extends AbstractEntity implements Translatable
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
{
13
    /**
14
     * AbstractTag constructor.
15
     */
16
    public function __construct()
17
    {
18
        if (\get_class($this) === AbstractTag::class) {
19
            @trigger_error(sprintf('Instantiating the "%s" class is deprecated in KunstmaanArticleBundle 5.1 and will be made abstract in KunstmaanArticleBundle 6.0. Extend your implementation from this class instead.', __CLASS__), E_USER_DEPRECATED);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
20
        }
21
    }
22
23
    /**
24
     * @var string
25
     *
26
     * @ORM\Column(name="name", type="string", length=255)
27
     * @Assert\NotBlank()
28
     * @Gedmo\Translatable
29
     */
30
    protected $name;
31
32
    /**
33
     * @Gedmo\Locale
34
     */
35
    protected $locale;
36
37
    /**
38
     * @var \DateTime
39
     *
40
     * @ORM\Column(name="deleted_at", type="datetime", nullable=true)
41
     */
42
    protected $deletedAt;
43
44
    /**
45
     * Set name
46
     *
47
     * @param string $name
48
     */
49
    public function setName($name)
50
    {
51
        $this->name = $name;
52
    }
53
54
    /**
55
     * Get name
56
     *
57
     * @return string
58
     */
59
    public function getName()
60
    {
61
        return $this->name;
62
    }
63
64
    /**
65
     * @return mixed
66
     */
67
    public function getLocale()
68
    {
69
        return $this->locale;
70
    }
71
72
    /**
73
     * @param mixed $locale
74
     */
75
    public function setLocale($locale)
76
    {
77
        $this->locale = $locale;
78
    }
79
80
    /**
81
     * @return \DateTime
82
     */
83
    public function getDeletedAt()
84
    {
85
        return $this->deletedAt;
86
    }
87
88
    /**
89
     * @param \DateTime $deletedAt
90
     */
91
    public function setDeletedAt($deletedAt)
92
    {
93
        $this->deletedAt = $deletedAt;
94
    }
95
96
    /**
97
     * @return string
98
     */
99
    public function __toString()
100
    {
101
        return $this->getName();
102
    }
103
}
104