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

Badge::getData()   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
namespace LoginCidadao\BadgesControlBundle\Model;
4
5
use JMS\Serializer\Annotation as JMS;
6
7
/**
8
 * Class Badge
9
 * @package LoginCidadao\BadgesControlBundle\Model
10
 *
11
 * @JMS\ExclusionPolicy("all")
12
 */
13
class Badge implements BadgeInterface
14
{
15
16
    protected $namespace;
17
    protected $name;
18
    protected $data;
19
20 1
    public function __construct($namespace, $name, $data = null)
21
    {
22 1
        $this->namespace = $namespace;
23 1
        $this->name = $name;
24 1
        $this->data = $data;
25 1
    }
26
27
    /**
28
     * @JMS\Groups({"public_profile"})
29
     * @JMS\VirtualProperty
30
     * @JMS\SerializedName("data")
31
     * @return mixed
32
     */
33 1
    public function getData()
34
    {
35 1
        return $this->data;
36
    }
37
38
    /**
39
     * @JMS\Groups({"public_profile"})
40
     * @JMS\VirtualProperty
41
     * @JMS\SerializedName("name")
42
     * @return string
43
     */
44 1
    public function getName()
45
    {
46 1
        return $this->name;
47
    }
48
49
    /**
50
     * @JMS\Groups({"public_profile"})
51
     * @JMS\VirtualProperty
52
     * @JMS\SerializedName("namespace")
53
     * @return string
54
     */
55 1
    public function getNamespace()
56
    {
57 1
        return $this->namespace;
58
    }
59
60
    /**
61
     * @inheritDoc
62
     */
63
    public function __toString(): string
64
    {
65
        return "{$this->getNamespace()}.{$this->getName()}={$this->getData()}";
66
    }
67
68
69
}
70