| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 3 |
| CRAP Score | 2.5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | 32 | public static function getMetadataFactory($serializer) |
|
| 17 | { |
||
| 18 | 32 | if (method_exists($serializer, "getMetadataFactory")) { |
|
| 19 | // JMS Serializer 1.x |
||
| 20 | 32 | return $serializer->getMetadataFactory(); |
|
| 21 | } else { |
||
| 22 | // JMS Serializer 2.x & 3.x |
||
| 23 | $reflectionProperty = new \ReflectionProperty(get_class($serializer), 'factory'); |
||
| 24 | $reflectionProperty->setAccessible(true); |
||
| 25 | return $reflectionProperty->getValue($serializer); |
||
| 26 | } |
||
| 27 | } |
||
| 28 | } |