Passed
Pull Request — master (#14)
by Korotkov
01:41
created

Adapter   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
c 0
b 0
f 0
dl 0
loc 64
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getSecond() 0 3 1
A setFirst() 0 3 1
A getFirst() 0 3 1
A setSecond() 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 Structural\Adapter;
11
12
final class Adapter implements RegistryInterface
13
{
14
    private AnotherRegistryInterface $registry;
15
16
    /**
17
     * Sets a different registry type
18
     * ------------------------------
19
     * Устанавливает другой тип реестра
20
     *
21
     * @param  AnotherRegistryInterface $registry
22
     */
23
    public function __construct(AnotherRegistryInterface $registry)
24
    {
25
        $this->registry = $registry;
26
    }
27
28
    /**
29
     * Sets the first value
30
     * --------------------
31
     * Устанавливает первое значение
32
     *
33
     * @param  string $value
34
     * @return void
35
     */
36
    public function setFirst(string $value)
37
    {
38
        $this->registry->setData($value);
39
    }
40
41
    /**
42
     * Sets the second value
43
     * ---------------------
44
     * Устанавливает второе значение
45
     *
46
     * @param  string $value
47
     * @return void
48
     */
49
    public function setSecond(string $value)
50
    {
51
        $this->registry->setData($value);
52
    }
53
54
    /**
55
     * Gets the first value
56
     * --------------------
57
     * Получает первое значение
58
     *
59
     * @return string
60
     */
61
    public function getFirst(): string
62
    {
63
        return (string) $this->registry->getData()[0];
64
    }
65
66
    /**
67
     * Gets the second value
68
     * ---------------------
69
     * Получает второе значение
70
     *
71
     * @return string
72
     */
73
    public function getSecond(): string
74
    {
75
        return (string) $this->registry->getData()[1];
76
    }
77
}
78