Completed
Push — spike ( 2414ba )
by Akihito
06:23
created

MethodInvocationProvider::set()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
/**
5
 * This file is part of the Ray.Di package.
6
 *
7
 * @license http://opensource.org/licenses/MIT MIT
8
 */
9
namespace Ray\Di;
10
11
use Ray\Aop\MethodInvocation;
12
use Ray\Di\Exception\MethodInvocationNotAvailable;
13
14
class MethodInvocationProvider implements ProviderInterface
15
{
16
    /**
17
     * @var MethodInvocation|null
18
     */
19
    private $invocation;
20
21
    public function set(MethodInvocation $invocation)
22
    {
23
        $this->invocation = $invocation;
24
    }
25
26
    /**
27
     * @return MethodInvocation
28
     */
29
    public function get() : MethodInvocation
30
    {
31
        if ($this->invocation === null) {
32
            throw new MethodInvocationNotAvailable;
33
        }
34
35
        return $this->invocation;
36
    }
37
}
38