|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace EventEspresso\core\services\commands; |
|
4
|
|
|
|
|
5
|
|
|
use EventEspresso\core\exceptions\InvalidDataTypeException; |
|
6
|
|
|
use EventEspresso\core\exceptions\InvalidInterfaceException; |
|
7
|
|
|
use EventEspresso\core\services\loaders\LoaderInterface; |
|
8
|
|
|
use InvalidArgumentException; |
|
9
|
|
|
|
|
10
|
|
|
defined('EVENT_ESPRESSO_VERSION') || exit; |
|
11
|
|
|
|
|
12
|
|
|
|
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Class CommandFactory |
|
16
|
|
|
* Uses a LoaderInterface class to build and return Command |
|
17
|
|
|
* |
|
18
|
|
|
* @package Event Espresso |
|
19
|
|
|
* @author Brent Christensen |
|
20
|
|
|
* @since $VID:$ |
|
21
|
|
|
*/ |
|
22
|
|
|
class CommandFactory implements CommandFactoryInterface |
|
23
|
|
|
{ |
|
24
|
|
|
|
|
25
|
|
|
|
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @var LoaderInterface $loader |
|
29
|
|
|
*/ |
|
30
|
|
|
private $loader; |
|
31
|
|
|
|
|
32
|
|
|
|
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* CommandFactory constructor |
|
36
|
|
|
* |
|
37
|
|
|
* @param LoaderInterface $loader |
|
38
|
|
|
* @throws InvalidDataTypeException |
|
39
|
|
|
* @throws InvalidInterfaceException |
|
40
|
|
|
* @throws InvalidArgumentException |
|
41
|
|
|
*/ |
|
42
|
|
|
public function __construct(LoaderInterface $loader = null) |
|
43
|
|
|
{ |
|
44
|
|
|
$this->loader = $loader; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
|
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @param string $command_fqcn |
|
51
|
|
|
* @param array $arguments |
|
52
|
|
|
* @return mixed |
|
53
|
|
|
* @throws InvalidArgumentException |
|
54
|
|
|
* @throws InvalidDataTypeException |
|
55
|
|
|
* @throws InvalidInterfaceException |
|
56
|
|
|
*/ |
|
57
|
|
|
public function getNew($command_fqcn, $arguments = array()) |
|
58
|
|
|
{ |
|
59
|
|
|
return $this->loader->getNew($command_fqcn, $arguments); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
|
|
63
|
|
|
|
|
64
|
|
|
} |
|
65
|
|
|
// End of file CommandFactory.php |
|
66
|
|
|
// Location: EventEspresso\core\services\commands/CommandFactory.php |