Completed
Push — master ( 6ffec3...6f905d )
by Oleg
06:32
created

ProviderValuePromise   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 26
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A resolve() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace SlayerBirden\DFCodeGeneration\Generator\Tests;
5
6
class ProviderValuePromise
7
{
8
    /**
9
     * @var EntityProviderInterface
10
     */
11
    private $provider;
12
    /**
13
     * @var string
14
     */
15
    private $key;
16
17 3
    public function __construct(EntityProviderInterface $provider, string $key)
18
    {
19 3
        $this->provider = $provider;
20 3
        $this->key = $key;
21 3
    }
22
23
    /**
24
     * Return whatever was provided by the provider
25
     *
26
     * @return mixed
27
     */
28 3
    public function resolve()
29
    {
30 3
        $params = $this->provider->getParams();
31 3
        return $params[$this->key] ?? null;
32
    }
33
}
34