1 | <?php |
||
11 | */ |
||
12 | class App { |
||
13 | |||
14 | /** |
||
15 | * static instance |
||
16 | * |
||
17 | * @var App |
||
18 | */ |
||
19 | public static $cur = null; |
||
20 | |||
21 | /** |
||
22 | * @var App |
||
23 | */ |
||
24 | public static $primary = null; |
||
25 | private $_objects = []; |
||
26 | |||
27 | /** |
||
28 | * App params |
||
29 | */ |
||
30 | public $name = ''; |
||
31 | public $dir = ''; |
||
32 | public $namespace = ''; |
||
33 | public $type = 'app'; |
||
34 | public $system = false; |
||
35 | public $default = false; |
||
36 | public $route = ''; |
||
37 | public $installed = false; |
||
38 | public $staticPath = '/static'; |
||
39 | public $templatesPath = '/static/templates'; |
||
40 | public $path = ''; |
||
41 | public $params = []; |
||
42 | public $config = []; |
||
43 | |||
44 | /** |
||
45 | * Constructor App |
||
46 | * |
||
47 | * @param array $preSet |
||
48 | */ |
||
49 | public function __construct($preSet = []) { |
||
54 | |||
55 | /** |
||
56 | * Return module object by name or alias |
||
57 | * |
||
58 | * @param string $className |
||
59 | * @return Module |
||
60 | */ |
||
61 | public function getObject($className, $params = []) { |
||
69 | |||
70 | /** |
||
71 | * Find module class from each paths |
||
72 | * |
||
73 | * @param string $moduleName |
||
74 | * @return mixed |
||
75 | */ |
||
76 | public function findModuleClass($moduleName) { |
||
117 | |||
118 | public function isLoaded($moduleName) { |
||
121 | |||
122 | public function getDomain($decode = false) { |
||
125 | |||
126 | /** |
||
127 | * Load module by name or alias |
||
128 | * |
||
129 | * @param string $className |
||
130 | * @return mixed |
||
131 | */ |
||
132 | public function loadObject($className, $params = []) { |
||
148 | |||
149 | /** |
||
150 | * Reference to module getter |
||
151 | * |
||
152 | * @param string $className |
||
169 | } |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.