Completed
Pull Request — master (#38)
by Marco
03:08
created

AccessibleMethodChange   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 17
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A compare() 0 7 2
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Roave\ApiCompare\Comparator\BackwardsCompatibility\MethodBased;
6
7
use Roave\ApiCompare\Changes;
8
use Roave\BetterReflection\Reflection\ReflectionMethod;
9
10
/**
11
 * Performs a method BC compliance check on methods that are visible
12
 */
13
final class AccessibleMethodChange implements MethodBased
14
{
15
    /** @var MethodBased */
16
    private $check;
17
18
    public function __construct(MethodBased $check)
19
    {
20
        $this->check = $check;
21
    }
22
23
    public function compare(ReflectionMethod $fromMethod, ReflectionMethod $toMethod) : Changes
24
    {
25
        if ($fromMethod->isPrivate()) {
26
            return Changes::new();
27
        }
28
29
        return $this->check->compare($fromMethod, $toMethod);
30
    }
31
}
32