GetMethodIfExists::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 0
cts 1
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ProxyManager\ProxyGenerator\Util;
6
7
use ReflectionClass;
8
use ReflectionMethod;
9
10
/**
11
 * Internal utility class - allows fetching a method from a given class, if it exists
12
 */
13
final class GetMethodIfExists
14
{
15
    private function __construct()
16
    {
17
    }
18
19
    public static function get(ReflectionClass $class, string $method) : ?ReflectionMethod
20 2
    {
21
        return $class->hasMethod($method) ? $class->getMethod($method) : null;
22 2
    }
23
}
24