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

Badge   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 53
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getData() 0 3 1
A getName() 0 3 1
A getNamespace() 0 3 1
A __construct() 0 5 1
A __toString() 0 3 1
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