Completed
Pull Request — master (#1058)
by
unknown
11:21
created
core/services/commands/CommandBus.php 2 patches
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -34,74 +34,74 @@
 block discarded – undo
34 34
 class CommandBus implements CommandBusInterface
35 35
 {
36 36
 
37
-    /**
38
-     * @type CommandHandlerManagerInterface $command_handler_manager
39
-     */
40
-    private $command_handler_manager;
37
+	/**
38
+	 * @type CommandHandlerManagerInterface $command_handler_manager
39
+	 */
40
+	private $command_handler_manager;
41 41
 
42
-    /**
43
-     * @type CommandBusMiddlewareInterface[] $command_bus_middleware
44
-     */
45
-    private $command_bus_middleware;
42
+	/**
43
+	 * @type CommandBusMiddlewareInterface[] $command_bus_middleware
44
+	 */
45
+	private $command_bus_middleware;
46 46
 
47 47
 
48
-    /**
49
-     * CommandBus constructor
50
-     *
51
-     * @param CommandHandlerManagerInterface  $command_handler_manager
52
-     * @param CommandBusMiddlewareInterface[] $command_bus_middleware
53
-     */
54
-    public function __construct(
55
-        CommandHandlerManagerInterface $command_handler_manager,
56
-        array $command_bus_middleware = array()
57
-    ) {
58
-        $this->command_handler_manager = $command_handler_manager;
59
-        $this->command_bus_middleware = is_array($command_bus_middleware)
60
-            ? $command_bus_middleware
61
-            : array($command_bus_middleware);
62
-    }
48
+	/**
49
+	 * CommandBus constructor
50
+	 *
51
+	 * @param CommandHandlerManagerInterface  $command_handler_manager
52
+	 * @param CommandBusMiddlewareInterface[] $command_bus_middleware
53
+	 */
54
+	public function __construct(
55
+		CommandHandlerManagerInterface $command_handler_manager,
56
+		array $command_bus_middleware = array()
57
+	) {
58
+		$this->command_handler_manager = $command_handler_manager;
59
+		$this->command_bus_middleware = is_array($command_bus_middleware)
60
+			? $command_bus_middleware
61
+			: array($command_bus_middleware);
62
+	}
63 63
 
64 64
 
65
-    /**
66
-     * @return CommandHandlerManagerInterface
67
-     */
68
-    public function getCommandHandlerManager()
69
-    {
70
-        return $this->command_handler_manager;
71
-    }
65
+	/**
66
+	 * @return CommandHandlerManagerInterface
67
+	 */
68
+	public function getCommandHandlerManager()
69
+	{
70
+		return $this->command_handler_manager;
71
+	}
72 72
 
73 73
 
74
-    /**
75
-     * @param CommandInterface $command
76
-     * @return mixed
77
-     * @throws InvalidDataTypeException
78
-     * @throws InvalidCommandBusMiddlewareException
79
-     */
80
-    public function execute($command)
81
-    {
82
-        if (! $command instanceof CommandInterface) {
83
-            throw new InvalidDataTypeException(__METHOD__ . '( $command )', $command, 'CommandInterface');
84
-        }
85
-        // we're going to add the Command Handler as a callable
86
-        // that will get run at the end of our middleware stack
87
-        // can't pass $this to a Closure, so use a named variable
88
-        $command_bus = $this;
89
-        $middleware = static function($command) use ($command_bus) {
90
-            return $command_bus->getCommandHandlerManager()
91
-                               ->getCommandHandler($command, $command_bus)
92
-                               ->verify($command)
93
-                               ->handle($command);
94
-        };
95
-        // now build the rest of the middleware stack
96
-        while ($command_bus_middleware = array_pop($this->command_bus_middleware)) {
97
-            if (! $command_bus_middleware instanceof CommandBusMiddlewareInterface) {
98
-                throw new InvalidCommandBusMiddlewareException($command_bus_middleware);
99
-            }
100
-            $middleware = static function($command) use ($command_bus_middleware, $middleware) {
101
-                return $command_bus_middleware->handle($command, $middleware);
102
-            };
103
-        }
104
-        // and finally, pass the command into the stack and return the results
105
-        return $middleware($command);
106
-    }
74
+	/**
75
+	 * @param CommandInterface $command
76
+	 * @return mixed
77
+	 * @throws InvalidDataTypeException
78
+	 * @throws InvalidCommandBusMiddlewareException
79
+	 */
80
+	public function execute($command)
81
+	{
82
+		if (! $command instanceof CommandInterface) {
83
+			throw new InvalidDataTypeException(__METHOD__ . '( $command )', $command, 'CommandInterface');
84
+		}
85
+		// we're going to add the Command Handler as a callable
86
+		// that will get run at the end of our middleware stack
87
+		// can't pass $this to a Closure, so use a named variable
88
+		$command_bus = $this;
89
+		$middleware = static function($command) use ($command_bus) {
90
+			return $command_bus->getCommandHandlerManager()
91
+							   ->getCommandHandler($command, $command_bus)
92
+							   ->verify($command)
93
+							   ->handle($command);
94
+		};
95
+		// now build the rest of the middleware stack
96
+		while ($command_bus_middleware = array_pop($this->command_bus_middleware)) {
97
+			if (! $command_bus_middleware instanceof CommandBusMiddlewareInterface) {
98
+				throw new InvalidCommandBusMiddlewareException($command_bus_middleware);
99
+			}
100
+			$middleware = static function($command) use ($command_bus_middleware, $middleware) {
101
+				return $command_bus_middleware->handle($command, $middleware);
102
+			};
103
+		}
104
+		// and finally, pass the command into the stack and return the results
105
+		return $middleware($command);
106
+	}
107 107
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
      */
80 80
     public function execute($command)
81 81
     {
82
-        if (! $command instanceof CommandInterface) {
83
-            throw new InvalidDataTypeException(__METHOD__ . '( $command )', $command, 'CommandInterface');
82
+        if ( ! $command instanceof CommandInterface) {
83
+            throw new InvalidDataTypeException(__METHOD__.'( $command )', $command, 'CommandInterface');
84 84
         }
85 85
         // we're going to add the Command Handler as a callable
86 86
         // that will get run at the end of our middleware stack
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         };
95 95
         // now build the rest of the middleware stack
96 96
         while ($command_bus_middleware = array_pop($this->command_bus_middleware)) {
97
-            if (! $command_bus_middleware instanceof CommandBusMiddlewareInterface) {
97
+            if ( ! $command_bus_middleware instanceof CommandBusMiddlewareInterface) {
98 98
                 throw new InvalidCommandBusMiddlewareException($command_bus_middleware);
99 99
             }
100 100
             $middleware = static function($command) use ($command_bus_middleware, $middleware) {
Please login to merge, or discard this patch.
registration/UpdateRegistrationAndTransactionAfterChangeCommandHandler.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -19,31 +19,31 @@
 block discarded – undo
19 19
 {
20 20
 
21 21
 
22
-    /**
23
-     * @var UpdateRegistrationService $update_registration_service
24
-     */
25
-    private $update_registration_service;
26
-
27
-
28
-    /**
29
-     * Command constructor
30
-     *
31
-     * @param UpdateRegistrationService $update_registration_service
32
-     */
33
-    public function __construct(
34
-        UpdateRegistrationService $update_registration_service
35
-    ) {
36
-        $this->update_registration_service = $update_registration_service;
37
-    }
38
-
39
-
40
-    /**
41
-     * @param CommandInterface|UpdateRegistrationAndTransactionAfterChangeCommand $command
42
-     * @return boolean
43
-     * @throws InvalidEntityException
44
-     */
45
-    public function handle(CommandInterface $command)
46
-    {
47
-        return $this->update_registration_service->updateRegistrationAndTransaction($command->registration());
48
-    }
22
+	/**
23
+	 * @var UpdateRegistrationService $update_registration_service
24
+	 */
25
+	private $update_registration_service;
26
+
27
+
28
+	/**
29
+	 * Command constructor
30
+	 *
31
+	 * @param UpdateRegistrationService $update_registration_service
32
+	 */
33
+	public function __construct(
34
+		UpdateRegistrationService $update_registration_service
35
+	) {
36
+		$this->update_registration_service = $update_registration_service;
37
+	}
38
+
39
+
40
+	/**
41
+	 * @param CommandInterface|UpdateRegistrationAndTransactionAfterChangeCommand $command
42
+	 * @return boolean
43
+	 * @throws InvalidEntityException
44
+	 */
45
+	public function handle(CommandInterface $command)
46
+	{
47
+		return $this->update_registration_service->updateRegistrationAndTransaction($command->registration());
48
+	}
49 49
 }
Please login to merge, or discard this patch.
services/commands/registration/CopyRegistrationPaymentsCommandHandler.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -23,35 +23,35 @@
 block discarded – undo
23 23
 {
24 24
 
25 25
 
26
-    /**
27
-     * @var CopyRegistrationService $copy_registration_service
28
-     */
29
-    private $copy_registration_service;
30
-
31
-
32
-    /**
33
-     * Command constructor
34
-     *
35
-     * @param CopyRegistrationService $copy_registration_service
36
-     */
37
-    public function __construct(CopyRegistrationService $copy_registration_service)
38
-    {
39
-        $this->copy_registration_service = $copy_registration_service;
40
-    }
41
-
42
-
43
-    /**
44
-     * @param CommandInterface|CopyRegistrationPaymentsCommand $command
45
-     * @return boolean
46
-     * @throws EE_Error
47
-     * @throws UnexpectedEntityException
48
-     * @throws RuntimeException
49
-     */
50
-    public function handle(CommandInterface $command)
51
-    {
52
-        return $this->copy_registration_service->copyPaymentDetails(
53
-            $command->targetRegistration(),
54
-            $command->registrationToCopy()
55
-        );
56
-    }
26
+	/**
27
+	 * @var CopyRegistrationService $copy_registration_service
28
+	 */
29
+	private $copy_registration_service;
30
+
31
+
32
+	/**
33
+	 * Command constructor
34
+	 *
35
+	 * @param CopyRegistrationService $copy_registration_service
36
+	 */
37
+	public function __construct(CopyRegistrationService $copy_registration_service)
38
+	{
39
+		$this->copy_registration_service = $copy_registration_service;
40
+	}
41
+
42
+
43
+	/**
44
+	 * @param CommandInterface|CopyRegistrationPaymentsCommand $command
45
+	 * @return boolean
46
+	 * @throws EE_Error
47
+	 * @throws UnexpectedEntityException
48
+	 * @throws RuntimeException
49
+	 */
50
+	public function handle(CommandInterface $command)
51
+	{
52
+		return $this->copy_registration_service->copyPaymentDetails(
53
+			$command->targetRegistration(),
54
+			$command->registrationToCopy()
55
+		);
56
+	}
57 57
 }
Please login to merge, or discard this patch.
commands/registration/CancelRegistrationAndTicketLineItemCommandHandler.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -28,43 +28,43 @@
 block discarded – undo
28 28
 {
29 29
 
30 30
 
31
-    /**
32
-     * @var CancelTicketLineItemService $cancel_ticket_line_item_service
33
-     */
34
-    private $cancel_ticket_line_item_service;
31
+	/**
32
+	 * @var CancelTicketLineItemService $cancel_ticket_line_item_service
33
+	 */
34
+	private $cancel_ticket_line_item_service;
35 35
 
36 36
 
37
-    /**
38
-     * Command constructor
39
-     *
40
-     * @param CancelTicketLineItemService $cancel_ticket_line_item_service
41
-     */
42
-    public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service)
43
-    {
44
-        $this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service;
45
-    }
37
+	/**
38
+	 * Command constructor
39
+	 *
40
+	 * @param CancelTicketLineItemService $cancel_ticket_line_item_service
41
+	 */
42
+	public function __construct(CancelTicketLineItemService $cancel_ticket_line_item_service)
43
+	{
44
+		$this->cancel_ticket_line_item_service = $cancel_ticket_line_item_service;
45
+	}
46 46
 
47 47
 
48
-    /**
49
-     * @param CommandInterface|CancelRegistrationAndTicketLineItemCommand $command
50
-     * @return boolean
51
-     * @throws DomainException
52
-     * @throws EE_Error
53
-     * @throws EntityNotFoundException
54
-     * @throws InvalidDataTypeException
55
-     * @throws InvalidInterfaceException
56
-     * @throws UnexpectedEntityException
57
-     * @throws InvalidArgumentException
58
-     * @throws ReflectionException
59
-     * @throws RuntimeException
60
-     */
61
-    public function handle(CommandInterface $command)
62
-    {
63
-        $registration = $command->registration();
64
-        $this->cancel_ticket_line_item_service->forRegistration($registration);
65
-        // cancel original registration
66
-        $registration->set_status(EEM_Registration::status_id_cancelled);
67
-        $registration->save();
68
-        return true;
69
-    }
48
+	/**
49
+	 * @param CommandInterface|CancelRegistrationAndTicketLineItemCommand $command
50
+	 * @return boolean
51
+	 * @throws DomainException
52
+	 * @throws EE_Error
53
+	 * @throws EntityNotFoundException
54
+	 * @throws InvalidDataTypeException
55
+	 * @throws InvalidInterfaceException
56
+	 * @throws UnexpectedEntityException
57
+	 * @throws InvalidArgumentException
58
+	 * @throws ReflectionException
59
+	 * @throws RuntimeException
60
+	 */
61
+	public function handle(CommandInterface $command)
62
+	{
63
+		$registration = $command->registration();
64
+		$this->cancel_ticket_line_item_service->forRegistration($registration);
65
+		// cancel original registration
66
+		$registration->set_status(EEM_Registration::status_id_cancelled);
67
+		$registration->save();
68
+		return true;
69
+	}
70 70
 }
Please login to merge, or discard this patch.
services/commands/registration/CopyRegistrationDetailsCommandHandler.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -24,37 +24,37 @@
 block discarded – undo
24 24
 {
25 25
 
26 26
 
27
-    /**
28
-     * @var CopyRegistrationService $copy_registration_service
29
-     */
30
-    private $copy_registration_service;
31
-
32
-
33
-    /**
34
-     * Command constructor
35
-     *
36
-     * @param CopyRegistrationService $copy_registration_service
37
-     */
38
-    public function __construct(CopyRegistrationService $copy_registration_service)
39
-    {
40
-        $this->copy_registration_service = $copy_registration_service;
41
-    }
42
-
43
-
44
-    /**
45
-     * @param CommandInterface|CopyRegistrationDetailsCommand $command
46
-     * @return boolean
47
-     * @throws InvalidEntityException
48
-     * @throws EE_Error
49
-     * @throws EntityNotFoundException
50
-     * @throws UnexpectedEntityException
51
-     * @throws RuntimeException
52
-     */
53
-    public function handle(CommandInterface $command)
54
-    {
55
-        return $this->copy_registration_service->copyRegistrationDetails(
56
-            $command->targetRegistration(),
57
-            $command->registrationToCopy()
58
-        );
59
-    }
27
+	/**
28
+	 * @var CopyRegistrationService $copy_registration_service
29
+	 */
30
+	private $copy_registration_service;
31
+
32
+
33
+	/**
34
+	 * Command constructor
35
+	 *
36
+	 * @param CopyRegistrationService $copy_registration_service
37
+	 */
38
+	public function __construct(CopyRegistrationService $copy_registration_service)
39
+	{
40
+		$this->copy_registration_service = $copy_registration_service;
41
+	}
42
+
43
+
44
+	/**
45
+	 * @param CommandInterface|CopyRegistrationDetailsCommand $command
46
+	 * @return boolean
47
+	 * @throws InvalidEntityException
48
+	 * @throws EE_Error
49
+	 * @throws EntityNotFoundException
50
+	 * @throws UnexpectedEntityException
51
+	 * @throws RuntimeException
52
+	 */
53
+	public function handle(CommandInterface $command)
54
+	{
55
+		return $this->copy_registration_service->copyRegistrationDetails(
56
+			$command->targetRegistration(),
57
+			$command->registrationToCopy()
58
+		);
59
+	}
60 60
 }
Please login to merge, or discard this patch.