Completed
Branch FET-10702-command-factory (48c5de)
by
unknown
14:40
created

CommandFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
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