ReflectionPropertySetter::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Apie\ObjectAccessNormalizer\Setters;
4
5
use Apie\ObjectAccessNormalizer\TypeUtils;
6
use ReflectionProperty;
7
use Symfony\Component\PropertyInfo\Type;
8
9
class ReflectionPropertySetter implements SetterInterface
10
{
11
    /**
12
     * @var ReflectionProperty
13
     */
14
    private $property;
15
16
    public function __construct(ReflectionProperty $method)
17
    {
18
        $this->property = $method;
19
    }
20
21
    public function setValue($object, $newValue)
22
    {
23
        $this->property->setValue($object, $newValue);
24
    }
25
26
    public function getName(): string
27
    {
28
        return $this->property->getName();
29
    }
30
31
    public function getPriority(): int
32
    {
33
        return 3;
34
    }
35
36
    public function toType(): ?Type
37
    {
38
        return TypeUtils::convertPropertyToType($this->property);
39
    }
40
}
41