@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | use EventEspresso\core\services\commands\middleware\InvalidCommandBusMiddlewareException; |
8 | 8 | |
9 | 9 | if (! defined('EVENT_ESPRESSO_VERSION')) { |
10 | - exit('No direct script access allowed'); |
|
10 | + exit('No direct script access allowed'); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | |
@@ -40,78 +40,78 @@ discard block |
||
40 | 40 | class CommandBus implements CommandBusInterface |
41 | 41 | { |
42 | 42 | |
43 | - /** |
|
44 | - * @type CommandHandlerManagerInterface $command_handler_manager |
|
45 | - */ |
|
46 | - private $command_handler_manager; |
|
47 | - |
|
48 | - /** |
|
49 | - * @type CommandBusMiddlewareInterface[] $command_bus_middleware |
|
50 | - */ |
|
51 | - private $command_bus_middleware; |
|
52 | - |
|
53 | - |
|
54 | - |
|
55 | - /** |
|
56 | - * CommandBus constructor |
|
57 | - * |
|
58 | - * @param CommandHandlerManagerInterface $command_handler_manager |
|
59 | - * @param CommandBusMiddlewareInterface[] $command_bus_middleware |
|
60 | - */ |
|
61 | - public function __construct( |
|
62 | - CommandHandlerManagerInterface $command_handler_manager, |
|
63 | - $command_bus_middleware = array() |
|
64 | - ) { |
|
65 | - $this->command_handler_manager = $command_handler_manager; |
|
66 | - $this->command_bus_middleware = is_array($command_bus_middleware) |
|
67 | - ? $command_bus_middleware |
|
68 | - : array($command_bus_middleware); |
|
69 | - } |
|
70 | - |
|
71 | - |
|
72 | - |
|
73 | - /** |
|
74 | - * @return CommandHandlerManagerInterface |
|
75 | - */ |
|
76 | - public function getCommandHandlerManager() |
|
77 | - { |
|
78 | - return $this->command_handler_manager; |
|
79 | - } |
|
80 | - |
|
81 | - |
|
82 | - |
|
83 | - /** |
|
84 | - * @param CommandInterface $command |
|
85 | - * @return mixed |
|
86 | - * @throws InvalidDataTypeException |
|
87 | - * @throws InvalidCommandBusMiddlewareException |
|
88 | - */ |
|
89 | - public function execute($command) |
|
90 | - { |
|
91 | - if (! $command instanceof CommandInterface) { |
|
92 | - throw new InvalidDataTypeException(__METHOD__ . '( $command )', $command, 'CommandInterface'); |
|
93 | - } |
|
94 | - // we're going to add the Command Handler as a callable |
|
95 | - // that will get run at the end of our middleware stack |
|
96 | - // can't pass $this to a Closure, so use a named variable |
|
97 | - $command_bus = $this; |
|
98 | - $middleware = function ($command) use ($command_bus) { |
|
99 | - return $command_bus->getCommandHandlerManager() |
|
100 | - ->getCommandHandler($command, $command_bus) |
|
101 | - ->handle($command); |
|
102 | - }; |
|
103 | - // now build the rest of the middleware stack |
|
104 | - while ($command_bus_middleware = array_pop($this->command_bus_middleware)) { |
|
105 | - if (! $command_bus_middleware instanceof CommandBusMiddlewareInterface) { |
|
106 | - throw new InvalidCommandBusMiddlewareException($command_bus_middleware); |
|
107 | - } |
|
108 | - $middleware = function ($command) use ($command_bus_middleware, $middleware) { |
|
109 | - return $command_bus_middleware->handle($command, $middleware); |
|
110 | - }; |
|
111 | - } |
|
112 | - // and finally, pass the command into the stack and return the results |
|
113 | - return $middleware($command); |
|
114 | - } |
|
43 | + /** |
|
44 | + * @type CommandHandlerManagerInterface $command_handler_manager |
|
45 | + */ |
|
46 | + private $command_handler_manager; |
|
47 | + |
|
48 | + /** |
|
49 | + * @type CommandBusMiddlewareInterface[] $command_bus_middleware |
|
50 | + */ |
|
51 | + private $command_bus_middleware; |
|
52 | + |
|
53 | + |
|
54 | + |
|
55 | + /** |
|
56 | + * CommandBus constructor |
|
57 | + * |
|
58 | + * @param CommandHandlerManagerInterface $command_handler_manager |
|
59 | + * @param CommandBusMiddlewareInterface[] $command_bus_middleware |
|
60 | + */ |
|
61 | + public function __construct( |
|
62 | + CommandHandlerManagerInterface $command_handler_manager, |
|
63 | + $command_bus_middleware = array() |
|
64 | + ) { |
|
65 | + $this->command_handler_manager = $command_handler_manager; |
|
66 | + $this->command_bus_middleware = is_array($command_bus_middleware) |
|
67 | + ? $command_bus_middleware |
|
68 | + : array($command_bus_middleware); |
|
69 | + } |
|
70 | + |
|
71 | + |
|
72 | + |
|
73 | + /** |
|
74 | + * @return CommandHandlerManagerInterface |
|
75 | + */ |
|
76 | + public function getCommandHandlerManager() |
|
77 | + { |
|
78 | + return $this->command_handler_manager; |
|
79 | + } |
|
80 | + |
|
81 | + |
|
82 | + |
|
83 | + /** |
|
84 | + * @param CommandInterface $command |
|
85 | + * @return mixed |
|
86 | + * @throws InvalidDataTypeException |
|
87 | + * @throws InvalidCommandBusMiddlewareException |
|
88 | + */ |
|
89 | + public function execute($command) |
|
90 | + { |
|
91 | + if (! $command instanceof CommandInterface) { |
|
92 | + throw new InvalidDataTypeException(__METHOD__ . '( $command )', $command, 'CommandInterface'); |
|
93 | + } |
|
94 | + // we're going to add the Command Handler as a callable |
|
95 | + // that will get run at the end of our middleware stack |
|
96 | + // can't pass $this to a Closure, so use a named variable |
|
97 | + $command_bus = $this; |
|
98 | + $middleware = function ($command) use ($command_bus) { |
|
99 | + return $command_bus->getCommandHandlerManager() |
|
100 | + ->getCommandHandler($command, $command_bus) |
|
101 | + ->handle($command); |
|
102 | + }; |
|
103 | + // now build the rest of the middleware stack |
|
104 | + while ($command_bus_middleware = array_pop($this->command_bus_middleware)) { |
|
105 | + if (! $command_bus_middleware instanceof CommandBusMiddlewareInterface) { |
|
106 | + throw new InvalidCommandBusMiddlewareException($command_bus_middleware); |
|
107 | + } |
|
108 | + $middleware = function ($command) use ($command_bus_middleware, $middleware) { |
|
109 | + return $command_bus_middleware->handle($command, $middleware); |
|
110 | + }; |
|
111 | + } |
|
112 | + // and finally, pass the command into the stack and return the results |
|
113 | + return $middleware($command); |
|
114 | + } |
|
115 | 115 | |
116 | 116 | |
117 | 117 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | use EventEspresso\core\services\commands\middleware\CommandBusMiddlewareInterface; |
7 | 7 | use EventEspresso\core\services\commands\middleware\InvalidCommandBusMiddlewareException; |
8 | 8 | |
9 | -if (! defined('EVENT_ESPRESSO_VERSION')) { |
|
9 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
10 | 10 | exit('No direct script access allowed'); |
11 | 11 | } |
12 | 12 | |
@@ -88,24 +88,24 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function execute($command) |
90 | 90 | { |
91 | - if (! $command instanceof CommandInterface) { |
|
92 | - throw new InvalidDataTypeException(__METHOD__ . '( $command )', $command, 'CommandInterface'); |
|
91 | + if ( ! $command instanceof CommandInterface) { |
|
92 | + throw new InvalidDataTypeException(__METHOD__.'( $command )', $command, 'CommandInterface'); |
|
93 | 93 | } |
94 | 94 | // we're going to add the Command Handler as a callable |
95 | 95 | // that will get run at the end of our middleware stack |
96 | 96 | // can't pass $this to a Closure, so use a named variable |
97 | 97 | $command_bus = $this; |
98 | - $middleware = function ($command) use ($command_bus) { |
|
98 | + $middleware = function($command) use ($command_bus) { |
|
99 | 99 | return $command_bus->getCommandHandlerManager() |
100 | 100 | ->getCommandHandler($command, $command_bus) |
101 | 101 | ->handle($command); |
102 | 102 | }; |
103 | 103 | // now build the rest of the middleware stack |
104 | 104 | while ($command_bus_middleware = array_pop($this->command_bus_middleware)) { |
105 | - if (! $command_bus_middleware instanceof CommandBusMiddlewareInterface) { |
|
105 | + if ( ! $command_bus_middleware instanceof CommandBusMiddlewareInterface) { |
|
106 | 106 | throw new InvalidCommandBusMiddlewareException($command_bus_middleware); |
107 | 107 | } |
108 | - $middleware = function ($command) use ($command_bus_middleware, $middleware) { |
|
108 | + $middleware = function($command) use ($command_bus_middleware, $middleware) { |
|
109 | 109 | return $command_bus_middleware->handle($command, $middleware); |
110 | 110 | }; |
111 | 111 | } |
@@ -24,40 +24,40 @@ |
||
24 | 24 | |
25 | 25 | |
26 | 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 | - } |
|
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 | 61 | |
62 | 62 | |
63 | 63 |
@@ -13,15 +13,15 @@ |
||
13 | 13 | interface CommandFactoryInterface |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * @param string $command_fqcn |
|
18 | - * @param array $arguments |
|
19 | - * @return mixed |
|
20 | - * @throws InvalidArgumentException |
|
21 | - * @throws InvalidDataTypeException |
|
22 | - * @throws InvalidInterfaceException |
|
23 | - */ |
|
24 | - public function getNew($command_fqcn, $arguments = array()); |
|
16 | + /** |
|
17 | + * @param string $command_fqcn |
|
18 | + * @param array $arguments |
|
19 | + * @return mixed |
|
20 | + * @throws InvalidArgumentException |
|
21 | + * @throws InvalidDataTypeException |
|
22 | + * @throws InvalidInterfaceException |
|
23 | + */ |
|
24 | + public function getNew($command_fqcn, $arguments = array()); |
|
25 | 25 | |
26 | 26 | } |
27 | 27 | // End of file CommandFactoryInterface.php |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | use EventEspresso\core\services\loaders\LoaderInterface; |
7 | 7 | |
8 | 8 | if (! defined('EVENT_ESPRESSO_VERSION')) { |
9 | - exit('No direct script access allowed'); |
|
9 | + exit('No direct script access allowed'); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | |
@@ -24,109 +24,109 @@ discard block |
||
24 | 24 | class CommandHandlerManager implements CommandHandlerManagerInterface |
25 | 25 | { |
26 | 26 | |
27 | - /** |
|
28 | - * @var CommandHandlerInterface[] $command_handlers |
|
29 | - */ |
|
30 | - protected $command_handlers; |
|
31 | - |
|
32 | - /** |
|
33 | - * @type LoaderInterface $loader |
|
34 | - */ |
|
35 | - private $loader; |
|
36 | - |
|
37 | - |
|
38 | - |
|
39 | - /** |
|
40 | - * CommandHandlerManager constructor |
|
41 | - * |
|
42 | - * @param LoaderInterface $loader |
|
43 | - */ |
|
44 | - public function __construct(LoaderInterface $loader) |
|
45 | - { |
|
46 | - $this->loader = $loader; |
|
47 | - } |
|
48 | - |
|
49 | - |
|
50 | - |
|
51 | - /** |
|
52 | - * By default, Commands and CommandHandlers would normally |
|
53 | - * reside in the same folder under the same namespace, |
|
54 | - * and the names of the two classes would only differ in that |
|
55 | - * one ends in "Command" and the other ends in "CommandHandler". |
|
56 | - * However, if you wanted to utilize a CommandHandler from somewhere else, |
|
57 | - * then this method allows you to add that CommandHandler and specify the FQCN |
|
58 | - * (Fully Qualified ClassName) for the Command class that it should be used for. |
|
59 | - * For example: |
|
60 | - * by default the "Vendor\some\namespace\DoSomethingCommand" |
|
61 | - * would resolve to using "Vendor\some\namespace\DoSomethingCommandHandler" |
|
62 | - * but if you wanted to instead process that commend using: |
|
63 | - * "Vendor\a\totally\different\namespace\for\DoSomethingCommandHandler" |
|
64 | - * then the following code: |
|
65 | - * $CommandHandlerManager = $this->loader->getShared( 'CommandHandlerManagerInterface' ); |
|
66 | - * $CommandHandlerManager->addCommandHandler( |
|
67 | - * new Vendor\a\totally\different\namespace\for\DoSomethingCommandHandler(), |
|
68 | - * 'Vendor\some\namespace\DoSomethingCommand' |
|
69 | - * ); |
|
70 | - * would result in the alternate CommandHandler being used to process that Command |
|
71 | - * |
|
72 | - * @param CommandHandlerInterface $command_handler |
|
73 | - * @param string $fqcn_for_command Fully Qualified ClassName for Command |
|
74 | - * @return void |
|
75 | - * @throws InvalidCommandHandlerException |
|
76 | - */ |
|
77 | - public function addCommandHandler(CommandHandlerInterface $command_handler, $fqcn_for_command = '') |
|
78 | - { |
|
79 | - $command = ! empty($fqcn_for_command) |
|
80 | - ? $fqcn_for_command |
|
81 | - : str_replace('CommandHandler', 'Command', get_class($command_handler)); |
|
82 | - if (empty($command)) { |
|
83 | - throw new InvalidCommandHandlerException($command); |
|
84 | - } |
|
85 | - $this->command_handlers[$command] = $command_handler; |
|
86 | - } |
|
87 | - |
|
88 | - |
|
89 | - |
|
90 | - /** |
|
91 | - * @param CommandInterface $command |
|
92 | - * @param CommandBusInterface $command_bus |
|
93 | - * @return mixed |
|
94 | - * @throws DomainException |
|
95 | - * @throws CommandHandlerNotFoundException |
|
96 | - */ |
|
97 | - public function getCommandHandler(CommandInterface $command, CommandBusInterface $command_bus = null) |
|
98 | - { |
|
99 | - $command_name = get_class($command); |
|
100 | - $command_handler = apply_filters( |
|
101 | - 'FHEE__EventEspresso_core_services_commands_CommandHandlerManager__getCommandHandler__command_handler', |
|
102 | - str_replace('Command', 'CommandHandler', $command_name), |
|
103 | - $command |
|
104 | - ); |
|
105 | - $handler = null; |
|
106 | - // has a command handler already been set for this class ? |
|
107 | - // if not, can we find one via the FQCN ? |
|
108 | - if (isset($this->command_handlers[$command_name])) { |
|
109 | - $handler = $this->command_handlers[$command_name]; |
|
110 | - } else if (class_exists($command_handler)) { |
|
111 | - $handler = $this->loader->getShared($command_handler); |
|
112 | - } |
|
113 | - // if Handler requires an instance of the CommandBus, but that has not yet been set |
|
114 | - if ($handler instanceof CompositeCommandHandler && ! $handler->commandBus() instanceof CommandBusInterface) { |
|
115 | - if (! $command_bus instanceof CommandBusInterface) { |
|
116 | - throw new DomainException( |
|
117 | - esc_html__( |
|
118 | - 'CompositeCommandHandler classes require an instance of the CommandBus.', |
|
119 | - 'event_espresso' |
|
120 | - ) |
|
121 | - ); |
|
122 | - } |
|
123 | - $handler->setCommandBus($command_bus); |
|
124 | - } |
|
125 | - if ($handler instanceof CommandHandlerInterface) { |
|
126 | - return $handler; |
|
127 | - } |
|
128 | - throw new CommandHandlerNotFoundException($command_handler); |
|
129 | - } |
|
27 | + /** |
|
28 | + * @var CommandHandlerInterface[] $command_handlers |
|
29 | + */ |
|
30 | + protected $command_handlers; |
|
31 | + |
|
32 | + /** |
|
33 | + * @type LoaderInterface $loader |
|
34 | + */ |
|
35 | + private $loader; |
|
36 | + |
|
37 | + |
|
38 | + |
|
39 | + /** |
|
40 | + * CommandHandlerManager constructor |
|
41 | + * |
|
42 | + * @param LoaderInterface $loader |
|
43 | + */ |
|
44 | + public function __construct(LoaderInterface $loader) |
|
45 | + { |
|
46 | + $this->loader = $loader; |
|
47 | + } |
|
48 | + |
|
49 | + |
|
50 | + |
|
51 | + /** |
|
52 | + * By default, Commands and CommandHandlers would normally |
|
53 | + * reside in the same folder under the same namespace, |
|
54 | + * and the names of the two classes would only differ in that |
|
55 | + * one ends in "Command" and the other ends in "CommandHandler". |
|
56 | + * However, if you wanted to utilize a CommandHandler from somewhere else, |
|
57 | + * then this method allows you to add that CommandHandler and specify the FQCN |
|
58 | + * (Fully Qualified ClassName) for the Command class that it should be used for. |
|
59 | + * For example: |
|
60 | + * by default the "Vendor\some\namespace\DoSomethingCommand" |
|
61 | + * would resolve to using "Vendor\some\namespace\DoSomethingCommandHandler" |
|
62 | + * but if you wanted to instead process that commend using: |
|
63 | + * "Vendor\a\totally\different\namespace\for\DoSomethingCommandHandler" |
|
64 | + * then the following code: |
|
65 | + * $CommandHandlerManager = $this->loader->getShared( 'CommandHandlerManagerInterface' ); |
|
66 | + * $CommandHandlerManager->addCommandHandler( |
|
67 | + * new Vendor\a\totally\different\namespace\for\DoSomethingCommandHandler(), |
|
68 | + * 'Vendor\some\namespace\DoSomethingCommand' |
|
69 | + * ); |
|
70 | + * would result in the alternate CommandHandler being used to process that Command |
|
71 | + * |
|
72 | + * @param CommandHandlerInterface $command_handler |
|
73 | + * @param string $fqcn_for_command Fully Qualified ClassName for Command |
|
74 | + * @return void |
|
75 | + * @throws InvalidCommandHandlerException |
|
76 | + */ |
|
77 | + public function addCommandHandler(CommandHandlerInterface $command_handler, $fqcn_for_command = '') |
|
78 | + { |
|
79 | + $command = ! empty($fqcn_for_command) |
|
80 | + ? $fqcn_for_command |
|
81 | + : str_replace('CommandHandler', 'Command', get_class($command_handler)); |
|
82 | + if (empty($command)) { |
|
83 | + throw new InvalidCommandHandlerException($command); |
|
84 | + } |
|
85 | + $this->command_handlers[$command] = $command_handler; |
|
86 | + } |
|
87 | + |
|
88 | + |
|
89 | + |
|
90 | + /** |
|
91 | + * @param CommandInterface $command |
|
92 | + * @param CommandBusInterface $command_bus |
|
93 | + * @return mixed |
|
94 | + * @throws DomainException |
|
95 | + * @throws CommandHandlerNotFoundException |
|
96 | + */ |
|
97 | + public function getCommandHandler(CommandInterface $command, CommandBusInterface $command_bus = null) |
|
98 | + { |
|
99 | + $command_name = get_class($command); |
|
100 | + $command_handler = apply_filters( |
|
101 | + 'FHEE__EventEspresso_core_services_commands_CommandHandlerManager__getCommandHandler__command_handler', |
|
102 | + str_replace('Command', 'CommandHandler', $command_name), |
|
103 | + $command |
|
104 | + ); |
|
105 | + $handler = null; |
|
106 | + // has a command handler already been set for this class ? |
|
107 | + // if not, can we find one via the FQCN ? |
|
108 | + if (isset($this->command_handlers[$command_name])) { |
|
109 | + $handler = $this->command_handlers[$command_name]; |
|
110 | + } else if (class_exists($command_handler)) { |
|
111 | + $handler = $this->loader->getShared($command_handler); |
|
112 | + } |
|
113 | + // if Handler requires an instance of the CommandBus, but that has not yet been set |
|
114 | + if ($handler instanceof CompositeCommandHandler && ! $handler->commandBus() instanceof CommandBusInterface) { |
|
115 | + if (! $command_bus instanceof CommandBusInterface) { |
|
116 | + throw new DomainException( |
|
117 | + esc_html__( |
|
118 | + 'CompositeCommandHandler classes require an instance of the CommandBus.', |
|
119 | + 'event_espresso' |
|
120 | + ) |
|
121 | + ); |
|
122 | + } |
|
123 | + $handler->setCommandBus($command_bus); |
|
124 | + } |
|
125 | + if ($handler instanceof CommandHandlerInterface) { |
|
126 | + return $handler; |
|
127 | + } |
|
128 | + throw new CommandHandlerNotFoundException($command_handler); |
|
129 | + } |
|
130 | 130 | |
131 | 131 | |
132 | 132 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | use DomainException; |
6 | 6 | use EventEspresso\core\services\loaders\LoaderInterface; |
7 | 7 | |
8 | -if (! defined('EVENT_ESPRESSO_VERSION')) { |
|
8 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
9 | 9 | exit('No direct script access allowed'); |
10 | 10 | } |
11 | 11 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | // if Handler requires an instance of the CommandBus, but that has not yet been set |
114 | 114 | if ($handler instanceof CompositeCommandHandler && ! $handler->commandBus() instanceof CommandBusInterface) { |
115 | - if (! $command_bus instanceof CommandBusInterface) { |
|
115 | + if ( ! $command_bus instanceof CommandBusInterface) { |
|
116 | 116 | throw new DomainException( |
117 | 117 | esc_html__( |
118 | 118 | 'CompositeCommandHandler classes require an instance of the CommandBus.', |
@@ -24,140 +24,140 @@ |
||
24 | 24 | { |
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * @var LoaderDecoratorInterface $new_loader |
|
29 | - */ |
|
30 | - private $new_loader; |
|
31 | - |
|
32 | - |
|
33 | - /** |
|
34 | - * @var LoaderDecoratorInterface $shared_loader |
|
35 | - */ |
|
36 | - private $shared_loader; |
|
37 | - |
|
38 | - |
|
39 | - |
|
40 | - /** |
|
41 | - * Loader constructor. |
|
42 | - * |
|
43 | - * @param LoaderDecoratorInterface|null $new_loader |
|
44 | - * @param LoaderDecoratorInterface|null $shared_loader |
|
45 | - * @throws InvalidInterfaceException |
|
46 | - * @throws InvalidArgumentException |
|
47 | - * @throws InvalidDataTypeException |
|
48 | - */ |
|
49 | - public function __construct(LoaderDecoratorInterface $new_loader = null, LoaderDecoratorInterface $shared_loader = null) |
|
50 | - { |
|
51 | - $this->new_loader = $this->setupNewLoader($new_loader); |
|
52 | - $this->shared_loader = $this->setupSharedLoader($shared_loader); |
|
53 | - } |
|
54 | - |
|
55 | - |
|
56 | - |
|
57 | - /** |
|
58 | - * @param LoaderDecoratorInterface|null $new_loader |
|
59 | - * @return CoreLoader|LoaderDecoratorInterface |
|
60 | - * @throws InvalidArgumentException |
|
61 | - */ |
|
62 | - private function setupNewLoader(LoaderDecoratorInterface $new_loader = null) |
|
63 | - { |
|
64 | - // if not already generated, create a standard loader |
|
65 | - if (! $new_loader instanceof LoaderDecoratorInterface) { |
|
66 | - $new_loader = new CoreLoader(EE_Registry::instance()); |
|
67 | - } |
|
68 | - return $new_loader; |
|
69 | - } |
|
70 | - |
|
71 | - |
|
72 | - |
|
73 | - /** |
|
74 | - * @param LoaderDecoratorInterface|null $shared_loader |
|
75 | - * @return CoreLoader|LoaderDecoratorInterface |
|
76 | - * @throws InvalidDataTypeException |
|
77 | - * @throws InvalidInterfaceException |
|
78 | - * @throws InvalidArgumentException |
|
79 | - */ |
|
80 | - private function setupSharedLoader(LoaderDecoratorInterface $shared_loader = null) |
|
81 | - { |
|
82 | - // if not already generated, create a caching loader |
|
83 | - if (! $shared_loader instanceof LoaderDecoratorInterface) { |
|
84 | - $shared_loader = new CachingLoader( |
|
85 | - new CoreLoader(EE_Registry::instance()), |
|
86 | - new LooseCollection('') |
|
87 | - ); |
|
88 | - } |
|
89 | - return $shared_loader; |
|
90 | - } |
|
91 | - |
|
92 | - |
|
93 | - |
|
94 | - /** |
|
95 | - * @return LoaderDecoratorInterface |
|
96 | - */ |
|
97 | - public function getNewLoader() |
|
98 | - { |
|
99 | - return $this->new_loader; |
|
100 | - } |
|
101 | - |
|
102 | - |
|
103 | - |
|
104 | - /** |
|
105 | - * @return LoaderDecoratorInterface |
|
106 | - */ |
|
107 | - public function getSharedLoader() |
|
108 | - { |
|
109 | - return $this->shared_loader; |
|
110 | - } |
|
111 | - |
|
112 | - |
|
113 | - |
|
114 | - /** |
|
115 | - * @param string $fqcn |
|
116 | - * @param array $arguments |
|
117 | - * @param bool $shared |
|
118 | - * @return mixed |
|
119 | - */ |
|
120 | - public function load($fqcn, $arguments = array(), $shared = true) |
|
121 | - { |
|
122 | - return $shared |
|
123 | - ? $this->getSharedLoader()->load($fqcn, $arguments) |
|
124 | - : $this->getNewLoader()->load($fqcn, $arguments); |
|
125 | - } |
|
126 | - |
|
127 | - |
|
128 | - |
|
129 | - /** |
|
130 | - * @param string $fqcn |
|
131 | - * @param array $arguments |
|
132 | - * @return mixed |
|
133 | - */ |
|
134 | - public function getNew($fqcn, $arguments = array()) |
|
135 | - { |
|
136 | - return $this->getNewLoader()->load($fqcn, $arguments); |
|
137 | - } |
|
138 | - |
|
139 | - |
|
140 | - |
|
141 | - /** |
|
142 | - * @param string $fqcn |
|
143 | - * @param array $arguments |
|
144 | - * @return mixed |
|
145 | - */ |
|
146 | - public function getShared($fqcn, $arguments = array()) |
|
147 | - { |
|
148 | - return $this->getSharedLoader()->load($fqcn, $arguments); |
|
149 | - } |
|
150 | - |
|
151 | - |
|
152 | - |
|
153 | - /** |
|
154 | - * calls reset() on loaders if that method exists |
|
155 | - */ |
|
156 | - public function reset() |
|
157 | - { |
|
158 | - $this->new_loader->reset(); |
|
159 | - $this->shared_loader->reset(); |
|
160 | - } |
|
27 | + /** |
|
28 | + * @var LoaderDecoratorInterface $new_loader |
|
29 | + */ |
|
30 | + private $new_loader; |
|
31 | + |
|
32 | + |
|
33 | + /** |
|
34 | + * @var LoaderDecoratorInterface $shared_loader |
|
35 | + */ |
|
36 | + private $shared_loader; |
|
37 | + |
|
38 | + |
|
39 | + |
|
40 | + /** |
|
41 | + * Loader constructor. |
|
42 | + * |
|
43 | + * @param LoaderDecoratorInterface|null $new_loader |
|
44 | + * @param LoaderDecoratorInterface|null $shared_loader |
|
45 | + * @throws InvalidInterfaceException |
|
46 | + * @throws InvalidArgumentException |
|
47 | + * @throws InvalidDataTypeException |
|
48 | + */ |
|
49 | + public function __construct(LoaderDecoratorInterface $new_loader = null, LoaderDecoratorInterface $shared_loader = null) |
|
50 | + { |
|
51 | + $this->new_loader = $this->setupNewLoader($new_loader); |
|
52 | + $this->shared_loader = $this->setupSharedLoader($shared_loader); |
|
53 | + } |
|
54 | + |
|
55 | + |
|
56 | + |
|
57 | + /** |
|
58 | + * @param LoaderDecoratorInterface|null $new_loader |
|
59 | + * @return CoreLoader|LoaderDecoratorInterface |
|
60 | + * @throws InvalidArgumentException |
|
61 | + */ |
|
62 | + private function setupNewLoader(LoaderDecoratorInterface $new_loader = null) |
|
63 | + { |
|
64 | + // if not already generated, create a standard loader |
|
65 | + if (! $new_loader instanceof LoaderDecoratorInterface) { |
|
66 | + $new_loader = new CoreLoader(EE_Registry::instance()); |
|
67 | + } |
|
68 | + return $new_loader; |
|
69 | + } |
|
70 | + |
|
71 | + |
|
72 | + |
|
73 | + /** |
|
74 | + * @param LoaderDecoratorInterface|null $shared_loader |
|
75 | + * @return CoreLoader|LoaderDecoratorInterface |
|
76 | + * @throws InvalidDataTypeException |
|
77 | + * @throws InvalidInterfaceException |
|
78 | + * @throws InvalidArgumentException |
|
79 | + */ |
|
80 | + private function setupSharedLoader(LoaderDecoratorInterface $shared_loader = null) |
|
81 | + { |
|
82 | + // if not already generated, create a caching loader |
|
83 | + if (! $shared_loader instanceof LoaderDecoratorInterface) { |
|
84 | + $shared_loader = new CachingLoader( |
|
85 | + new CoreLoader(EE_Registry::instance()), |
|
86 | + new LooseCollection('') |
|
87 | + ); |
|
88 | + } |
|
89 | + return $shared_loader; |
|
90 | + } |
|
91 | + |
|
92 | + |
|
93 | + |
|
94 | + /** |
|
95 | + * @return LoaderDecoratorInterface |
|
96 | + */ |
|
97 | + public function getNewLoader() |
|
98 | + { |
|
99 | + return $this->new_loader; |
|
100 | + } |
|
101 | + |
|
102 | + |
|
103 | + |
|
104 | + /** |
|
105 | + * @return LoaderDecoratorInterface |
|
106 | + */ |
|
107 | + public function getSharedLoader() |
|
108 | + { |
|
109 | + return $this->shared_loader; |
|
110 | + } |
|
111 | + |
|
112 | + |
|
113 | + |
|
114 | + /** |
|
115 | + * @param string $fqcn |
|
116 | + * @param array $arguments |
|
117 | + * @param bool $shared |
|
118 | + * @return mixed |
|
119 | + */ |
|
120 | + public function load($fqcn, $arguments = array(), $shared = true) |
|
121 | + { |
|
122 | + return $shared |
|
123 | + ? $this->getSharedLoader()->load($fqcn, $arguments) |
|
124 | + : $this->getNewLoader()->load($fqcn, $arguments); |
|
125 | + } |
|
126 | + |
|
127 | + |
|
128 | + |
|
129 | + /** |
|
130 | + * @param string $fqcn |
|
131 | + * @param array $arguments |
|
132 | + * @return mixed |
|
133 | + */ |
|
134 | + public function getNew($fqcn, $arguments = array()) |
|
135 | + { |
|
136 | + return $this->getNewLoader()->load($fqcn, $arguments); |
|
137 | + } |
|
138 | + |
|
139 | + |
|
140 | + |
|
141 | + /** |
|
142 | + * @param string $fqcn |
|
143 | + * @param array $arguments |
|
144 | + * @return mixed |
|
145 | + */ |
|
146 | + public function getShared($fqcn, $arguments = array()) |
|
147 | + { |
|
148 | + return $this->getSharedLoader()->load($fqcn, $arguments); |
|
149 | + } |
|
150 | + |
|
151 | + |
|
152 | + |
|
153 | + /** |
|
154 | + * calls reset() on loaders if that method exists |
|
155 | + */ |
|
156 | + public function reset() |
|
157 | + { |
|
158 | + $this->new_loader->reset(); |
|
159 | + $this->shared_loader->reset(); |
|
160 | + } |
|
161 | 161 | |
162 | 162 | } |
163 | 163 | // End of file Loader.php |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | private function setupNewLoader(LoaderDecoratorInterface $new_loader = null) |
63 | 63 | { |
64 | 64 | // if not already generated, create a standard loader |
65 | - if (! $new_loader instanceof LoaderDecoratorInterface) { |
|
65 | + if ( ! $new_loader instanceof LoaderDecoratorInterface) { |
|
66 | 66 | $new_loader = new CoreLoader(EE_Registry::instance()); |
67 | 67 | } |
68 | 68 | return $new_loader; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | private function setupSharedLoader(LoaderDecoratorInterface $shared_loader = null) |
81 | 81 | { |
82 | 82 | // if not already generated, create a caching loader |
83 | - if (! $shared_loader instanceof LoaderDecoratorInterface) { |
|
83 | + if ( ! $shared_loader instanceof LoaderDecoratorInterface) { |
|
84 | 84 | $shared_loader = new CachingLoader( |
85 | 85 | new CoreLoader(EE_Registry::instance()), |
86 | 86 | new LooseCollection('') |
@@ -9,19 +9,19 @@ |
||
9 | 9 | interface LoaderDecoratorInterface |
10 | 10 | { |
11 | 11 | |
12 | - /** |
|
13 | - * @param string $fqcn |
|
14 | - * @param array $arguments |
|
15 | - * @return mixed |
|
16 | - */ |
|
17 | - public function load($fqcn, $arguments = array()); |
|
12 | + /** |
|
13 | + * @param string $fqcn |
|
14 | + * @param array $arguments |
|
15 | + * @return mixed |
|
16 | + */ |
|
17 | + public function load($fqcn, $arguments = array()); |
|
18 | 18 | |
19 | 19 | |
20 | 20 | |
21 | - /** |
|
22 | - * calls reset() on loader if method exists |
|
23 | - */ |
|
24 | - public function reset(); |
|
21 | + /** |
|
22 | + * calls reset() on loader if method exists |
|
23 | + */ |
|
24 | + public function reset(); |
|
25 | 25 | |
26 | 26 | } |
27 | 27 | // End of file LoaderInterface.php |
@@ -9,39 +9,39 @@ |
||
9 | 9 | interface LoaderInterface |
10 | 10 | { |
11 | 11 | |
12 | - /** |
|
13 | - * Can be for instantiating a new instance of a class, |
|
14 | - * or for getting a shared instance of a class (default) |
|
15 | - * |
|
16 | - * @param string $fqcn |
|
17 | - * @param array $arguments |
|
18 | - * @param bool $shared |
|
19 | - * @return mixed |
|
20 | - */ |
|
21 | - public function load($fqcn, $arguments = array(), $shared = true); |
|
22 | - |
|
23 | - /** |
|
24 | - * Used for instantiating a new instance of a class |
|
25 | - * |
|
26 | - * @param string $fqcn |
|
27 | - * @param array $arguments |
|
28 | - * @return mixed |
|
29 | - */ |
|
30 | - public function getNew($fqcn, $arguments = array()); |
|
31 | - |
|
32 | - /** |
|
33 | - * Used for getting a shared instance of a class |
|
34 | - * |
|
35 | - * @param string $fqcn |
|
36 | - * @param array $arguments |
|
37 | - * @return mixed |
|
38 | - */ |
|
39 | - public function getShared($fqcn, $arguments = array()); |
|
40 | - |
|
41 | - /** |
|
42 | - * calls reset() on loader if method exists |
|
43 | - */ |
|
44 | - public function reset(); |
|
12 | + /** |
|
13 | + * Can be for instantiating a new instance of a class, |
|
14 | + * or for getting a shared instance of a class (default) |
|
15 | + * |
|
16 | + * @param string $fqcn |
|
17 | + * @param array $arguments |
|
18 | + * @param bool $shared |
|
19 | + * @return mixed |
|
20 | + */ |
|
21 | + public function load($fqcn, $arguments = array(), $shared = true); |
|
22 | + |
|
23 | + /** |
|
24 | + * Used for instantiating a new instance of a class |
|
25 | + * |
|
26 | + * @param string $fqcn |
|
27 | + * @param array $arguments |
|
28 | + * @return mixed |
|
29 | + */ |
|
30 | + public function getNew($fqcn, $arguments = array()); |
|
31 | + |
|
32 | + /** |
|
33 | + * Used for getting a shared instance of a class |
|
34 | + * |
|
35 | + * @param string $fqcn |
|
36 | + * @param array $arguments |
|
37 | + * @return mixed |
|
38 | + */ |
|
39 | + public function getShared($fqcn, $arguments = array()); |
|
40 | + |
|
41 | + /** |
|
42 | + * calls reset() on loader if method exists |
|
43 | + */ |
|
44 | + public function reset(); |
|
45 | 45 | |
46 | 46 | } |
47 | 47 | // End of file LoaderInterface.php |
@@ -22,114 +22,114 @@ |
||
22 | 22 | class CachingLoader extends LoaderDecorator |
23 | 23 | { |
24 | 24 | |
25 | - /** |
|
26 | - * @var CollectionInterface $cache |
|
27 | - */ |
|
28 | - protected $cache; |
|
29 | - |
|
30 | - /** |
|
31 | - * @var string $identifier |
|
32 | - */ |
|
33 | - protected $identifier; |
|
34 | - |
|
35 | - |
|
36 | - |
|
37 | - /** |
|
38 | - * CachingLoader constructor. |
|
39 | - * |
|
40 | - * @param LoaderDecoratorInterface $loader |
|
41 | - * @param CollectionInterface $cache |
|
42 | - * @param string $identifier |
|
43 | - * @throws InvalidDataTypeException |
|
44 | - */ |
|
45 | - public function __construct(LoaderDecoratorInterface $loader, CollectionInterface $cache, $identifier = '') |
|
46 | - { |
|
47 | - parent::__construct($loader); |
|
48 | - $this->cache = $cache; |
|
49 | - $this->setIdentifier($identifier); |
|
50 | - if ($this->identifier !== '') { |
|
51 | - // to only clear this cache, and assuming an identifier has been set, simply do the following: |
|
52 | - // do_action('AHEE__EventEspresso\core\services\loaders\CachingLoader__resetCache__IDENTIFIER'); |
|
53 | - // where "IDENTIFIER" = the string that was set during construction |
|
54 | - add_action( |
|
55 | - "AHEE__EventEspresso_core_services_loaders_CachingLoader__resetCache__{$identifier}", |
|
56 | - array($this, 'reset') |
|
57 | - ); |
|
58 | - } |
|
59 | - // to clear ALL caches, simply do the following: |
|
60 | - // do_action('AHEE__EventEspresso_core_services_loaders_CachingLoader__resetCache'); |
|
61 | - add_action( |
|
62 | - 'AHEE__EventEspresso_core_services_loaders_CachingLoader__resetCache', |
|
63 | - array($this, 'reset') |
|
64 | - ); |
|
65 | - } |
|
66 | - |
|
67 | - |
|
68 | - |
|
69 | - /** |
|
70 | - * @return string |
|
71 | - */ |
|
72 | - public function identifier() |
|
73 | - { |
|
74 | - return $this->identifier; |
|
75 | - } |
|
76 | - |
|
77 | - |
|
78 | - |
|
79 | - /** |
|
80 | - * @param string $identifier |
|
81 | - * @throws InvalidDataTypeException |
|
82 | - */ |
|
83 | - private function setIdentifier($identifier) |
|
84 | - { |
|
85 | - if ( ! is_string($identifier)) { |
|
86 | - throw new InvalidDataTypeException('$identifier', $identifier, 'string'); |
|
87 | - } |
|
88 | - $this->identifier = $identifier; |
|
89 | - } |
|
90 | - |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * @param string $fqcn |
|
95 | - * @param array $arguments |
|
96 | - * @return mixed |
|
97 | - * @throws InvalidEntityException |
|
98 | - * @throws ServiceNotFoundException |
|
99 | - */ |
|
100 | - public function load($fqcn, $arguments = array()) |
|
101 | - { |
|
102 | - $fqcn = ltrim($fqcn, '\\'); |
|
103 | - // caching can be turned off via the following code: |
|
104 | - // add_filter('FHEE__EventEspresso_core_services_loaders_CachingLoader__load__bypass_cache', '__return_true'); |
|
105 | - if( |
|
106 | - apply_filters( |
|
107 | - 'FHEE__EventEspresso_core_services_loaders_CachingLoader__load__bypass_cache', |
|
108 | - false, |
|
109 | - $this |
|
110 | - ) |
|
111 | - ){ |
|
112 | - return $this->loader->load($fqcn, $arguments); |
|
113 | - } |
|
114 | - $identifier = md5($fqcn . serialize($arguments)); |
|
115 | - if($this->cache->has($identifier)){ |
|
116 | - return $this->cache->get($identifier); |
|
117 | - } |
|
118 | - $object = $this->loader->load($fqcn, $arguments); |
|
119 | - $this->cache->add($object, $identifier); |
|
120 | - return $object; |
|
121 | - } |
|
122 | - |
|
123 | - |
|
124 | - |
|
125 | - /** |
|
126 | - * empties cache and calls reset() on loader if method exists |
|
127 | - */ |
|
128 | - public function reset() |
|
129 | - { |
|
130 | - $this->cache->detachAll(); |
|
131 | - $this->loader->reset(); |
|
132 | - } |
|
25 | + /** |
|
26 | + * @var CollectionInterface $cache |
|
27 | + */ |
|
28 | + protected $cache; |
|
29 | + |
|
30 | + /** |
|
31 | + * @var string $identifier |
|
32 | + */ |
|
33 | + protected $identifier; |
|
34 | + |
|
35 | + |
|
36 | + |
|
37 | + /** |
|
38 | + * CachingLoader constructor. |
|
39 | + * |
|
40 | + * @param LoaderDecoratorInterface $loader |
|
41 | + * @param CollectionInterface $cache |
|
42 | + * @param string $identifier |
|
43 | + * @throws InvalidDataTypeException |
|
44 | + */ |
|
45 | + public function __construct(LoaderDecoratorInterface $loader, CollectionInterface $cache, $identifier = '') |
|
46 | + { |
|
47 | + parent::__construct($loader); |
|
48 | + $this->cache = $cache; |
|
49 | + $this->setIdentifier($identifier); |
|
50 | + if ($this->identifier !== '') { |
|
51 | + // to only clear this cache, and assuming an identifier has been set, simply do the following: |
|
52 | + // do_action('AHEE__EventEspresso\core\services\loaders\CachingLoader__resetCache__IDENTIFIER'); |
|
53 | + // where "IDENTIFIER" = the string that was set during construction |
|
54 | + add_action( |
|
55 | + "AHEE__EventEspresso_core_services_loaders_CachingLoader__resetCache__{$identifier}", |
|
56 | + array($this, 'reset') |
|
57 | + ); |
|
58 | + } |
|
59 | + // to clear ALL caches, simply do the following: |
|
60 | + // do_action('AHEE__EventEspresso_core_services_loaders_CachingLoader__resetCache'); |
|
61 | + add_action( |
|
62 | + 'AHEE__EventEspresso_core_services_loaders_CachingLoader__resetCache', |
|
63 | + array($this, 'reset') |
|
64 | + ); |
|
65 | + } |
|
66 | + |
|
67 | + |
|
68 | + |
|
69 | + /** |
|
70 | + * @return string |
|
71 | + */ |
|
72 | + public function identifier() |
|
73 | + { |
|
74 | + return $this->identifier; |
|
75 | + } |
|
76 | + |
|
77 | + |
|
78 | + |
|
79 | + /** |
|
80 | + * @param string $identifier |
|
81 | + * @throws InvalidDataTypeException |
|
82 | + */ |
|
83 | + private function setIdentifier($identifier) |
|
84 | + { |
|
85 | + if ( ! is_string($identifier)) { |
|
86 | + throw new InvalidDataTypeException('$identifier', $identifier, 'string'); |
|
87 | + } |
|
88 | + $this->identifier = $identifier; |
|
89 | + } |
|
90 | + |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * @param string $fqcn |
|
95 | + * @param array $arguments |
|
96 | + * @return mixed |
|
97 | + * @throws InvalidEntityException |
|
98 | + * @throws ServiceNotFoundException |
|
99 | + */ |
|
100 | + public function load($fqcn, $arguments = array()) |
|
101 | + { |
|
102 | + $fqcn = ltrim($fqcn, '\\'); |
|
103 | + // caching can be turned off via the following code: |
|
104 | + // add_filter('FHEE__EventEspresso_core_services_loaders_CachingLoader__load__bypass_cache', '__return_true'); |
|
105 | + if( |
|
106 | + apply_filters( |
|
107 | + 'FHEE__EventEspresso_core_services_loaders_CachingLoader__load__bypass_cache', |
|
108 | + false, |
|
109 | + $this |
|
110 | + ) |
|
111 | + ){ |
|
112 | + return $this->loader->load($fqcn, $arguments); |
|
113 | + } |
|
114 | + $identifier = md5($fqcn . serialize($arguments)); |
|
115 | + if($this->cache->has($identifier)){ |
|
116 | + return $this->cache->get($identifier); |
|
117 | + } |
|
118 | + $object = $this->loader->load($fqcn, $arguments); |
|
119 | + $this->cache->add($object, $identifier); |
|
120 | + return $object; |
|
121 | + } |
|
122 | + |
|
123 | + |
|
124 | + |
|
125 | + /** |
|
126 | + * empties cache and calls reset() on loader if method exists |
|
127 | + */ |
|
128 | + public function reset() |
|
129 | + { |
|
130 | + $this->cache->detachAll(); |
|
131 | + $this->loader->reset(); |
|
132 | + } |
|
133 | 133 | |
134 | 134 | |
135 | 135 | } |
@@ -19,22 +19,22 @@ |
||
19 | 19 | { |
20 | 20 | |
21 | 21 | |
22 | - /** |
|
23 | - * @var LoaderDecoratorInterface $loader |
|
24 | - */ |
|
25 | - protected $loader; |
|
26 | - |
|
27 | - |
|
28 | - |
|
29 | - /** |
|
30 | - * LoaderDecorator constructor. |
|
31 | - * |
|
32 | - * @param LoaderDecoratorInterface $loader |
|
33 | - */ |
|
34 | - public function __construct(LoaderDecoratorInterface $loader) |
|
35 | - { |
|
36 | - $this->loader = $loader; |
|
37 | - } |
|
22 | + /** |
|
23 | + * @var LoaderDecoratorInterface $loader |
|
24 | + */ |
|
25 | + protected $loader; |
|
26 | + |
|
27 | + |
|
28 | + |
|
29 | + /** |
|
30 | + * LoaderDecorator constructor. |
|
31 | + * |
|
32 | + * @param LoaderDecoratorInterface $loader |
|
33 | + */ |
|
34 | + public function __construct(LoaderDecoratorInterface $loader) |
|
35 | + { |
|
36 | + $this->loader = $loader; |
|
37 | + } |
|
38 | 38 | |
39 | 39 | |
40 | 40 |