TeamLead::writeCode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 2
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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