Passed
Pull Request — master (#1)
by Korotkov
01:49
created

Computer::getRam()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Date: 23.03.18
4
 * Time: 12:56
5
 *
6
 * @author    : Korotkov Danila <[email protected]>
7
 * @copyright Copyright (c) 2018, Korotkov Danila
8
 * @license   http://www.gnu.org/licenses/gpl.html GNU GPLv3.0
9
 */
10
11
namespace Creational\Builder;
12
13
14
/**
15
 * Class Computer
16
 * @package Creational\Builder
17
 */
18
/**
19
 * Class Computer
20
 * @package Creational\Builder
21
 */
22
class Computer
23
{
24
25
    /**
26
     * @var string
27
     */
28
    protected $software;
29
    /**
30
     * @var int
31
     */
32
    protected $hdd = 500;
33
    /**
34
     * @var int
35
     */
36
    protected $ram = 4096;
37
    /**
38
     * @var int
39
     */
40
    protected $gpu = 2048;
41
    /**
42
     * @var int
43
     */
44
    protected $cpu = 2000;
45
46
    /**
47
     * Computer constructor.
48
     * @param string $software
49
     */
50
    public function __construct(string $software)
51
    {
52
        $this->software = $software;
53
    }
54
55
    /**
56
     * @param null $key
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $key is correct as it would always require null to be passed?
Loading history...
57
     * @return $this
58
     */
59
    public function increaseHdd($key = null)
60
    {
61
        $this->hdd = isset($key) ? $this->hdd * $key : $this->hdd + 500;
62
        return $this;
63
    }
64
65
    /**
66
     * @param null $key
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $key is correct as it would always require null to be passed?
Loading history...
67
     * @return $this
68
     */
69
    public function increaseRam($key = null)
70
    {
71
        $this->ram = isset($key) ? $this->ram * $key : $this->ram + 4096;
72
        return $this;
73
    }
74
75
    /**
76
     * @param null $key
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $key is correct as it would always require null to be passed?
Loading history...
77
     * @return $this
78
     */
79
    public function overclockGpu($key = null)
80
    {
81
        $this->gpu = isset($key) ? $this->gpu * $key : $this->gpu + 1024;
82
        return $this;
83
    }
84
85
    /**
86
     * @param null $key
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $key is correct as it would always require null to be passed?
Loading history...
87
     * @return $this
88
     */
89
    public function overclockCpu($key = null)
90
    {
91
        $this->cpu = isset($key) ? $this->cpu + $key : $this->cpu + 500;
92
        return $this;
93
    }
94
95
    /**
96
     * @param string $software
97
     * @return $this
98
     */
99
    public function changeSoftware(string $software)
100
    {
101
        $this->software = $software;
102
        return $this;
103
    }
104
105
    /**
106
     * @return mixed
107
     */
108
    public function getSoftware(): string
109
    {
110
        return $this->software;
111
    }
112
113
    /**
114
     * @return int
115
     */
116
    public function getHdd(): int
117
    {
118
        return $this->hdd;
119
    }
120
121
    /**
122
     * @return int
123
     */
124
    public function getRam(): int
125
    {
126
        return $this->ram;
127
    }
128
129
    /**
130
     * @return int
131
     */
132
    public function getGpu(): int
133
    {
134
        return $this->gpu;
135
    }
136
137
    /**
138
     * @return int
139
     */
140
    public function getCpu(): int
141
    {
142
        return $this->cpu;
143
    }
144
}
145