Completed
Push — invocation_parames ( 11b866 )
by Akihito
03:03
created

MethodInvocationProvider::get()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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