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

Data::get()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 8
nc 3
nop 2
dl 0
loc 11
rs 10
c 0
b 0
f 0
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