Failed Conditions
Branch refactor/kernels (3a00e4)
by Atanas
01:41
created

HasRoutesTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 35
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getRoutes() 0 2 1
A addRoute() 0 2 1
A setRoutes() 0 2 1
1
<?php
2
/**
3
 * @package   WPEmerge
4
 * @author    Atanas Angelov <[email protected]>
5
 * @copyright 2018 Atanas Angelov
6
 * @license   https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0
7
 * @link      https://wpemerge.com/
8
 */
9
10
namespace WPEmerge\Routing;
11
12
/**
13
 * Allow objects to have routes
14
 */
15
trait HasRoutesTrait {
16
	/**
17
	 * Array of registered routes
18
	 *
19
	 * @var RouteInterface[]
20
	 */
21
	protected $routes = [];
22
23
	/**
24
	 * Get routes.
25
	 *
26
	 * @return array<RouteInterface>
27
	 */
28
	public function getRoutes() {
29
		return $this->routes;
30
	}
31
32
	/**
33
	 * Set routes.
34
	 *
35
	 * @param  array<RouteInterface> $routes
36
	 * @return void
37
	 */
38
	public function setRoutes( $routes ) {
39
		$this->routes = $routes;
40
	}
41 1
42 1
	/**
43
	 * Add a route.
44
	 *
45
	 * @param  RouteInterface $route
46
	 * @return void
47
	 */
48
	public function addRoute( $route ) {
49
		$this->routes[] = $route;
50
	}
51
}
52