Completed
Push — development ( 1c3d48...61edbf )
by Alexander
03:31
created

BaseController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getParam() 0 6 1
1
<?php
2
/**
3
 * Base class for controllers
4
 *
5
 * @file      BaseController.php
6
 *
7
 * PHP version 5.4+
8
 *
9
 * @author    Yancharuk Alexander <alex at itvault dot info>
10
 * @copyright © 2012-2016 Alexander Yancharuk
11
 * @date      2016-10-21 16:43
12
 * @license   The BSD 3-Clause License
13
 *            <https://tldrlegal.com/license/bsd-3-clause-license-(revised)>
14
 */
15
16
namespace Veles\Controllers;
17
18
use Application\ApplicationTrait;
19
use Veles\Application\Application;
20
21
/**
22
 * Class   BaseController
23
 *
24
 * @author Yancharuk Alexander <alex at itvault dot info>
25
 */
26
class BaseController
27
{
28
	use ApplicationTrait;
29
30
	/**
31
	 * Set application as internal property
32
	 *
33
	 * @param Application $application
34
	 */
35 1
	public function __construct(Application $application)
36
	{
37 1
		$this->setApplication($application);
38 1
	}
39
40
	/**
41
	 * Getting route params
42
	 *
43
	 * @param string $name
44
	 *
45
	 * return string
46
	 */
47 2
	protected function getParam($name)
48
	{
49 2
		$params = $this->getApplication()->getRoute()->getParams();
50
51 2
		return $params[$name];
52
	}
53
}
54