Completed
Push — phpstan-v0_10 ( 23135d...95cd93 )
by Akihito
03:14
created

MethodInvocationProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

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 4
    public function set(MethodInvocation $invocation)
22
    {
23 4
        $this->invocation = $invocation;
24 4
    }
25
26
    /**
27
     * @return MethodInvocation
28
     */
29 2
    public function get() : MethodInvocation
30
    {
31 2
        if ($this->invocation === null) {
32 1
            throw new MethodInvocationNotAvailable;
33
        }
34
35 1
        return $this->invocation;
36
    }
37
}
38