Passed
Push — master ( 7344eb...099444 )
by Wanderson
01:24
created

Config   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 2 1
A get() 0 2 2
1
<?php
2
3
namespace Win\Mvc;
4
5
/**
6
 * Configurações
7
 */
8
class Config {
9
10
	/** @var mixed[] */
11
	private static $configs;
12
13
	final public static function init($config) {
14
		static::$configs = $config;
0 ignored issues
show
Bug introduced by
Since $configs is declared private, accessing it with static will lead to errors in possible sub-classes; you can either use self, or increase the visibility of $configs to at least protected.
Loading history...
15
	}
16
17
	/**
18
	 * Retorna uma configuração
19
	 * @param string $key Nome da configuração
20
	 * @param string $default Valor default, caso esta configuração esteja em branco
21
	 */
22
	final public static function get($key, $default = '') {
23
		return (key_exists($key, static::$configs)) ? static::$configs[$key] : $default;
0 ignored issues
show
Bug introduced by
Since $configs is declared private, accessing it with static will lead to errors in possible sub-classes; you can either use self, or increase the visibility of $configs to at least protected.
Loading history...
24
	}
25
26
}
27