Passed
Push — fix_coverage_in_scrutinizer ( cd0379...a04ba4 )
by Herberto
13:22
created

Tag::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
/*
4
 * This file is part of the Symfony package.
5
 *
6
 * (c) Fabien Potencier <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace App\Entity;
13
14
use Doctrine\ORM\Mapping as ORM;
15
16
/**
17
 * @ORM\Entity()
18
 * @ORM\Table(name="symfony_demo_tag")
19
 *
20
 * Defines the properties of the Tag entity to represent the post tags.
21
 *
22
 * See https://symfony.com/doc/current/book/doctrine.html#creating-an-entity-class
23
 *
24
 * @author Yonel Ceruto <[email protected]>
25
 */
26
class Tag implements \JsonSerializable
27
{
28
    /**
29
     * @var int
30
     *
31
     * @ORM\Id
32
     * @ORM\GeneratedValue
33
     * @ORM\Column(type="integer")
34
     */
35
    private $id;
36
37
    /**
38
     * @var string
39
     *
40
     * @ORM\Column(type="string", unique=true)
41
     */
42
    private $name;
43
44
    public function getId(): int
45
    {
46
        return $this->id;
47
    }
48
49 6
    public function setName(string $name): void
50
    {
51 6
        $this->name = $name;
52 6
    }
53
54 9
    public function getName(): string
55
    {
56 9
        return $this->name;
57
    }
58
59
    /**
60
     * {@inheritdoc}
61
     */
62 2
    public function jsonSerialize(): string
63
    {
64
        // This entity implements JsonSerializable (http://php.net/manual/en/class.jsonserializable.php)
65
        // so this method is used to customize its JSON representation when json_encode()
66
        // is called, for example in tags|json_encode (app/Resources/views/form/fields.html.twig)
67
68 2
        return $this->name;
69
    }
70
71 3
    public function __toString(): string
72
    {
73 3
        return $this->name;
74
    }
75
}
76