Completed
Pull Request — master (#305)
by Guilherme
03:48
created

Badge::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of the login-cidadao project or it's bundles.
4
 *
5
 * (c) Guilherme Donato <guilhermednt on github>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace LoginCidadao\BadgesControlBundle\Model;
12
13
use JMS\Serializer\Annotation as JMS;
14
15
/**
16
 * Class Badge
17
 * @package LoginCidadao\BadgesControlBundle\Model
18
 *
19
 * @JMS\ExclusionPolicy("all")
20
 */
21
class Badge implements BadgeInterface
22
{
23
24
    protected $namespace;
25
    protected $name;
26
    protected $data;
27
28 2
    public function __construct($namespace, $name, $data = null)
29
    {
30 2
        $this->namespace = $namespace;
31 2
        $this->name = $name;
32 2
        $this->data = $data;
33 2
    }
34
35
    /**
36
     * @JMS\Groups({"public_profile"})
37
     * @JMS\VirtualProperty
38
     * @JMS\SerializedName("data")
39
     * @return mixed
40
     */
41 1
    public function getData()
42
    {
43 1
        return $this->data;
44
    }
45
46
    /**
47
     * @JMS\Groups({"public_profile"})
48
     * @JMS\VirtualProperty
49
     * @JMS\SerializedName("name")
50
     * @return string
51
     */
52 1
    public function getName()
53
    {
54 1
        return $this->name;
55
    }
56
57
    /**
58
     * @JMS\Groups({"public_profile"})
59
     * @JMS\VirtualProperty
60
     * @JMS\SerializedName("namespace")
61
     * @return string
62
     */
63 1
    public function getNamespace()
64
    {
65 1
        return $this->namespace;
66
    }
67
68
    /**
69
     * @inheritDoc
70
     */
71
    public function __toString(): string
72
    {
73
        return "{$this->getNamespace()}.{$this->getName()}={$this->getData()}";
74
    }
75
76
77
}
78