Passed
Branch scrutinizer (dafd44)
by Wanderson
01:40
created

Data   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 11 4
1
<?php
2
3
namespace Win\Data;
4
5
/**
6
 * Dados
7
 */
8
abstract class Data implements DataInterface{
9
10
	/**
11
	 * Retorna valor da sessão
12
	 * @param string $key Nome da configuração
13
	 * @param string $default Valor default, caso esta configuração esteja em branco
14
	 */
15
	public static function get($key, $default = '') {
16
		$keys = explode('.', $key);
17
		$config = static::getAll();
18
		foreach ($keys as $key) {
0 ignored issues
show
introduced by
$key is overwriting one of the parameters of this function.
Loading history...
19
			if (is_array($config) && array_key_exists($key, $config)) {
20
				$config = $config[$key];
21
			} else {
22
				return $default;
23
			}
24
		}
25
		return $config;
26
	}
27
28
}
29