Completed
Push — master ( 91372c...57e7bf )
by dima
05:02
created

App::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
class App
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
{
5
6
	private $settings = array();
7
	
8
	private static $_instance = null;
9
10
	private function __construct()
11
	{
12
		// приватный конструктор ограничивает реализацию getInstance ()
13
	}
14
15
	protected function __clone()
16
	{
17
		// ограничивает клонирование объекта
18
	}
19
20
	static function getModule($name, array $params = [])
0 ignored issues
show
Unused Code introduced by
The parameter $params is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
21
	{
22
		$DI = self::getInstance()->load("DI");
23
		$debugbar = $DI->get(DebugBar\StandardDebugBar::class);
24
		$debugbar['time']->startMeasure($name, 'Load module ' . $name);
25
		$result = $DI->get($name)->process();	
26
		$debugbar['time']->stopMeasure($name);
27
		return $result;
28
	}
29
30
	static public function getInstance()
0 ignored issues
show
Coding Style introduced by
As per PSR2, the static declaration should come after the visibility declaration.
Loading history...
31
	{
32
		if (is_null(self::$_instance)) {
33
			self::$_instance = new self();
34
		}
35
		return self::$_instance;
36
	}
37
38
	public function import($key,$value)
39
	{
40
		$this->settings[$key] = $value;
41
	}
42
43
	public function load($key)
44
	{
45
		return $this->settings[$key];
46
	}
47
}
48