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

MethodInvocationProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 24
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A set() 0 4 1
A get() 0 8 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