Completed
Push — master ( 0a5bf7...5f5ea6 )
by Alexander
03:45
created

RoutesConfig::getSection()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
c 1
b 0
f 0
nc 2
cc 2
eloc 3
nop 1
crap 2
1
<?php
2
/**
3
 * Concrete config class
4
 *
5
 * @file      RoutesConfig.php
6
 *
7
 * PHP version 5.6+
8
 *
9
 * @author    Yancharuk Alexander <alex at itvault dot info>
10
 * @copyright © 2012-2016 Alexander Yancharuk
11
 * @date      2015-05-24 12:39
12
 * @license   The BSD 3-Clause License
13
 *            <https://tldrlegal.com/license/bsd-3-clause-license-(revised)>
14
 */
15
16
namespace Veles\Routing;
17
18
/**
19
 * Class RoutesConfig
20
 * @author  Yancharuk Alexander <alex at itvault dot info>
21
 */
22
class RoutesConfig extends AbstractRoutesConfig
23
{
24
	/** @var  array */
25
	protected $data;
26
27
	/**
28
	 * Returns array that contains project routes configuration
29
	 *
30
	 * @return array
31
	 */
32 4
	public function getData()
33
	{
34 4
		if (null === $this->data) {
35 4
			$this->data = $this->loader->load();
36 4
		}
37
38 4
		return $this->data;
39
	}
40
41
	/**
42
	 * Returns section of routes
43
	 *
44
	 * @param string $name Name of section
45
	 *
46
	 * @return array
47
	 */
48 3
	public function getSection($name)
49
	{
50 3
		$data = $this->getData();
51
52 3
		return isset($data[$name]) ? $data[$name] : [];
53
	}
54
}
55