1 | <?php namespace BuildR\TestTools\DataSetLoader\XML\StaticType; |
||
26 | class SimpleXMLNodeTypedAttributeGetter { |
||
27 | |||
28 | /** |
||
29 | * List of available casters |
||
30 | * |
||
31 | * @type array |
||
32 | */ |
||
33 | private $casters = [ |
||
34 | 'string' => StringCaster::class, |
||
35 | 'int|integer' => IntCaster::class, |
||
36 | 'bool|boolean' => BoolCaster::class, |
||
37 | 'float|double' => FloatCaster::class, |
||
38 | 'array' => ArrayCaster::class, |
||
39 | ]; |
||
40 | |||
41 | /** |
||
42 | * @type \SimpleXMLElement |
||
43 | */ |
||
44 | private $element; |
||
45 | |||
46 | /** |
||
47 | * SimpleXMLNodeTypedAttributeGetter constructor. |
||
48 | * This is the standard definition <dataSetProperty /> nodes. |
||
49 | * |
||
50 | * @param \SimpleXMLElement $element |
||
51 | */ |
||
52 | 4 | public function __construct(SimpleXMLElement $element) { |
|
55 | |||
56 | /** |
||
57 | * Post-processing the node value by additionally specified type |
||
58 | * declaration. If no type is defined, values returned as string. |
||
59 | * |
||
60 | * @return bool|float|int|string |
||
61 | */ |
||
62 | 4 | public function getValue() { |
|
73 | |||
74 | /** |
||
75 | * Resolve the correct caster class by defined type |
||
76 | * |
||
77 | * @param string $type |
||
78 | * |
||
79 | * @return string |
||
80 | * @throws \BuildR\TestTools\Exception\CasterException |
||
81 | */ |
||
82 | 4 | private function resolveCasterClassName($type) { |
|
95 | |||
96 | /** |
||
97 | * Returns the node name. If the node not defines 'name' |
||
98 | * attribute an empty string will be returned. |
||
99 | * |
||
100 | * @return string |
||
101 | */ |
||
102 | 3 | public function getName() { |
|
105 | |||
106 | } |
||
107 |