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

HasRoutesTrait::setRoutes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 2
ccs 0
cts 0
cp 0
crap 2
rs 10
c 0
b 0
f 0
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