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

EntityConfig   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 52.63%

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 1
dl 0
loc 73
ccs 10
cts 19
cp 0.5263
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getCreator() 0 4 1
A getMarkedProperties() 0 4 1
A getMarkedPropertyByName() 0 10 3
A getClassName() 0 4 1
A getMarkersOnClass() 0 4 1
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 24
    public function __construct($className, Creator $creator, $markersOnClass, $markedProperties)
32
    {
33 24
        $this->className        = $className;
34 24
        $this->creator          = $creator;
35 24
        $this->markersOnClass   = $markersOnClass;
36 24
        $this->markedProperties = $markedProperties;
37 24
    }
38
39
    /**
40
     * @return string
41
     */
42
    public function getClassName()
43
    {
44
        return $this->className;
45
    }
46
47
    /**
48
     * @return Creator
49
     */
50 12
    public function getCreator()
51
    {
52 12
        return $this->creator;
53
    }
54
55
    /**
56
     * @return ClassMarker[]
57
     */
58
    public function getMarkersOnClass()
59
    {
60
        return $this->markersOnClass;
61
    }
62
63
    /**
64
     * @return PropertyMarkedForSlumber[]
65
     */
66 23
    public function getMarkedProperties()
67
    {
68 23
        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