ReflectionPool   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 5
Bugs 4 Features 0
Metric Value
wmc 3
c 5
b 4
f 0
lcom 1
cbo 0
dl 0
loc 22
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getInstance() 0 10 3
1
<?php
2
3
namespace PEIP\Util;
4
5
/*
6
 * To change this template, choose Tools | Templates
7
 * and open the template in the editor.
8
 */
9
10
/**
11
 * Description of ReflectionPool.
12
 *
13
 * @author timo
14
 */
15
class ReflectionPool
16
{
17
    protected static $instances = [];
18
19
    /**
20
     * Constructs a ReflectionClass.
21
     *
22
     * @param $argument
23
     *
24
     * @return ReflectionClass
25
     */
26
    public static function getInstance($argument)
27
    {
28
        $className = is_object($argument)
29
            ? get_class($argument)
30
            : (string) $argument;
31
32
        return isset(self::$instances[$className])
33
            ? self::$instances[$className]
34
            : self::$instances[$className] = new \ReflectionClass($className);
35
    }
36
}
37