action_handler   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A create() 0 12 2
1
<?php
2
/**
3
 *
4
 * @package sitemaker
5
 * @copyright (c) 2013 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
use Symfony\Component\DependencyInjection\Container;
13
14
class action_handler
15
{
16
	/** @var Container */
17
	protected $phpbb_container;
18
19
	/**
20
	 * Constructor
21
	 *
22
	 * @param Container		$phpbb_container		Service container
23
	 */
24
	public function __construct(Container $phpbb_container)
25
	{
26
		$this->phpbb_container = $phpbb_container;
27
	}
28
29
	/**
30
	 * @param string $mode topic|type
31
	 * @param string $action
32
	 * @return \blitze\content\services\actions\action_interface
33
	 * @throws \blitze\sitemaker\exception\out_of_bounds
34
	 */
35
	public function create($mode, $action)
36
	{
37
		$service_name = 'blitze.content.actions.' . $mode . '.' . $action;
38
		if (!$this->phpbb_container->has($service_name))
39
		{
40
			throw new \blitze\sitemaker\exception\out_of_bounds(array($action, 'INVALID_REQUEST'));
0 ignored issues
show
Bug introduced by
The type blitze\sitemaker\exception\out_of_bounds 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...
41
		}
42
43
		$service = $this->phpbb_container->get($service_name);
44
45
		/** @var \blitze\content\services\actions\action_interface $service */
46
		return $service;
47
	}
48
}
49