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

action_utils::trigger_error()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 4
cp 0.75
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 3
crap 2.0625
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