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

BaseController::getData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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