BadgeCount   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 11
lcom 1
cbo 0
dl 0
loc 64
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A fromJson() 0 10 4
A fromProperties() 0 10 1
A getBronze() 0 4 1
A setBronze() 0 6 1
A getGold() 0 4 1
A setGold() 0 6 1
A getSilver() 0 4 1
A setSilver() 0 6 1
1
<?php
2
3
/*
4
 * This file is part of the Stack Exchange Api Client library.
5
 *
6
 * (c) 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
declare(strict_types=1);
13
/*
14
 * This file is part of the Stack Exchange Api Client library.
15
 *
16
 * (c) Beñat Espiña <[email protected]>
17
 *
18
 * For the full copyright and license information, please view the LICENSE
19
 * file that was distributed with this source code.
20
 */
21
22
namespace BenatEspina\StackExchangeApiClient\Model;
23
24
/**
25
 * Class badge count model class.
26
 *
27
 * @author Beñat Espiña <[email protected]>
28
 */
29
class BadgeCount implements Model
30
{
31
    protected $bronze;
32
    protected $gold;
33
    protected $silver;
34
35
    public static function fromJson(array $data)
36
    {
37
        $instance = new self();
38
        $instance
39
            ->setBronze(array_key_exists('bronze', $data) ? $data['bronze'] : null)
40
            ->setGold(array_key_exists('gold', $data) ? $data['gold'] : null)
41
            ->setSilver(array_key_exists('silver', $data) ? $data['silver'] : null);
42
43
        return $instance;
44
    }
45
46
    public static function fromProperties($bronze, $gold, $silver)
47
    {
48
        $instance = new self();
49
        $instance
50
            ->setBronze($bronze)
51
            ->setGold($gold)
52
            ->setSilver($silver);
53
54
        return $instance;
55
    }
56
57
    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...
58
    {
59
        return $this->bronze;
60
    }
61
62
    public function setBronze($bronze)
63
    {
64
        $this->bronze = $bronze;
65
66
        return $this;
67
    }
68
69
    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...
70
    {
71
        return $this->gold;
72
    }
73
74
    public function setGold($gold)
75
    {
76
        $this->gold = $gold;
77
78
        return $this;
79
    }
80
81
    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...
82
    {
83
        return $this->silver;
84
    }
85
86
    public function setSilver($silver)
87
    {
88
        $this->silver = $silver;
89
90
        return $this;
91
    }
92
}
93