Completed
Push — development ( 3222e7...7e0062 )
by Alexander
04:04
created

BaseController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getParam() 0 6 1
A getData() 0 4 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-2017 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
	 * Getting route params
32
	 *
33
	 * @param string $name
34
	 *
35
	 * return string
36
	 */
37 2
	protected function getParam($name)
38
	{
39 2
		$params = $this->getApplication()->getRoute()->getParams();
40
41 2
		return $params[$name];
42
	}
43
44
	/**
45
	 * Getting request data
46
	 *
47
	 * @param $definitions
48
	 *
49
	 * @return array
50
	 */
51 1
	protected function getData($definitions)
52
	{
53 1
		return $this->getApplication()->getRequest()->getData($definitions);
54
	}
55
}
56