TeamLead   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 1
Metric Value
eloc 5
c 3
b 0
f 1
dl 0
loc 39
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A writeCode() 0 3 1
A delegateTo() 0 3 1
A getCodeFromDeveloper() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @author  : Jagepard <[email protected]>
7
 * @license https://mit-license.org/ MIT
8
 */
9
10
namespace Fundamental\Delegation;
11
12
class TeamLead implements DeveloperInterface, DelegationInterface
13
{
14
    private DeveloperInterface $developer;
15
16
    /**
17
     * Delegates a task to another developer
18
     * -------------------------------------
19
     * Делегирует задачу другому разработчику
20
     * 
21
     * @param  DeveloperInterface $developer
22
     * @return void
23
     */
24
    public function delegateTo(DeveloperInterface $developer): void
25
    {
26
        $this->developer = $developer;
27
    }
28
29
    /**
30
     * Writes program code
31
     * -------------------
32
     * Пишет код программы
33
     * 
34
     * @return string
35
     */
36
    public function writeCode(): string
37
    {
38
        return (new Program("Some excellent code"))->getCode();
39
    }
40
41
    /**
42
     * Gets another developer's code
43
     * -----------------------------
44
     * Получает код другого разработчика
45
     * 
46
     * @return string
47
     */
48
    public function getCodeFromDeveloper(): string
49
    {
50
        return $this->developer->writeCode();
51
    }
52
}
53