1 | <?php |
||
19 | final class StatementResultNormalizer extends Normalizer |
||
20 | { |
||
21 | /** |
||
22 | * {@inheritdoc} |
||
23 | */ |
||
24 | 2 | public function normalize($object, $format = null, array $context = array()) |
|
25 | { |
||
26 | 2 | if (!$object instanceof StatementResult) { |
|
27 | return null; |
||
28 | } |
||
29 | |||
30 | $data = array( |
||
31 | 2 | 'statements' => array(), |
|
32 | ); |
||
33 | |||
34 | 2 | foreach ($object->getStatements() as $statement) { |
|
35 | 2 | $data['statements'][] = $this->normalizeAttribute($statement, $format, $context); |
|
36 | } |
||
37 | |||
38 | 2 | if (null !== $moreUrlPath = $object->getMoreUrlPath()) { |
|
39 | 1 | $data['more'] = $moreUrlPath; |
|
40 | } |
||
41 | |||
42 | 2 | return $data; |
|
43 | } |
||
44 | |||
45 | /** |
||
46 | * {@inheritdoc} |
||
47 | */ |
||
48 | 9 | public function supportsNormalization($data, $format = null) |
|
52 | |||
53 | /** |
||
54 | * {@inheritdoc} |
||
55 | */ |
||
56 | 2 | public function denormalize($data, $class, $format = null, array $context = array()) |
|
62 | |||
63 | /** |
||
64 | * {@inheritdoc} |
||
65 | */ |
||
66 | 10 | public function supportsDenormalization($data, $type, $format = null) |
|
70 | } |
||
71 |