Completed
Push — v2 ( e6c7b3...40717e )
by Beñat
06:35
created

BadgeCount::setGold()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 2
Metric Value
c 3
b 0
f 2
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\Model;
13
14
/**
15
 * Class badge count model class.
16
 *
17
 * @author Beñat Espiña <[email protected]>
18
 */
19
class BadgeCount implements Model
20
{
21
    protected $bronze;
22
    protected $gold;
23
    protected $silver;
24
25
    public static function fromJson(array $data)
26
    {
27
        $instance = new self();
28
        $instance
29
            ->setBronze(array_key_exists('bronze', $data) ? $data['bronze'] : null)
30
            ->setGold(array_key_exists('gold', $data) ? $data['gold'] : null)
31
            ->setSilver(array_key_exists('silver', $data) ? $data['silver'] : null);
32
33
        return $instance;
34
    }
35
36
    public static function fromProperties($bronze, $gold, $silver)
37
    {
38
        $instance = new self();
39
        $instance
40
            ->setBronze($bronze)
41
            ->setGold($gold)
42
            ->setSilver($silver);
43
44
        return $instance;
45
    }
46
47
    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...
48
    {
49
        return $this->bronze;
50
    }
51
52
    public function setBronze($bronze)
53
    {
54
        $this->bronze = $bronze;
55
56
        return $this;
57
    }
58
59
    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...
60
    {
61
        return $this->gold;
62
    }
63
64
    public function setGold($gold)
65
    {
66
        $this->gold = $gold;
67
68
        return $this;
69
    }
70
71
    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...
72
    {
73
        return $this->silver;
74
    }
75
76
    public function setSilver($silver)
77
    {
78
        $this->silver = $silver;
79
80
        return $this;
81
    }
82
}
83