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

ClassAnnotationValidationContext::getProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 3
c 0
b 0
f 0
rs 10
ccs 0
cts 2
cp 0
cc 1
eloc 1
nc 1
nop 0
crap 2
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