Total Complexity | 8 |
Total Lines | 62 |
Duplicated Lines | 0 % |
Coverage | 64.29% |
Changes | 0 |
1 | <?php |
||
5 | class HydratorContext implements HydratorContextInterface |
||
6 | { |
||
7 | /** |
||
8 | * Class to hydrate |
||
9 | * @var string |
||
10 | */ |
||
11 | protected $class; |
||
12 | /** |
||
13 | * Properties |
||
14 | * @var array |
||
15 | */ |
||
16 | protected $properties = array(); |
||
17 | |||
18 | /** |
||
19 | * {@inheritDoc} |
||
20 | */ |
||
21 | public function getClass() |
||
22 | { |
||
23 | return $this->class; |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * Set Class |
||
28 | * |
||
29 | * @param string $class Class to hydrate |
||
30 | */ |
||
31 | 3 | public function setClass($class) |
|
32 | { |
||
33 | 3 | $this->class = $class; |
|
34 | 3 | } |
|
35 | |||
36 | /** |
||
37 | * Get Properties |
||
38 | * |
||
39 | * @return array |
||
40 | */ |
||
41 | public function getProperties() |
||
42 | { |
||
43 | return $this->properties; |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * {@inheritDoc} |
||
48 | */ |
||
49 | 3 | public function getProperty($name): ?PropertyMetadata |
|
50 | { |
||
51 | 3 | foreach ($this->properties as $property) { |
|
52 | 3 | if ($name === $property->getName() || $property->hasAlias($name)) { |
|
53 | 3 | return $property; |
|
54 | } |
||
55 | } |
||
56 | return null; |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * Adds a property |
||
61 | * |
||
62 | * @param PropertyMetadata $property Property Metadata |
||
63 | */ |
||
64 | 3 | public function addProperty(PropertyMetadata $property) |
|
67 | 3 | } |
|
68 | } |
||
69 |