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

ProviderValuePromise::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
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