Completed
Push — master ( 88792f...ba8ac8 )
by Karsten
08:30 queued 06:31
created

PropertyAnnotationValidationContext   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 48
ccs 8
cts 12
cp 0.6667
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getProvider() 0 4 1
A getAnnotationLocation() 0 4 1
A __invoke() 0 4 1
1
<?php
2
/**
3
 * File was created 08.10.2015 18:17
4
 */
5
6
namespace PeekAndPoke\Component\Slumber\Core\Validation;
7
8
use PeekAndPoke\Component\Psi\BinaryFunction;
9
use PeekAndPoke\Component\Slumber\Annotation\SlumberMarker;
10
use Psr\Container\ContainerInterface;
11
12
/**
13
 * @author Karsten J. Gerber <[email protected]>
14
 */
15
class PropertyAnnotationValidationContext implements ValidationContext, BinaryFunction
16
{
17
    /** @var ContainerInterface */
18
    public $provider;
19
    /** @var \ReflectionClass */
20
    public $cls;
21
    /** @var \ReflectionProperty */
22
    public $property;
23
24
    /**
25
     * @param ContainerInterface  $provider
26
     * @param \ReflectionClass    $cls
27
     * @param \ReflectionProperty $property
28
     */
29 22
    public function __construct(ContainerInterface $provider, \ReflectionClass $cls, \ReflectionProperty $property)
30
    {
31 22
        $this->provider = $provider;
32 22
        $this->cls      = $cls;
33 22
        $this->property = $property;
34 22
    }
35
36
    /**
37
     * @return ContainerInterface
38
     */
39
    public function getProvider()
40
    {
41
        return $this->provider;
42
    }
43
44
    /**
45
     * @return string
46
     */
47
    public function getAnnotationLocation()
48
    {
49
        return $this->cls->name . '::$' . $this->property->getName();
50
    }
51
52
    /**
53
     * @param SlumberMarker $marker
54
     * @param int           $idx
55
     *
56
     * @return void
57
     */
58 22
    public function __invoke($marker, $idx)
59
    {
60 22
        $marker->validate($this);
61 22
    }
62
}
63