Completed
Push — 2.x ( e1da9c...c98d72 )
by Akihito
02:48
created

NewReflectionMethod::__invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ray\Di;
6
7
use Ray\Di\Exception\NotFound;
8
9
final class NewReflectionMethod
10
{
11
    /**
12
     * @throws \ReflectionException
13
     */
14
    public function __invoke($object, string $method) : \ReflectionMethod
15
    {
16
        if (! method_exists($object, $method)) {
17
            throw new NotFound(sprintf('%s::%s', get_class($object), $method));
18
        }
19
20
        return new \ReflectionMethod($object, $method);
21
    }
22
}
23