Completed
Pull Request — master (#1)
by Karsten
03:23
created

EntityConfig::warmUp()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 16
ccs 7
cts 7
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 0
crap 2
1
<?php
2
/**
3
 * File was created 10.10.2015 18:11
4
 */
5
6
namespace PeekAndPoke\Component\Slumber\Core\LookUp;
7
8
use PeekAndPoke\Component\Creator\Creator;
9
use PeekAndPoke\Component\Slumber\Annotation\ClassMarker;
10
11
/**
12
 * @author Karsten J. Gerber <[email protected]>
13
 */
14
class EntityConfig
15
{
16
    /** @var string */
17
    protected $className;
18
    /** @var Creator */
19
    protected $creator;
20
    /** @var ClassMarker[] */
21
    protected $markersOnClass;
22
    /** @var PropertyMarkedForSlumber[] */
23
    protected $markedProperties;
24
25
    /**
26
     * @param string                     $className
27
     * @param Creator                    $creator
28
     * @param ClassMarker[]              $markersOnClass
29
     * @param PropertyMarkedForSlumber[] $markedProperties
30
     */
31 6
    public function __construct($className, Creator $creator, $markersOnClass, $markedProperties)
32
    {
33 6
        $this->className        = $className;
34 6
        $this->creator          = $creator;
35 6
        $this->markersOnClass   = $markersOnClass;
36 6
        $this->markedProperties = $markedProperties;
37 6
    }
38
39
    /**
40
     * @return string
41
     */
42 1
    public function getClassName()
43
    {
44 1
        return $this->className;
45
    }
46
47
    /**
48
     * @return Creator
49
     */
50 19
    public function getCreator()
51
    {
52 19
        return $this->creator;
53
    }
54
55
    /**
56
     * @return ClassMarker[]
57
     */
58 1
    public function getMarkersOnClass()
59
    {
60 1
        return $this->markersOnClass;
61
    }
62
63
    /**
64
     * @return PropertyMarkedForSlumber[]
65
     */
66 26
    public function getMarkedProperties()
67
    {
68 26
        return $this->markedProperties;
69
    }
70
71
    /**
72
     * @param string $name
73
     *
74
     * @return null|PropertyMarkedForSlumber
75
     */
76
    public function getMarkedPropertyByName($name)
77
    {
78
        foreach ($this->markedProperties as $property) {
79
            if ($property->name === $name) {
80
                return $property;
81
            }
82
        }
83
84
        return null;
85
    }
86
}
87