Completed
Push — master ( ea522c...375169 )
by Korotkov
04:17
created

DesktopBuilder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 26
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getComputer() 0 3 1
A addParam() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @author    : Korotkov Danila <[email protected]>
7
 * @license   https://mit-license.org/ MIT
8
 */
9
10
namespace Creational\Builder;
11
12
/**
13
 * Class ComputerBuilder
14
 * @package Creational\Builder
15
 */
16
class DesktopBuilder implements BuilderInterface
17
{
18
19
    /**
20
     * @var array
21
     */
22
    protected $params;
23
24
    /**
25
     * @param string $key
26
     * @param        $value
27
     * @return $this
28
     */
29
    public function addParam(string $key, $value): BuilderInterface
30
    {
31
        $this->params[$key] = $value;
32
33
        return $this;
34
    }
35
36
    /**
37
     * @return AbstractComputer
38
     */
39
    public function getComputer(): AbstractComputer
40
    {
41
        return new Desktop($this->params);
42
    }
43
}
44