Completed
Push — master ( ed059a...0f6c49 )
by Karsten
02:43
created

ClassAnnotationValidationContext   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 60%

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 42
c 0
b 0
f 0
rs 10
ccs 6
cts 10
cp 0.6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getProvider() 0 3 1
A getAnnotationLocation() 0 3 1
A __invoke() 0 3 1
A __construct() 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 ClassAnnotationValidationContext implements ValidationContext, BinaryFunction
16
{
17
    /** @var ContainerInterface */
18
    public $provider;
19
    /** @var \ReflectionClass */
20
    public $cls;
21
22
    /**
23
     * @param ContainerInterface $provider
24
     * @param \ReflectionClass   $cls
25
     */
26 38
    public function __construct(ContainerInterface $provider, \ReflectionClass $cls)
27
    {
28 38
        $this->provider = $provider;
29 38
        $this->cls      = $cls;
30 38
    }
31
32
    /**
33
     * @return ContainerInterface
34
     */
35
    public function getProvider()
36
    {
37
        return $this->provider;
38
    }
39
40
    /**
41
     * @return string
42
     */
43
    public function getAnnotationLocation()
44
    {
45
        return $this->cls->name;
46
    }
47
48
    /**
49
     * @param SlumberMarker $marker
50
     * @param int           $idx
51
     *
52
     * @return void
53
     */
54 4
    public function __invoke($marker, $idx)
55
    {
56 4
        $marker->validate($this);
57 4
    }
58
}
59