Completed
Push — master ( ffee62...1450e2 )
by Andrey
03:08
created

Application::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 6
Bugs 0 Features 0
Metric Value
c 6
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace humanity;
3
4
class Application {
5
6
    private static $memory = [];
0 ignored issues
show
Unused Code introduced by
The property $memory is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
7
    private static $config;
8
    private static $application = [];
9
10
    public function __construct(){
11
        self::$config = (new Config)->get();
12
    }
13
14
    public function __get($name){
15
        array_push(self::$application,$name);
16
        return (new self);
17
    }
18
19
    public function __call($name,$value){
20
        array_push(self::$application,$name);
21
        $file = implode('/',self::$application);
22
        $file = self::$config['core']['apps'].'/'.$file.'.php';
23
        self::$application = [];
24
        if(is_file($file)) {
25
            $result = require($file);
26
            if(is_callable($result)) $result = call_user_func_array($result,$value);
27
            return $result;
28
        }
29
    }
30
31
}
32
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
33