Desktop::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
/**
4
 * @author  : Jagepard <[email protected]>
5
 * @license https://mit-license.org/ MIT
6
 */
7
8
namespace Creational\Builder;
9
10
use Creational\Builder\{Hardware\AbstractPart, Interfaces\ComputerInterface};
11
12
class Desktop implements ComputerInterface
13
{
14
    private array $components = [];
15
16
    /**
17
     * Sets an element
18
     * ---------------------
19
     * Устанавливает элемент
20
     *
21
     * @param  array $part
22
     */
23
    public function __construct(array $part)
24
    {
25
        $this->components = $part;
26
    }
27
28
    /**
29
     * Gets an element
30
     * ----------------
31
     * Получает элемент
32
     *
33
     * @param  string       $part
34
     * @return AbstractPart
35
     */
36
    public function getComponent(string $part): AbstractPart
37
    {
38
        return $this->components[$part];
39
    }
40
}
41