Color   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 119
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

10 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 4 1
A getRed() 0 4 1
A setRed() 0 6 1
A getGreen() 0 4 1
A setGreen() 0 6 1
A getBlue() 0 4 1
A setBlue() 0 6 1
A getAlpha() 0 4 1
A setAlpha() 0 6 1
A toArray() 0 9 1
1
<?php
2
3
namespace NotificationChannels\Fcm\Resources;
4
5
class Color implements FcmResource
6
{
7
    /**
8
     * @var float|null
9
     */
10
    protected $red;
11
12
    /**
13
     * @var float|null
14
     */
15
    protected $green;
16
17
    /**
18
     * @var float|null
19
     */
20
    protected $blue;
21
22
    /**
23
     * @var float|null
24
     */
25
    protected $alpha;
26
27
    /**
28
     * @return static
29
     */
30
    public static function create(): self
31
    {
32
        return new self;
33
    }
34
35
    /**
36
     * @return float|null
37
     */
38
    public function getRed(): ?float
39
    {
40
        return $this->red;
41
    }
42
43
    /**
44
     * @param float|null $red
45
     * @return Color
46
     */
47
    public function setRed(?float $red): self
48
    {
49
        $this->red = $red;
50
51
        return $this;
52
    }
53
54
    /**
55
     * @return float|null
56
     */
57
    public function getGreen(): ?float
58
    {
59
        return $this->green;
60
    }
61
62
    /**
63
     * @param float|null $green
64
     * @return Color
65
     */
66
    public function setGreen(?float $green): self
67
    {
68
        $this->green = $green;
69
70
        return $this;
71
    }
72
73
    /**
74
     * @return float|null
75
     */
76
    public function getBlue(): ?float
77
    {
78
        return $this->blue;
79
    }
80
81
    /**
82
     * @param float|null $blue
83
     * @return Color
84
     */
85
    public function setBlue(?float $blue): self
86
    {
87
        $this->blue = $blue;
88
89
        return $this;
90
    }
91
92
    /**
93
     * @return float|null
94
     */
95
    public function getAlpha(): ?float
96
    {
97
        return $this->alpha;
98
    }
99
100
    /**
101
     * @param float|null $alpha
102
     * @return Color
103
     */
104
    public function setAlpha(?float $alpha): self
105
    {
106
        $this->alpha = $alpha;
107
108
        return $this;
109
    }
110
111
    /**
112
     * {@inheritdoc}
113
     */
114
    public function toArray(): array
115
    {
116
        return [
117
            'red' => $this->getRed(),
118
            'green' => $this->getGreen(),
119
            'blue' => $this->getBlue(),
120
            'alpha' => $this->getAlpha(),
121
        ];
122
    }
123
}
124