Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
38 | public function onPreSerialize(PreSerializeEvent $event) |
||
39 | { |
||
40 | /** @var object $object */ |
||
41 | $object = $event->getObject(); |
||
42 | |||
43 | if (!is_object($object)) { |
||
44 | return; |
||
45 | } |
||
46 | |||
47 | $type = $event->getType(); |
||
48 | $polymorphicTypes = array( |
||
49 | 'Xabbuh\XApi\Model\Actor', |
||
50 | 'Xabbuh\XApi\Model\Object', |
||
51 | ); |
||
52 | |||
53 | if (in_array($type['name'], $polymorphicTypes)) { |
||
54 | $event->setType(get_class($object)); |
||
55 | } |
||
56 | } |
||
57 | } |
||
58 |