GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

PropertyHandlers   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 2
dl 0
loc 44
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createHandler() 0 18 4
A getHandlerById() 0 12 3
1
<?php
2
3
namespace app\properties;
4
5
use app\properties\handlers\dummy\DummyHandler;
6
7
class PropertyHandlers
8
{
9
    static private $handlers = [];
10
11
    /**
12
     * @param \app\models\PropertyHandler $property_handler
13
     * @return handlers\AbstractHandler|DummyHandler
14
     */
15
    static public function createHandler(\app\models\PropertyHandler $property_handler)
16
    {
17
        if (!isset(static::$handlers[$property_handler->id])) {
18
            $handlerClass = $property_handler->handler_class_name;
19
20
            if (is_subclass_of($handlerClass, '\app\properties\handlers\AbstractHandler')) {
0 ignored issues
show
Bug introduced by
Due to PHP Bug #53727, is_subclass_of returns inconsistent results on some PHP versions for interfaces; you could instead use ReflectionClass::implementsInterface.
Loading history...
21
                /** @var $handler \app\properties\handlers\AbstractHandler */
22
                $handler = new $handlerClass($property_handler);
23
                static::$handlers[$property_handler->id] = $handler;
24
25
                return $handler;
26
            }
27
        } elseif (isset(static::$handlers[$property_handler->id])) {
28
            return static::$handlers[$property_handler->id];
29
        }
30
31
        return static::$handlers[$property_handler->id] = new DummyHandler($property_handler);
32
    }
33
34
    /**
35
     * @param null $id
36
     * @return null
37
     */
38
    static public function getHandlerById($id = null)
39
    {
40
        if (null === $id) {
41
            return null;
42
        }
43
44
        if (isset(static::$handlers[$id])) {
45
            return static::$handlers[$id];
46
        }
47
48
        return null;
49
    }
50
}
51
?>