GetMethodIfExists   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 11
ccs 2
cts 4
cp 0.5
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A get() 0 4 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