Completed
Push — master ( 554965...db72da )
by Joram van den
03:50
created

Ajde_Core_Autodebug   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 7
Bugs 0 Features 0
Metric Value
wmc 7
c 7
b 0
f 0
lcom 0
cbo 3
dl 0
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getInstance() 0 6 2
B __bootstrap() 0 14 5
1
<?php
2
3
class Ajde_Core_Autodebug extends Ajde_Object_Singleton
4
{
5
    public static function getInstance()
6
    {
7
        static $instance;
8
9
        return $instance === null ? $instance = new self : $instance;
10
    }
11
12
    static public function __bootstrap()
13
    {
14
        if (($user = Ajde_User::getLoggedIn()) && $user->getDebug()) {
0 ignored issues
show
Documentation Bug introduced by
The method getDebug does not exist on object<UserModel>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
15
            Config::set("app.debug", true);
16
17
            $htmlProcessors = config("layout.filters.documentProcessors.html");
18
            if (is_array($htmlProcessors) && !in_array('Debugger', $htmlProcessors)) {
19
                $htmlProcessors[] = "Debugger";
20
                Config::set("layout.filters.documentProcessors.html", $htmlProcessors);
21
            }
22
        }
23
24
        return true;
25
    }
26
}
27