Completed
Push — master ( 27c6b5...777874 )
by Steve
05:09
created

AbstractController::setRouteParams()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * @package    Fuel\Foundation
4
 * @version    2.0
5
 * @author     Fuel Development Team
6
 * @license    MIT License
7
 * @copyright  2010 - 2016 Fuel Development Team
8
 * @link       http://fuelphp.com
9
 */
10
11
declare(strict_types=1);
12
13
namespace Fuel\Foundation\Controller;
14
15
abstract class AbstractController implements ControllerInterface
16
{
17
	protected $routeParams = [];
18
19 3
	public function setRouteParams(array $params)
20
	{
21 3
		$this->routeParams = $params;
22 3
	}
23
24 1
	public function getRouteParams() : array
25
	{
26 1
		return $this->routeParams;
27
	}
28
29 2
	public function getRouteParam(string $name, $default = null)
30
	{
31 2
		if ( ! isset($this->routeParams[$name])) {
32 1
			return $default;
33
		}
34
35 2
		return $this->routeParams[$name];
36
	}
37
38
}
39