SerializerUtils::getMetadataFactory()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
rs 10
c 2
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GoetasWebservices\SoapServices\Metadata;
6
7
use JMS\Serializer\Serializer;
8
use Metadata\MetadataFactory;
9
10
class SerializerUtils
11
{
12
    /**
13
     * Get metadata factory from serializer, with any JMS Serializer version.
14
     */
15
    public static function getMetadataFactory(Serializer $serializer): MetadataFactory
16
    {
17
        $reflectionProperty = new \ReflectionProperty(Serializer::class, 'factory');
18
        $reflectionProperty->setAccessible(true);
19
20
        return $reflectionProperty->getValue($serializer);
21
    }
22
}
23