@@ -16,36 +16,36 @@ |
||
16 | 16 | */ |
17 | 17 | class CommandFactory implements CommandFactoryInterface |
18 | 18 | { |
19 | - /** |
|
20 | - * @var LoaderInterface $loader |
|
21 | - */ |
|
22 | - private $loader; |
|
19 | + /** |
|
20 | + * @var LoaderInterface $loader |
|
21 | + */ |
|
22 | + private $loader; |
|
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * CommandFactory constructor |
|
27 | - * |
|
28 | - * @param LoaderInterface $loader |
|
29 | - * @throws InvalidDataTypeException |
|
30 | - * @throws InvalidInterfaceException |
|
31 | - * @throws InvalidArgumentException |
|
32 | - */ |
|
33 | - public function __construct(LoaderInterface $loader = null) |
|
34 | - { |
|
35 | - $this->loader = $loader; |
|
36 | - } |
|
25 | + /** |
|
26 | + * CommandFactory constructor |
|
27 | + * |
|
28 | + * @param LoaderInterface $loader |
|
29 | + * @throws InvalidDataTypeException |
|
30 | + * @throws InvalidInterfaceException |
|
31 | + * @throws InvalidArgumentException |
|
32 | + */ |
|
33 | + public function __construct(LoaderInterface $loader = null) |
|
34 | + { |
|
35 | + $this->loader = $loader; |
|
36 | + } |
|
37 | 37 | |
38 | 38 | |
39 | - /** |
|
40 | - * @param string $command_fqcn |
|
41 | - * @param array $arguments |
|
42 | - * @return mixed |
|
43 | - * @throws InvalidArgumentException |
|
44 | - * @throws InvalidDataTypeException |
|
45 | - * @throws InvalidInterfaceException |
|
46 | - */ |
|
47 | - public function getNew($command_fqcn, $arguments = array()) |
|
48 | - { |
|
49 | - return $this->loader->getNew($command_fqcn, $arguments); |
|
50 | - } |
|
39 | + /** |
|
40 | + * @param string $command_fqcn |
|
41 | + * @param array $arguments |
|
42 | + * @return mixed |
|
43 | + * @throws InvalidArgumentException |
|
44 | + * @throws InvalidDataTypeException |
|
45 | + * @throws InvalidInterfaceException |
|
46 | + */ |
|
47 | + public function getNew($command_fqcn, $arguments = array()) |
|
48 | + { |
|
49 | + return $this->loader->getNew($command_fqcn, $arguments); |
|
50 | + } |
|
51 | 51 | } |
@@ -16,26 +16,26 @@ |
||
16 | 16 | */ |
17 | 17 | abstract class Command implements CommandInterface |
18 | 18 | { |
19 | - /* |
|
19 | + /* |
|
20 | 20 | * @var CapCheckInterface $cap_check |
21 | 21 | */ |
22 | - protected $cap_check; |
|
22 | + protected $cap_check; |
|
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * @return mixed |
|
27 | - */ |
|
28 | - public function getCapCheck() |
|
29 | - { |
|
30 | - return $this->cap_check; |
|
31 | - } |
|
25 | + /** |
|
26 | + * @return mixed |
|
27 | + */ |
|
28 | + public function getCapCheck() |
|
29 | + { |
|
30 | + return $this->cap_check; |
|
31 | + } |
|
32 | 32 | |
33 | 33 | |
34 | - /** |
|
35 | - * @param CapCheckInterface $cap_check |
|
36 | - */ |
|
37 | - public function setCapCheck(CapCheckInterface $cap_check) |
|
38 | - { |
|
39 | - $this->cap_check = $cap_check; |
|
40 | - } |
|
34 | + /** |
|
35 | + * @param CapCheckInterface $cap_check |
|
36 | + */ |
|
37 | + public function setCapCheck(CapCheckInterface $cap_check) |
|
38 | + { |
|
39 | + $this->cap_check = $cap_check; |
|
40 | + } |
|
41 | 41 | } |
@@ -9,26 +9,26 @@ |
||
9 | 9 | */ |
10 | 10 | interface CommandHandlerManagerInterface |
11 | 11 | { |
12 | - /** |
|
13 | - * !!! IMPORTANT !!! |
|
14 | - * If overriding the default CommandHandler for a Command, |
|
15 | - * be sure to also override CommandHandler::verify(), |
|
16 | - * or else an Exception will be thrown when the CommandBus |
|
17 | - * attempts to verify that the incoming Command matches the Handler |
|
18 | - * |
|
19 | - * @param CommandHandlerInterface $command_handler |
|
20 | - * @param string $fqcn_for_command Fully Qualified ClassName for Command |
|
21 | - * @return void |
|
22 | - * @throws InvalidCommandHandlerException |
|
23 | - */ |
|
24 | - public function addCommandHandler(CommandHandlerInterface $command_handler, $fqcn_for_command = ''); |
|
12 | + /** |
|
13 | + * !!! IMPORTANT !!! |
|
14 | + * If overriding the default CommandHandler for a Command, |
|
15 | + * be sure to also override CommandHandler::verify(), |
|
16 | + * or else an Exception will be thrown when the CommandBus |
|
17 | + * attempts to verify that the incoming Command matches the Handler |
|
18 | + * |
|
19 | + * @param CommandHandlerInterface $command_handler |
|
20 | + * @param string $fqcn_for_command Fully Qualified ClassName for Command |
|
21 | + * @return void |
|
22 | + * @throws InvalidCommandHandlerException |
|
23 | + */ |
|
24 | + public function addCommandHandler(CommandHandlerInterface $command_handler, $fqcn_for_command = ''); |
|
25 | 25 | |
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * @param CommandInterface $command |
|
30 | - * @param CommandBusInterface $command_bus |
|
31 | - * @return mixed |
|
32 | - */ |
|
33 | - public function getCommandHandler(CommandInterface $command, CommandBusInterface $command_bus = null); |
|
28 | + /** |
|
29 | + * @param CommandInterface $command |
|
30 | + * @param CommandBusInterface $command_bus |
|
31 | + * @return mixed |
|
32 | + */ |
|
33 | + public function getCommandHandler(CommandInterface $command, CommandBusInterface $command_bus = null); |
|
34 | 34 | } |
@@ -12,24 +12,24 @@ |
||
12 | 12 | */ |
13 | 13 | class InvalidCommandHandlerException extends \DomainException |
14 | 14 | { |
15 | - /** |
|
16 | - * @access public |
|
17 | - * @param string $command_name |
|
18 | - * @param string $message |
|
19 | - * @param int $code |
|
20 | - * @param \Exception $previous |
|
21 | - */ |
|
22 | - public function __construct($command_name, $message = '', $code = 0, \Exception $previous = null) |
|
23 | - { |
|
24 | - if (empty($message)) { |
|
25 | - $message = sprintf( |
|
26 | - esc_html__( |
|
27 | - 'The supplied Command Handler "%1$s" does not have a valid name. It should be in the following format: "{CommandName}Handler" ', |
|
28 | - 'event_espresso' |
|
29 | - ), |
|
30 | - $command_name |
|
31 | - ); |
|
32 | - } |
|
33 | - parent::__construct($message, $code, $previous); |
|
34 | - } |
|
15 | + /** |
|
16 | + * @access public |
|
17 | + * @param string $command_name |
|
18 | + * @param string $message |
|
19 | + * @param int $code |
|
20 | + * @param \Exception $previous |
|
21 | + */ |
|
22 | + public function __construct($command_name, $message = '', $code = 0, \Exception $previous = null) |
|
23 | + { |
|
24 | + if (empty($message)) { |
|
25 | + $message = sprintf( |
|
26 | + esc_html__( |
|
27 | + 'The supplied Command Handler "%1$s" does not have a valid name. It should be in the following format: "{CommandName}Handler" ', |
|
28 | + 'event_espresso' |
|
29 | + ), |
|
30 | + $command_name |
|
31 | + ); |
|
32 | + } |
|
33 | + parent::__construct($message, $code, $previous); |
|
34 | + } |
|
35 | 35 | } |
@@ -14,48 +14,48 @@ |
||
14 | 14 | */ |
15 | 15 | class CopyRegistrationDetailsCommand extends Command |
16 | 16 | { |
17 | - /** |
|
18 | - * @var \EE_Registration $target_registration |
|
19 | - */ |
|
20 | - private $target_registration; |
|
21 | - |
|
22 | - |
|
23 | - /** |
|
24 | - * @var \EE_Registration $registration_to_copy |
|
25 | - */ |
|
26 | - private $registration_to_copy; |
|
27 | - |
|
28 | - |
|
29 | - /** |
|
30 | - * CopyRegistrationDetailsCommand constructor. |
|
31 | - * |
|
32 | - * @param \EE_Registration $target_registration |
|
33 | - * @param \EE_Registration $registration_to_copy |
|
34 | - * v |
|
35 | - */ |
|
36 | - public function __construct( |
|
37 | - \EE_Registration $target_registration, |
|
38 | - \EE_Registration $registration_to_copy |
|
39 | - ) { |
|
40 | - $this->target_registration = $target_registration; |
|
41 | - $this->registration_to_copy = $registration_to_copy; |
|
42 | - } |
|
43 | - |
|
44 | - |
|
45 | - /** |
|
46 | - * @return \EE_Registration |
|
47 | - */ |
|
48 | - public function targetRegistration() |
|
49 | - { |
|
50 | - return $this->target_registration; |
|
51 | - } |
|
52 | - |
|
53 | - |
|
54 | - /** |
|
55 | - * @return \EE_Registration |
|
56 | - */ |
|
57 | - public function registrationToCopy() |
|
58 | - { |
|
59 | - return $this->registration_to_copy; |
|
60 | - } |
|
17 | + /** |
|
18 | + * @var \EE_Registration $target_registration |
|
19 | + */ |
|
20 | + private $target_registration; |
|
21 | + |
|
22 | + |
|
23 | + /** |
|
24 | + * @var \EE_Registration $registration_to_copy |
|
25 | + */ |
|
26 | + private $registration_to_copy; |
|
27 | + |
|
28 | + |
|
29 | + /** |
|
30 | + * CopyRegistrationDetailsCommand constructor. |
|
31 | + * |
|
32 | + * @param \EE_Registration $target_registration |
|
33 | + * @param \EE_Registration $registration_to_copy |
|
34 | + * v |
|
35 | + */ |
|
36 | + public function __construct( |
|
37 | + \EE_Registration $target_registration, |
|
38 | + \EE_Registration $registration_to_copy |
|
39 | + ) { |
|
40 | + $this->target_registration = $target_registration; |
|
41 | + $this->registration_to_copy = $registration_to_copy; |
|
42 | + } |
|
43 | + |
|
44 | + |
|
45 | + /** |
|
46 | + * @return \EE_Registration |
|
47 | + */ |
|
48 | + public function targetRegistration() |
|
49 | + { |
|
50 | + return $this->target_registration; |
|
51 | + } |
|
52 | + |
|
53 | + |
|
54 | + /** |
|
55 | + * @return \EE_Registration |
|
56 | + */ |
|
57 | + public function registrationToCopy() |
|
58 | + { |
|
59 | + return $this->registration_to_copy; |
|
60 | + } |
|
61 | 61 | } |
@@ -14,29 +14,29 @@ |
||
14 | 14 | */ |
15 | 15 | abstract class SingleRegistrationCommand extends Command |
16 | 16 | { |
17 | - /** |
|
18 | - * @var \EE_Registration $registration |
|
19 | - */ |
|
20 | - private $registration; |
|
17 | + /** |
|
18 | + * @var \EE_Registration $registration |
|
19 | + */ |
|
20 | + private $registration; |
|
21 | 21 | |
22 | 22 | |
23 | - /** |
|
24 | - * CancelRegistrationAndTicketLineItemCommand constructor. |
|
25 | - * |
|
26 | - * @param \EE_Registration $registration |
|
27 | - */ |
|
28 | - public function __construct( |
|
29 | - \EE_Registration $registration |
|
30 | - ) { |
|
31 | - $this->registration = $registration; |
|
32 | - } |
|
23 | + /** |
|
24 | + * CancelRegistrationAndTicketLineItemCommand constructor. |
|
25 | + * |
|
26 | + * @param \EE_Registration $registration |
|
27 | + */ |
|
28 | + public function __construct( |
|
29 | + \EE_Registration $registration |
|
30 | + ) { |
|
31 | + $this->registration = $registration; |
|
32 | + } |
|
33 | 33 | |
34 | 34 | |
35 | - /** |
|
36 | - * @return \EE_Registration |
|
37 | - */ |
|
38 | - public function registration() |
|
39 | - { |
|
40 | - return $this->registration; |
|
41 | - } |
|
35 | + /** |
|
36 | + * @return \EE_Registration |
|
37 | + */ |
|
38 | + public function registration() |
|
39 | + { |
|
40 | + return $this->registration; |
|
41 | + } |
|
42 | 42 | } |
@@ -15,41 +15,41 @@ |
||
15 | 15 | */ |
16 | 16 | class AddonCollection extends Collection |
17 | 17 | { |
18 | - /** |
|
19 | - * @throws InvalidInterfaceException |
|
20 | - */ |
|
21 | - public function __construct() |
|
22 | - { |
|
23 | - parent::__construct(AddonApiVersion::class); |
|
24 | - } |
|
25 | - |
|
26 | - |
|
27 | - /** |
|
28 | - * @param AddonApiVersion $addon |
|
29 | - * @return bool |
|
30 | - */ |
|
31 | - public function addAddon(AddonApiVersion $addon): bool |
|
32 | - { |
|
33 | - return $this->add($addon, $addon->slug()); |
|
34 | - } |
|
35 | - |
|
36 | - |
|
37 | - /** |
|
38 | - * @param string $addon_slug |
|
39 | - * @return AddonApiVersion|null |
|
40 | - */ |
|
41 | - public function getAddon(string $addon_slug): ?AddonApiVersion |
|
42 | - { |
|
43 | - return $this->get($addon_slug); |
|
44 | - } |
|
45 | - |
|
46 | - |
|
47 | - /** |
|
48 | - * @param string $addon_slug |
|
49 | - * @return bool |
|
50 | - */ |
|
51 | - public function hasAddon(string $addon_slug): bool |
|
52 | - { |
|
53 | - return $this->has($addon_slug); |
|
54 | - } |
|
18 | + /** |
|
19 | + * @throws InvalidInterfaceException |
|
20 | + */ |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | + parent::__construct(AddonApiVersion::class); |
|
24 | + } |
|
25 | + |
|
26 | + |
|
27 | + /** |
|
28 | + * @param AddonApiVersion $addon |
|
29 | + * @return bool |
|
30 | + */ |
|
31 | + public function addAddon(AddonApiVersion $addon): bool |
|
32 | + { |
|
33 | + return $this->add($addon, $addon->slug()); |
|
34 | + } |
|
35 | + |
|
36 | + |
|
37 | + /** |
|
38 | + * @param string $addon_slug |
|
39 | + * @return AddonApiVersion|null |
|
40 | + */ |
|
41 | + public function getAddon(string $addon_slug): ?AddonApiVersion |
|
42 | + { |
|
43 | + return $this->get($addon_slug); |
|
44 | + } |
|
45 | + |
|
46 | + |
|
47 | + /** |
|
48 | + * @param string $addon_slug |
|
49 | + * @return bool |
|
50 | + */ |
|
51 | + public function hasAddon(string $addon_slug): bool |
|
52 | + { |
|
53 | + return $this->has($addon_slug); |
|
54 | + } |
|
55 | 55 | } |
@@ -17,46 +17,46 @@ |
||
17 | 17 | */ |
18 | 18 | abstract class BlockManager |
19 | 19 | { |
20 | - /** |
|
21 | - * @var CollectionInterface|BlockInterface[] $blocks |
|
22 | - */ |
|
23 | - protected $blocks; |
|
24 | - |
|
25 | - /** |
|
26 | - * @var RequestInterface $request |
|
27 | - */ |
|
28 | - protected $request; |
|
29 | - |
|
30 | - |
|
31 | - |
|
32 | - /** |
|
33 | - * BlockManager constructor. |
|
34 | - * |
|
35 | - * @param BlockCollection $blocks |
|
36 | - * @param RequestInterface $request |
|
37 | - */ |
|
38 | - public function __construct( |
|
39 | - BlockCollection $blocks, |
|
40 | - RequestInterface $request |
|
41 | - ) { |
|
42 | - $this->blocks = $blocks; |
|
43 | - $this->request = $request; |
|
44 | - add_action($this->initHook(), array($this, 'initialize')); |
|
45 | - } |
|
46 | - |
|
47 | - |
|
48 | - /** |
|
49 | - * Returns the name of a hookpoint to be used to call initialize() |
|
50 | - * |
|
51 | - * @return string |
|
52 | - */ |
|
53 | - abstract public function initHook(); |
|
54 | - |
|
55 | - |
|
56 | - /** |
|
57 | - * Perform any early setup required for block editors to functions |
|
58 | - * |
|
59 | - * @return void |
|
60 | - */ |
|
61 | - abstract public function initialize(); |
|
20 | + /** |
|
21 | + * @var CollectionInterface|BlockInterface[] $blocks |
|
22 | + */ |
|
23 | + protected $blocks; |
|
24 | + |
|
25 | + /** |
|
26 | + * @var RequestInterface $request |
|
27 | + */ |
|
28 | + protected $request; |
|
29 | + |
|
30 | + |
|
31 | + |
|
32 | + /** |
|
33 | + * BlockManager constructor. |
|
34 | + * |
|
35 | + * @param BlockCollection $blocks |
|
36 | + * @param RequestInterface $request |
|
37 | + */ |
|
38 | + public function __construct( |
|
39 | + BlockCollection $blocks, |
|
40 | + RequestInterface $request |
|
41 | + ) { |
|
42 | + $this->blocks = $blocks; |
|
43 | + $this->request = $request; |
|
44 | + add_action($this->initHook(), array($this, 'initialize')); |
|
45 | + } |
|
46 | + |
|
47 | + |
|
48 | + /** |
|
49 | + * Returns the name of a hookpoint to be used to call initialize() |
|
50 | + * |
|
51 | + * @return string |
|
52 | + */ |
|
53 | + abstract public function initHook(); |
|
54 | + |
|
55 | + |
|
56 | + /** |
|
57 | + * Perform any early setup required for block editors to functions |
|
58 | + * |
|
59 | + * @return void |
|
60 | + */ |
|
61 | + abstract public function initialize(); |
|
62 | 62 | } |
@@ -13,11 +13,11 @@ |
||
13 | 13 | */ |
14 | 14 | interface BlockRendererInterface |
15 | 15 | { |
16 | - /** |
|
17 | - * This receives an array of attributes and returns rendered content for the block using those attributes. |
|
18 | - * |
|
19 | - * @param array $attributes |
|
20 | - * @return string Rendered Content |
|
21 | - */ |
|
22 | - public function render(array $attributes); |
|
16 | + /** |
|
17 | + * This receives an array of attributes and returns rendered content for the block using those attributes. |
|
18 | + * |
|
19 | + * @param array $attributes |
|
20 | + * @return string Rendered Content |
|
21 | + */ |
|
22 | + public function render(array $attributes); |
|
23 | 23 | } |