Completed
Push — develop ( 226ad1...4a255f )
by Daniel
08:09
created

action_utils   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Test Coverage

Coverage 90%

Importance

Changes 0
Metric Value
wmc 6
lcom 2
cbo 0
dl 0
loc 39
ccs 9
cts 10
cp 0.9
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A redirect() 0 4 2
A meta_refresh() 0 4 2
A trigger_error() 0 5 2
1
<?php
2
/**
3
 *
4
 * @package sitemaker
5
 * @copyright (c) 2016 Daniel A. (blitze)
6
 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
7
 *
8
 */
9
10
namespace blitze\content\services\actions;
11
12
abstract class action_utils
13
{
14
	/** @var bool */
15
	protected $auto_refresh = true;
16
17
	/** @var bool */
18
	protected $redirect = true;
19
20
	/**
21
	 * @param string $u_action
22
	 * @return void
23
	 */
24 1
	protected function redirect($u_action)
25
	{
26 1
		$this->redirect ? redirect($u_action) : null;
27 1
	}
28
29
	/**
30
	 * @param int $time
31
	 * @param string $u_action
32
	 * @return void
33
	 */
34 2
	protected function meta_refresh($time, $u_action)
35
	{
36 2
		$this->auto_refresh ? meta_refresh($time, $u_action) : null;
37 2
	}
38
39
	/**
40
	 * @param string $message
41
	 * @param string $u_action
42
	 * @param int $errno
43
	 * @return void
44
	 */
45 4
	protected function trigger_error($message, $u_action = '', $errno = E_USER_NOTICE)
46
	{
47 4
		$message .= $u_action ? adm_back_link($u_action) : '';
48 4
		trigger_error($message, $errno);
49
	}
50
}
51