Desktop   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 2
eloc 4
c 3
b 0
f 1
dl 0
loc 27
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getComponent() 0 3 1
A __construct() 0 3 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