Completed
Push — develop ( 69e1c6...6a0b8a )
by Daniel
08:16
created

admin_controller::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
crap 1
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\controller;
11
12
class admin_controller
13
{
14
	/** @var \phpbb\language\language */
15
	protected $language;
16
17
	/** @var \blitze\content\services\action_handler */
18
	protected $action_handler;
19
20
	/**
21
	 * Constructor
22
	 *
23
	 * @param \phpbb\language\language					$language			Language object
24
	 * @param \blitze\content\services\action_handler	$action_handler		Handles actions
25
	*/
26 1
	public function __construct(\phpbb\language\language $language, \blitze\content\services\action_handler $action_handler)
27
	{
28 1
		$this->language = $language;
29 1
		$this->action_handler = $action_handler;
30 1
	}
31
32
	/**
33
	 * Handle admin actions
34
	 *
35
	 * @param string $action
36
	 * @param string $type
37
	 * @param string $base_url
38
	 * @return void
39
	 */
40 1
	public function handle($action, $type, $base_url)
41
	{
42
		try
43
		{
44 1
			$command = $this->action_handler->create('type', $action);
45 1
			$command->execute($base_url, $type);
1 ignored issue
show
Unused Code introduced by
The call to action_interface::execute() has too many arguments starting with $type.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
46
		}
47 1
		catch (\blitze\sitemaker\exception\base $e)
1 ignored issue
show
Bug introduced by
The class blitze\sitemaker\exception\base does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
48
		{
49 1
			$message = $e->get_message($this->language);
50 1
			trigger_error($this->language->lang($message) . adm_back_link($base_url), E_USER_WARNING);
51
		}
52 1
	}
53
}
54