Completed
Push — v3 ( d12fea )
by Beñat
05:39
created

AnemicBadgeCount::setSilver()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Stack Exchange Api Client library.
5
 *
6
 * Copyright (c) 2014-2016 Beñat Espiña <[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 BenatEspina\StackExchangeApiClient\Infrastructure\Domain\Model;
13
14
use BenatEspina\StackExchangeApiClient\Domain\Model\BadgeCount;
15
16
/**
17
 * The anemic implementation of badge count domain class.
18
 *
19
 * @author Beñat Espiña <[email protected]>
20
 */
21
class AnemicBadgeCount implements BadgeCount
22
{
23
    private $bronze;
24
    private $gold;
25
    private $silver;
26
27
    public static function fromJson($data)
28
    {
29
        return new self(
30
            array_key_exists('bronze', $data) ? $data['bronze'] : null,
31
            array_key_exists('gold', $data) ? $data['gold'] : null,
32
            array_key_exists('silver', $data) ? $data['silver'] : null
33
        );
34
    }
35
36
    public static function fromProperties($bronze, $gold, $silver)
37
    {
38
        return new self($bronze, $gold, $silver);
39
    }
40
41
    private function __construct($bronze = null, $gold = null, $silver = null)
42
    {
43
        $this->bronze = $bronze;
44
        $this->gold = $gold;
45
        $this->silver = $silver;
46
    }
47
48
    public function getBronze()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
49
    {
50
        return $this->bronze;
51
    }
52
53
    public function setBronze($bronze)
54
    {
55
        $this->bronze = $bronze;
56
57
        return $this;
58
    }
59
60
    public function getGold()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
61
    {
62
        return $this->gold;
63
    }
64
65
    public function setGold($gold)
66
    {
67
        $this->gold = $gold;
68
69
        return $this;
70
    }
71
72
    public function getSilver()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
73
    {
74
        return $this->silver;
75
    }
76
77
    public function setSilver($silver)
78
    {
79
        $this->silver = $silver;
80
81
        return $this;
82
    }
83
}
84