Completed
Push — master ( 3c68a7...9aacf2 )
by Pieter
11:31
created

ReflectionExtractorFactory::create()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 8
rs 10
1
<?php
2
3
namespace W2w\Lib\Apie\Plugins\Core\PropertyInfo;
4
5
use ReflectionMethod;
6
use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor as SymfonyReflectionExtractor;
7
8
class ReflectionExtractorFactory
9
{
10
    public static function create(): SymfonyReflectionExtractor
11
    {
12
        $method = new ReflectionMethod(SymfonyReflectionExtractor::class, 'isReadable');
13
        $type = $method->getReturnType();
14
        if (null === $type) {
15
            return new ReflectionExtractorSerializer4();
16
        }
17
        return new ReflectionExtractor();
18
    }
19
}
20