OnlyProtectedPropertyChanged   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __invoke() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Roave\BackwardCompatibility\DetectChanges\BCBreak\PropertyBased;
6
7
use Roave\BackwardCompatibility\Changes;
8
use Roave\BetterReflection\Reflection\ReflectionProperty;
9
10
final class OnlyProtectedPropertyChanged implements PropertyBased
11
{
12
    /** @var PropertyBased */
13
    private $propertyBased;
14
15
    public function __construct(PropertyBased $propertyBased)
16
    {
17
        $this->propertyBased = $propertyBased;
18
    }
19
20
    public function __invoke(ReflectionProperty $fromProperty, ReflectionProperty $toProperty) : Changes
21
    {
22
        if (! $fromProperty->isProtected()) {
23
            return Changes::empty();
24
        }
25
26
        return $this->propertyBased->__invoke($fromProperty, $toProperty);
27
    }
28
}
29