1 | <?php |
||
8 | class PropertyParserToObject extends SimplePropertyParser |
||
9 | { |
||
10 | /** |
||
11 | * @var \Mcustiel\SimpleRequest\RequestBuilder |
||
12 | */ |
||
13 | private $requestBuilder; |
||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | private $type; |
||
18 | |||
19 | 4 | public function __construct($name, $type, RequestBuilder $requestBuilder) |
|
20 | { |
||
21 | 4 | parent::__construct($name); |
|
22 | 4 | $this->type = $type; |
|
23 | 4 | $this->requestBuilder = $requestBuilder; |
|
24 | 4 | } |
|
25 | |||
26 | /** |
||
27 | * {@inheritdoc} |
||
28 | * |
||
29 | * @see \Mcustiel\SimpleRequest\Strategies\Properties\SimplePropertyParser::parse() |
||
30 | */ |
||
31 | 4 | public function parse($propertyValue) |
|
40 | |||
41 | /** |
||
42 | * Parses the value as it is an instance of the class specified in type property. |
||
43 | * |
||
44 | * @param array|\stdClass $value The value to parse and convert to an object |
||
45 | * |
||
46 | * @throws \Mcustiel\SimpleRequest\Exception\InvalidAnnotationException |
||
47 | * |
||
48 | * @return object Parsed value as instance of class specified in type property |
||
49 | */ |
||
50 | 4 | private function createInstanceOfTypeFromValue($value) |
|
62 | } |
||
63 |