Passed
Push — master ( 7c6c7d...e6ca4a )
by Korotkov
02:20
created

Adapter   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 54
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getSecond() 0 3 1
A setFirst() 0 3 1
A __construct() 0 3 1
A getFirst() 0 3 1
A getRegistry() 0 3 1
A setSecond() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @author    : Korotkov Danila <[email protected]>
7
 * @license   https://mit-license.org/ MIT
8
 */
9
10
namespace Structural\Adapter;
11
12
/**
13
 * Class RegistryAdapter
14
 * @package Structural\Adapter
15
 */
16
final class Adapter implements RegistryInterface
17
{
18
    /**
19
     * @var AnotherRegistryInterface
20
     */
21
    private $registry;
22
23
    /**
24
     * RegistryAdapter constructor.
25
     * @param AnotherRegistryInterface $registry
26
     */
27
    public function __construct(AnotherRegistryInterface $registry)
28
    {
29
        $this->registry = $registry;
30
    }
31
32
    /**
33
     * @param string $value
34
     */
35
    public function setFirst(string $value)
36
    {
37
        $this->getRegistry()->setData($value);
38
    }
39
40
    /**
41
     * @param string $value
42
     */
43
    public function setSecond(string $value)
44
    {
45
        $this->getRegistry()->setData($value);
46
    }
47
48
    /**
49
     * @return string
50
     */
51
    public function getFirst(): string
52
    {
53
        return (string) $this->getRegistry()->getData()[0];
54
    }
55
56
    /**
57
     * @return string
58
     */
59
    public function getSecond(): string
60
    {
61
        return (string) $this->getRegistry()->getData()[1];
62
    }
63
64
    /**
65
     * @return AnotherRegistryInterface
66
     */
67
    public function getRegistry(): AnotherRegistryInterface
68
    {
69
        return $this->registry;
70
    }
71
}
72