Passed
Push — master ( c40970...cb03ce )
by Atanas
03:02
created

HandlerFactory::make()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 2
rs 10
1
<?php
2
/**
3
 * @package   WPEmerge
4
 * @author    Atanas Angelov <[email protected]>
5
 * @copyright 2018 Atanas Angelov
6
 * @license   https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0
7
 * @link      https://wpemerge.com/
8
 */
9
10
namespace WPEmerge\Helpers;
11
12
use WPEmerge\Application\InjectionFactory;
13
14
/**
15
 * Handler factory.
16
 */
17
class HandlerFactory {
18
	/**
19
	 * Injection Factory.
20
	 *
21
	 * @var InjectionFactory
22
	 */
23
	protected $injection_factory = null;
24
25
	/**
26
	 * Constructor.
27
	 *
28
	 * @codeCoverageIgnore
29
	 * @param InjectionFactory $injection_factory
30
	 */
31
	public function __construct( InjectionFactory $injection_factory ) {
32
		$this->injection_factory = $injection_factory;
33
	}
34
35
	/**
36
	 * Make a Handler.
37
	 *
38
	 * @codeCoverageIgnore
39
	 * @param string|\Closure $raw_handler
40
	 * @param string         $default_method
41
	 * @param string         $namespace
42
	 *
43
	 * @return Handler
44
	 */
45
	public function make( $raw_handler, $default_method = '', $namespace = '' ) {
46
		return new Handler( $this->injection_factory, $raw_handler, $default_method, $namespace );
47
	}
48
}
49