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

RoutesConfig   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 33
ccs 8
cts 8
cp 1
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getData() 0 8 2
A getSection() 0 6 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