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

NewReflectionMethod   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 14
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 8 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