ReflectionObjectFactory::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 2
eloc 5
nc 2
nop 1
1
<?php
2
3
namespace DependencyInjection\Internal;
4
5
class ReflectionObjectFactory implements ReflectionFactoryInterface
6
{
7
    /**
8
     * @var \ReflectionObject
9
     */
10
    private $reflectionObject;
11
12
    public function __construct($object)
13
    {
14
        if (!is_object($object)) {
15
            throw Exception\ReflectionExceptionFactory::invalidArgument(
16
                sprintf("Parameter 1 of %s must be an object.", __METHOD__)
17
            );
18
        }
19
20
        $this->reflectionObject = new \ReflectionObject($object);
21
    }
22
23
    public static function create($object)
24
    {
25
        return new static($object);
26
    }
27
28
    public static function export($object, $return = false)
29
    {
30
        return \ReflectionObject::export($object, $return);
31
    }
32
33
    public function getReflector()
34
    {
35
        return $this->reflectionObject;
36
    }
37
}
38