mcp_controller::handle()   A
last analyzed

Complexity

Conditions 2
Paths 3

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 7
c 1
b 0
f 0
nc 3
nop 2
dl 0
loc 13
ccs 0
cts 12
cp 0
crap 6
rs 10
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 mcp_controller
13
{
14
	/** @var \phpbb\language\language */
15
	protected $language;
16
17
	/** @var \blitze\content\services\actions\action_handler */
18
	protected $action_handler;
19
20
	/**
21
	 * Constructor
22
	 *
23
	 * @param \phpbb\language\language							$language			Language object
24
	 * @param \blitze\content\services\actions\action_handler	$action_handler		Handles actions
25
	*/
26
	public function __construct(\phpbb\language\language $language, \blitze\content\services\actions\action_handler $action_handler)
27
	{
28
		$this->language = $language;
29
		$this->action_handler = $action_handler;
30
	}
31
32
	/**
33
	 * Display list of topics for content type
34
	 *
35
	 * @param string $action
36
	 * @param string $base_url
37
	 * @return void
38
	 */
39
	public function handle($action, $base_url)
40
	{
41
		$this->language->add_lang('cp', 'blitze/content');
42
43
		try
44
		{
45
			$command = $this->action_handler->create('topic', $action);
46
			$command->execute($base_url, 'mcp');
47
		}
48
		catch (\blitze\sitemaker\exception\base $e)
0 ignored issues
show
Bug introduced by
The type blitze\sitemaker\exception\base was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
49
		{
50
			$message = (array) $e->get_message($this->language);
51
			trigger_error(join('<br />', $message) . '<br />' . $this->language->lang('RETURN_PAGE', '<a href="' . $base_url . '">', '</a>'));
52
		}
53
	}
54
}
55