HandlerFactory::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 2
rs 10
1
<?php
2
/**
3
 * @package   WPEmerge
4
 * @author    Atanas Angelov <[email protected]>
5
 * @copyright 2017-2019 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 Closure;
13
use WPEmerge\Application\GenericFactory;
14
15
/**
16
 * Handler factory.
17
 */
18
class HandlerFactory {
19
	/**
20
	 * Injection Factory.
21
	 *
22
	 * @var GenericFactory
23
	 */
24
	protected $factory = null;
25
26
	/**
27
	 * Constructor.
28
	 *
29
	 * @codeCoverageIgnore
30
	 * @param GenericFactory $factory
31
	 */
32
	public function __construct( GenericFactory $factory ) {
33
		$this->factory = $factory;
34
	}
35
36
	/**
37
	 * Make a Handler.
38
	 *
39
	 * @codeCoverageIgnore
40
	 * @param  string|Closure $raw_handler
41
	 * @param  string         $default_method
42
	 * @param  string         $namespace
43
	 * @return Handler
44
	 */
45
	public function make( $raw_handler, $default_method = '', $namespace = '' ) {
46
		return new Handler( $this->factory, $raw_handler, $default_method, $namespace );
47
	}
48
}
49