Completed
Branch FET/consistent-reg-admin-page-... (c5d240)
by
unknown
26:13 queued 17:48
created
core/services/commands/CompositeCommandHandler.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -15,53 +15,53 @@
 block discarded – undo
15 15
 abstract class CompositeCommandHandler extends CommandHandler
16 16
 {
17 17
 
18
-    /**
19
-     * @type CommandBusInterface $command_bus
20
-     */
21
-    private $command_bus;
18
+	/**
19
+	 * @type CommandBusInterface $command_bus
20
+	 */
21
+	private $command_bus;
22 22
 
23
-    /**
24
-     * @type CommandFactoryInterface $command_factory
25
-     */
26
-    private $command_factory;
23
+	/**
24
+	 * @type CommandFactoryInterface $command_factory
25
+	 */
26
+	private $command_factory;
27 27
 
28 28
 
29
-    /**
30
-     * CompositeCommandHandler constructor.
31
-     *
32
-     * @param CommandBusInterface     $command_bus
33
-     * @param CommandFactoryInterface $command_factory
34
-     */
35
-    public function __construct(CommandBusInterface $command_bus, CommandFactoryInterface $command_factory)
36
-    {
37
-        $this->command_bus = $command_bus;
38
-        $this->command_factory = $command_factory;
39
-    }
29
+	/**
30
+	 * CompositeCommandHandler constructor.
31
+	 *
32
+	 * @param CommandBusInterface     $command_bus
33
+	 * @param CommandFactoryInterface $command_factory
34
+	 */
35
+	public function __construct(CommandBusInterface $command_bus, CommandFactoryInterface $command_factory)
36
+	{
37
+		$this->command_bus = $command_bus;
38
+		$this->command_factory = $command_factory;
39
+	}
40 40
 
41 41
 
42
-    /**
43
-     * @param CommandBusInterface $command_bus
44
-     */
45
-    public function setCommandBus(CommandBusInterface $command_bus)
46
-    {
47
-        $this->command_bus = $command_bus;
48
-    }
42
+	/**
43
+	 * @param CommandBusInterface $command_bus
44
+	 */
45
+	public function setCommandBus(CommandBusInterface $command_bus)
46
+	{
47
+		$this->command_bus = $command_bus;
48
+	}
49 49
 
50 50
 
51
-    /**
52
-     * @return CommandBusInterface
53
-     */
54
-    public function commandBus()
55
-    {
56
-        return $this->command_bus;
57
-    }
51
+	/**
52
+	 * @return CommandBusInterface
53
+	 */
54
+	public function commandBus()
55
+	{
56
+		return $this->command_bus;
57
+	}
58 58
 
59 59
 
60
-    /**
61
-     * @return CommandFactoryInterface
62
-     */
63
-    public function commandFactory()
64
-    {
65
-        return $this->command_factory;
66
-    }
60
+	/**
61
+	 * @return CommandFactoryInterface
62
+	 */
63
+	public function commandFactory()
64
+	{
65
+		return $this->command_factory;
66
+	}
67 67
 }
Please login to merge, or discard this patch.
core/services/commands/CommandHandlerNotFoundException.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -13,21 +13,21 @@
 block discarded – undo
13 13
 class CommandHandlerNotFoundException extends \OutOfBoundsException
14 14
 {
15 15
 
16
-    /**
17
-     * @access public
18
-     * @param  string     $command_handler_name
19
-     * @param  string     $message
20
-     * @param  int        $code
21
-     * @param  \Exception $previous
22
-     */
23
-    public function __construct($command_handler_name, $message = '', $code = 0, \Exception $previous = null)
24
-    {
25
-        if (empty($message)) {
26
-            $message = sprintf(
27
-                __('The requested Command Handler "%1$s" could not be located or does not exist.', 'event_espresso'),
28
-                $command_handler_name
29
-            );
30
-        }
31
-        parent::__construct($message, $code, $previous);
32
-    }
16
+	/**
17
+	 * @access public
18
+	 * @param  string     $command_handler_name
19
+	 * @param  string     $message
20
+	 * @param  int        $code
21
+	 * @param  \Exception $previous
22
+	 */
23
+	public function __construct($command_handler_name, $message = '', $code = 0, \Exception $previous = null)
24
+	{
25
+		if (empty($message)) {
26
+			$message = sprintf(
27
+				__('The requested Command Handler "%1$s" could not be located or does not exist.', 'event_espresso'),
28
+				$command_handler_name
29
+			);
30
+		}
31
+		parent::__construct($message, $code, $previous);
32
+	}
33 33
 }
Please login to merge, or discard this patch.
core/services/commands/registration/SingleRegistrationCommand.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -16,29 +16,29 @@
 block discarded – undo
16 16
 {
17 17
 
18 18
 
19
-    /**
20
-     * @var \EE_Registration $registration
21
-     */
22
-    private $registration;
23
-
24
-
25
-    /**
26
-     * CancelRegistrationAndTicketLineItemCommand constructor.
27
-     *
28
-     * @param \EE_Registration $registration
29
-     */
30
-    public function __construct(
31
-        \EE_Registration $registration
32
-    ) {
33
-        $this->registration = $registration;
34
-    }
35
-
36
-
37
-    /**
38
-     * @return \EE_Registration
39
-     */
40
-    public function registration()
41
-    {
42
-        return $this->registration;
43
-    }
19
+	/**
20
+	 * @var \EE_Registration $registration
21
+	 */
22
+	private $registration;
23
+
24
+
25
+	/**
26
+	 * CancelRegistrationAndTicketLineItemCommand constructor.
27
+	 *
28
+	 * @param \EE_Registration $registration
29
+	 */
30
+	public function __construct(
31
+		\EE_Registration $registration
32
+	) {
33
+		$this->registration = $registration;
34
+	}
35
+
36
+
37
+	/**
38
+	 * @return \EE_Registration
39
+	 */
40
+	public function registration()
41
+	{
42
+		return $this->registration;
43
+	}
44 44
 }
Please login to merge, or discard this patch.
core/services/commands/registration/CopyRegistrationDetailsCommand.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -16,48 +16,48 @@
 block discarded – undo
16 16
 {
17 17
 
18 18
 
19
-    /**
20
-     * @var \EE_Registration $target_registration
21
-     */
22
-    private $target_registration;
23
-
24
-
25
-    /**
26
-     * @var \EE_Registration $registration_to_copy
27
-     */
28
-    private $registration_to_copy;
29
-
30
-
31
-    /**
32
-     * CopyRegistrationDetailsCommand constructor.
33
-     *
34
-     * @param \EE_Registration $target_registration
35
-     * @param \EE_Registration $registration_to_copy
36
-     * v
37
-     */
38
-    public function __construct(
39
-        \EE_Registration $target_registration,
40
-        \EE_Registration $registration_to_copy
41
-    ) {
42
-        $this->target_registration = $target_registration;
43
-        $this->registration_to_copy = $registration_to_copy;
44
-    }
45
-
46
-
47
-    /**
48
-     * @return \EE_Registration
49
-     */
50
-    public function targetRegistration()
51
-    {
52
-        return $this->target_registration;
53
-    }
54
-
55
-
56
-    /**
57
-     * @return \EE_Registration
58
-     */
59
-    public function registrationToCopy()
60
-    {
61
-        return $this->registration_to_copy;
62
-    }
19
+	/**
20
+	 * @var \EE_Registration $target_registration
21
+	 */
22
+	private $target_registration;
23
+
24
+
25
+	/**
26
+	 * @var \EE_Registration $registration_to_copy
27
+	 */
28
+	private $registration_to_copy;
29
+
30
+
31
+	/**
32
+	 * CopyRegistrationDetailsCommand constructor.
33
+	 *
34
+	 * @param \EE_Registration $target_registration
35
+	 * @param \EE_Registration $registration_to_copy
36
+	 * v
37
+	 */
38
+	public function __construct(
39
+		\EE_Registration $target_registration,
40
+		\EE_Registration $registration_to_copy
41
+	) {
42
+		$this->target_registration = $target_registration;
43
+		$this->registration_to_copy = $registration_to_copy;
44
+	}
45
+
46
+
47
+	/**
48
+	 * @return \EE_Registration
49
+	 */
50
+	public function targetRegistration()
51
+	{
52
+		return $this->target_registration;
53
+	}
54
+
55
+
56
+	/**
57
+	 * @return \EE_Registration
58
+	 */
59
+	public function registrationToCopy()
60
+	{
61
+		return $this->registration_to_copy;
62
+	}
63 63
 }
Please login to merge, or discard this patch.
services/commands/registration/CopyRegistrationDetailsCommandHandler.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -20,36 +20,36 @@
 block discarded – undo
20 20
 {
21 21
 
22 22
 
23
-    /**
24
-     * @var CopyRegistrationService $copy_registration_service
25
-     */
26
-    private $copy_registration_service;
27
-
28
-
29
-    /**
30
-     * Command constructor
31
-     *
32
-     * @param CopyRegistrationService $copy_registration_service
33
-     */
34
-    public function __construct(CopyRegistrationService $copy_registration_service)
35
-    {
36
-        $this->copy_registration_service = $copy_registration_service;
37
-    }
38
-
39
-
40
-    /**
41
-     * @param \EventEspresso\core\services\commands\CommandInterface $command
42
-     * @return boolean
43
-     */
44
-    public function handle(CommandInterface $command)
45
-    {
46
-        /** @var CopyRegistrationDetailsCommand $command */
47
-        if (! $command instanceof CopyRegistrationDetailsCommand) {
48
-            throw new InvalidEntityException(get_class($command), 'CopyRegistrationDetailsCommand');
49
-        }
50
-        return $this->copy_registration_service->copyRegistrationDetails(
51
-            $command->targetRegistration(),
52
-            $command->registrationToCopy()
53
-        );
54
-    }
23
+	/**
24
+	 * @var CopyRegistrationService $copy_registration_service
25
+	 */
26
+	private $copy_registration_service;
27
+
28
+
29
+	/**
30
+	 * Command constructor
31
+	 *
32
+	 * @param CopyRegistrationService $copy_registration_service
33
+	 */
34
+	public function __construct(CopyRegistrationService $copy_registration_service)
35
+	{
36
+		$this->copy_registration_service = $copy_registration_service;
37
+	}
38
+
39
+
40
+	/**
41
+	 * @param \EventEspresso\core\services\commands\CommandInterface $command
42
+	 * @return boolean
43
+	 */
44
+	public function handle(CommandInterface $command)
45
+	{
46
+		/** @var CopyRegistrationDetailsCommand $command */
47
+		if (! $command instanceof CopyRegistrationDetailsCommand) {
48
+			throw new InvalidEntityException(get_class($command), 'CopyRegistrationDetailsCommand');
49
+		}
50
+		return $this->copy_registration_service->copyRegistrationDetails(
51
+			$command->targetRegistration(),
52
+			$command->registrationToCopy()
53
+		);
54
+	}
55 55
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
     public function handle(CommandInterface $command)
48 48
     {
49 49
         /** @var CopyRegistrationDetailsCommand $command */
50
-        if (! $command instanceof CopyRegistrationDetailsCommand) {
50
+        if ( ! $command instanceof CopyRegistrationDetailsCommand) {
51 51
             throw new InvalidEntityException(get_class($command), 'CopyRegistrationDetailsCommand');
52 52
         }
53 53
         return $this->copy_registration_service->copyRegistrationDetails(
Please login to merge, or discard this patch.
registration/UpdateRegistrationAndTransactionAfterChangeCommandHandler.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -19,37 +19,37 @@
 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 \EventEspresso\core\services\commands\CommandInterface $command
42
-     * @return boolean
43
-     */
44
-    public function handle(CommandInterface $command)
45
-    {
46
-        /** @var UpdateRegistrationAndTransactionAfterChangeCommand $command */
47
-        if (! $command instanceof UpdateRegistrationAndTransactionAfterChangeCommand) {
48
-            throw new InvalidEntityException(
49
-                get_class($command),
50
-                'UpdateRegistrationAndTransactionAfterChangeCommand'
51
-            );
52
-        }
53
-        return $this->update_registration_service->updateRegistrationAndTransaction($command->registration());
54
-    }
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 \EventEspresso\core\services\commands\CommandInterface $command
42
+	 * @return boolean
43
+	 */
44
+	public function handle(CommandInterface $command)
45
+	{
46
+		/** @var UpdateRegistrationAndTransactionAfterChangeCommand $command */
47
+		if (! $command instanceof UpdateRegistrationAndTransactionAfterChangeCommand) {
48
+			throw new InvalidEntityException(
49
+				get_class($command),
50
+				'UpdateRegistrationAndTransactionAfterChangeCommand'
51
+			);
52
+		}
53
+		return $this->update_registration_service->updateRegistrationAndTransaction($command->registration());
54
+	}
55 55
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
     public function handle(CommandInterface $command)
48 48
     {
49 49
         /** @var UpdateRegistrationAndTransactionAfterChangeCommand $command */
50
-        if (! $command instanceof UpdateRegistrationAndTransactionAfterChangeCommand) {
50
+        if ( ! $command instanceof UpdateRegistrationAndTransactionAfterChangeCommand) {
51 51
             throw new InvalidEntityException(
52 52
                 get_class($command),
53 53
                 'UpdateRegistrationAndTransactionAfterChangeCommand'
Please login to merge, or discard this patch.
services/commands/registration/CopyRegistrationPaymentsCommandHandler.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -21,36 +21,36 @@
 block discarded – undo
21 21
 {
22 22
 
23 23
 
24
-    /**
25
-     * @var CopyRegistrationService $copy_registration_service
26
-     */
27
-    private $copy_registration_service;
28
-
29
-
30
-    /**
31
-     * Command constructor
32
-     *
33
-     * @param CopyRegistrationService $copy_registration_service
34
-     */
35
-    public function __construct(CopyRegistrationService $copy_registration_service)
36
-    {
37
-        $this->copy_registration_service = $copy_registration_service;
38
-    }
39
-
40
-
41
-    /**
42
-     * @param \EventEspresso\core\services\commands\CommandInterface $command
43
-     * @return boolean
44
-     */
45
-    public function handle(CommandInterface $command)
46
-    {
47
-        /** @var CopyRegistrationPaymentsCommand $command */
48
-        if (! $command instanceof CopyRegistrationPaymentsCommand) {
49
-            throw new InvalidEntityException(get_class($command), 'CopyRegistrationPaymentsCommand');
50
-        }
51
-        return $this->copy_registration_service->copyPaymentDetails(
52
-            $command->targetRegistration(),
53
-            $command->registrationToCopy()
54
-        );
55
-    }
24
+	/**
25
+	 * @var CopyRegistrationService $copy_registration_service
26
+	 */
27
+	private $copy_registration_service;
28
+
29
+
30
+	/**
31
+	 * Command constructor
32
+	 *
33
+	 * @param CopyRegistrationService $copy_registration_service
34
+	 */
35
+	public function __construct(CopyRegistrationService $copy_registration_service)
36
+	{
37
+		$this->copy_registration_service = $copy_registration_service;
38
+	}
39
+
40
+
41
+	/**
42
+	 * @param \EventEspresso\core\services\commands\CommandInterface $command
43
+	 * @return boolean
44
+	 */
45
+	public function handle(CommandInterface $command)
46
+	{
47
+		/** @var CopyRegistrationPaymentsCommand $command */
48
+		if (! $command instanceof CopyRegistrationPaymentsCommand) {
49
+			throw new InvalidEntityException(get_class($command), 'CopyRegistrationPaymentsCommand');
50
+		}
51
+		return $this->copy_registration_service->copyPaymentDetails(
52
+			$command->targetRegistration(),
53
+			$command->registrationToCopy()
54
+		);
55
+	}
56 56
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
     public function handle(CommandInterface $command)
46 46
     {
47 47
         /** @var CopyRegistrationPaymentsCommand $command */
48
-        if (! $command instanceof CopyRegistrationPaymentsCommand) {
48
+        if ( ! $command instanceof CopyRegistrationPaymentsCommand) {
49 49
             throw new InvalidEntityException(get_class($command), 'CopyRegistrationPaymentsCommand');
50 50
         }
51 51
         return $this->copy_registration_service->copyPaymentDetails(
Please login to merge, or discard this patch.
core/services/commands/registration/CreateRegistrationCommandHandler.php 2 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -18,46 +18,46 @@
 block discarded – undo
18 18
 class CreateRegistrationCommandHandler extends CommandHandler
19 19
 {
20 20
 
21
-    /**
22
-     * @var CreateRegistrationService $registration_service
23
-     */
24
-    private $registration_service;
25
-
26
-
27
-    /**
28
-     * Command constructor
29
-     *
30
-     * @param CreateRegistrationService $registration_service
31
-     */
32
-    public function __construct(CreateRegistrationService $registration_service)
33
-    {
34
-        $this->registration_service = $registration_service;
35
-    }
36
-
37
-
38
-    /**
39
-     * @param  CommandInterface $command
40
-     * @return mixed
41
-     * @throws \OutOfRangeException
42
-     * @throws \EventEspresso\core\exceptions\UnexpectedEntityException
43
-     * @throws \EE_Error
44
-     * @throws \EventEspresso\core\exceptions\InvalidEntityException
45
-     */
46
-    public function handle(CommandInterface $command)
47
-    {
48
-        /** @var CreateRegistrationCommand $command */
49
-        if (! $command instanceof CreateRegistrationCommand) {
50
-            throw new InvalidEntityException(get_class($command), 'CreateRegistrationCommand');
51
-        }
52
-        // now create a new registration for the ticket
53
-        return $this->registration_service->create(
54
-            $command->ticket()->get_related_event(),
55
-            $command->transaction(),
56
-            $command->ticket(),
57
-            $command->ticketLineItem(),
58
-            $command->regCount(),
59
-            $command->regGroupSize(),
60
-            $command->regStatus()
61
-        );
62
-    }
21
+	/**
22
+	 * @var CreateRegistrationService $registration_service
23
+	 */
24
+	private $registration_service;
25
+
26
+
27
+	/**
28
+	 * Command constructor
29
+	 *
30
+	 * @param CreateRegistrationService $registration_service
31
+	 */
32
+	public function __construct(CreateRegistrationService $registration_service)
33
+	{
34
+		$this->registration_service = $registration_service;
35
+	}
36
+
37
+
38
+	/**
39
+	 * @param  CommandInterface $command
40
+	 * @return mixed
41
+	 * @throws \OutOfRangeException
42
+	 * @throws \EventEspresso\core\exceptions\UnexpectedEntityException
43
+	 * @throws \EE_Error
44
+	 * @throws \EventEspresso\core\exceptions\InvalidEntityException
45
+	 */
46
+	public function handle(CommandInterface $command)
47
+	{
48
+		/** @var CreateRegistrationCommand $command */
49
+		if (! $command instanceof CreateRegistrationCommand) {
50
+			throw new InvalidEntityException(get_class($command), 'CreateRegistrationCommand');
51
+		}
52
+		// now create a new registration for the ticket
53
+		return $this->registration_service->create(
54
+			$command->ticket()->get_related_event(),
55
+			$command->transaction(),
56
+			$command->ticket(),
57
+			$command->ticketLineItem(),
58
+			$command->regCount(),
59
+			$command->regGroupSize(),
60
+			$command->regStatus()
61
+		);
62
+	}
63 63
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
     public function handle(CommandInterface $command)
53 53
     {
54 54
         /** @var CreateRegistrationCommand $command */
55
-        if (! $command instanceof CreateRegistrationCommand) {
55
+        if ( ! $command instanceof CreateRegistrationCommand) {
56 56
             throw new InvalidEntityException(get_class($command), 'CreateRegistrationCommand');
57 57
         }
58 58
         // now create a new registration for the ticket
Please login to merge, or discard this patch.
core/services/commands/registration/CreateRegistrationCommand.php 2 patches
Indentation   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -24,151 +24,151 @@
 block discarded – undo
24 24
 class CreateRegistrationCommand extends Command implements CommandRequiresCapCheckInterface
25 25
 {
26 26
 
27
-    /**
28
-     * @var EE_Transaction $transaction
29
-     */
30
-    private $transaction;
31
-
32
-    /**
33
-     * @var EE_Ticket $ticket
34
-     */
35
-    private $ticket;
36
-
37
-    /**
38
-     * @var EE_Line_Item $ticket_line_item
39
-     */
40
-    private $ticket_line_item;
41
-
42
-    /**
43
-     * @var int $reg_count
44
-     */
45
-    private $reg_count;
46
-
47
-    /**
48
-     * @var int $reg_group_size
49
-     */
50
-    private $reg_group_size;
51
-
52
-    /**
53
-     * @var string $reg_status
54
-     */
55
-    private $reg_status;
56
-
57
-    /**
58
-     * @var EE_Registration $registration
59
-     */
60
-    protected $registration;
61
-
62
-
63
-    /**
64
-     * CreateRegistrationCommand constructor.
65
-     *
66
-     * @param EE_Transaction $transaction
67
-     * @param EE_Line_Item   $ticket_line_item
68
-     * @param int            $reg_count
69
-     * @param int            $reg_group_size
70
-     * @param string         $reg_status
71
-     * @throws InvalidEntityException
72
-     */
73
-    public function __construct(
74
-        EE_Transaction $transaction,
75
-        EE_Line_Item $ticket_line_item,
76
-        $reg_count = 1,
77
-        $reg_group_size = 0,
78
-        $reg_status = EEM_Registration::status_id_incomplete
79
-    ) {
80
-        // grab the related ticket object for this line_item
81
-        $this->ticket = $ticket_line_item->ticket();
82
-        if (! $this->ticket instanceof EE_Ticket) {
83
-            throw new InvalidEntityException(
84
-                is_object($this->ticket) ? get_class($this->ticket) : gettype($this->ticket),
85
-                'EE_Ticket',
86
-                sprintf(
87
-                    __('Line item %s did not contain a valid ticket', 'event_espresso'),
88
-                    $ticket_line_item->ID()
89
-                )
90
-            );
91
-        }
92
-        $this->transaction = $transaction;
93
-        $this->ticket_line_item = $ticket_line_item;
94
-        $this->reg_count = absint($reg_count);
95
-        $this->reg_group_size = absint($reg_group_size);
96
-        $this->reg_status = $reg_status;
97
-    }
98
-
99
-
100
-    /**
101
-     * @return \EventEspresso\core\domain\services\capabilities\CapCheckInterface
102
-     * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
103
-     */
104
-    public function getCapCheck()
105
-    {
106
-        if (! $this->cap_check instanceof CapCheckInterface) {
107
-            return new CapCheck('ee_edit_registrations', 'create_new_registration');
108
-        }
109
-        return $this->cap_check;
110
-    }
111
-
112
-
113
-    /**
114
-     * @return EE_Transaction
115
-     */
116
-    public function transaction()
117
-    {
118
-        return $this->transaction;
119
-    }
120
-
121
-
122
-    /**
123
-     * @return EE_Ticket
124
-     */
125
-    public function ticket()
126
-    {
127
-        return $this->ticket;
128
-    }
129
-
130
-
131
-    /**
132
-     * @return EE_Line_Item
133
-     */
134
-    public function ticketLineItem()
135
-    {
136
-        return $this->ticket_line_item;
137
-    }
138
-
139
-
140
-    /**
141
-     * @return int
142
-     */
143
-    public function regCount()
144
-    {
145
-        return $this->reg_count;
146
-    }
147
-
148
-
149
-    /**
150
-     * @return int
151
-     */
152
-    public function regGroupSize()
153
-    {
154
-        return $this->reg_group_size;
155
-    }
156
-
157
-
158
-    /**
159
-     * @return string
160
-     */
161
-    public function regStatus()
162
-    {
163
-        return $this->reg_status;
164
-    }
165
-
166
-
167
-    /**
168
-     * @return EE_Registration
169
-     */
170
-    public function registration()
171
-    {
172
-        return $this->registration;
173
-    }
27
+	/**
28
+	 * @var EE_Transaction $transaction
29
+	 */
30
+	private $transaction;
31
+
32
+	/**
33
+	 * @var EE_Ticket $ticket
34
+	 */
35
+	private $ticket;
36
+
37
+	/**
38
+	 * @var EE_Line_Item $ticket_line_item
39
+	 */
40
+	private $ticket_line_item;
41
+
42
+	/**
43
+	 * @var int $reg_count
44
+	 */
45
+	private $reg_count;
46
+
47
+	/**
48
+	 * @var int $reg_group_size
49
+	 */
50
+	private $reg_group_size;
51
+
52
+	/**
53
+	 * @var string $reg_status
54
+	 */
55
+	private $reg_status;
56
+
57
+	/**
58
+	 * @var EE_Registration $registration
59
+	 */
60
+	protected $registration;
61
+
62
+
63
+	/**
64
+	 * CreateRegistrationCommand constructor.
65
+	 *
66
+	 * @param EE_Transaction $transaction
67
+	 * @param EE_Line_Item   $ticket_line_item
68
+	 * @param int            $reg_count
69
+	 * @param int            $reg_group_size
70
+	 * @param string         $reg_status
71
+	 * @throws InvalidEntityException
72
+	 */
73
+	public function __construct(
74
+		EE_Transaction $transaction,
75
+		EE_Line_Item $ticket_line_item,
76
+		$reg_count = 1,
77
+		$reg_group_size = 0,
78
+		$reg_status = EEM_Registration::status_id_incomplete
79
+	) {
80
+		// grab the related ticket object for this line_item
81
+		$this->ticket = $ticket_line_item->ticket();
82
+		if (! $this->ticket instanceof EE_Ticket) {
83
+			throw new InvalidEntityException(
84
+				is_object($this->ticket) ? get_class($this->ticket) : gettype($this->ticket),
85
+				'EE_Ticket',
86
+				sprintf(
87
+					__('Line item %s did not contain a valid ticket', 'event_espresso'),
88
+					$ticket_line_item->ID()
89
+				)
90
+			);
91
+		}
92
+		$this->transaction = $transaction;
93
+		$this->ticket_line_item = $ticket_line_item;
94
+		$this->reg_count = absint($reg_count);
95
+		$this->reg_group_size = absint($reg_group_size);
96
+		$this->reg_status = $reg_status;
97
+	}
98
+
99
+
100
+	/**
101
+	 * @return \EventEspresso\core\domain\services\capabilities\CapCheckInterface
102
+	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
103
+	 */
104
+	public function getCapCheck()
105
+	{
106
+		if (! $this->cap_check instanceof CapCheckInterface) {
107
+			return new CapCheck('ee_edit_registrations', 'create_new_registration');
108
+		}
109
+		return $this->cap_check;
110
+	}
111
+
112
+
113
+	/**
114
+	 * @return EE_Transaction
115
+	 */
116
+	public function transaction()
117
+	{
118
+		return $this->transaction;
119
+	}
120
+
121
+
122
+	/**
123
+	 * @return EE_Ticket
124
+	 */
125
+	public function ticket()
126
+	{
127
+		return $this->ticket;
128
+	}
129
+
130
+
131
+	/**
132
+	 * @return EE_Line_Item
133
+	 */
134
+	public function ticketLineItem()
135
+	{
136
+		return $this->ticket_line_item;
137
+	}
138
+
139
+
140
+	/**
141
+	 * @return int
142
+	 */
143
+	public function regCount()
144
+	{
145
+		return $this->reg_count;
146
+	}
147
+
148
+
149
+	/**
150
+	 * @return int
151
+	 */
152
+	public function regGroupSize()
153
+	{
154
+		return $this->reg_group_size;
155
+	}
156
+
157
+
158
+	/**
159
+	 * @return string
160
+	 */
161
+	public function regStatus()
162
+	{
163
+		return $this->reg_status;
164
+	}
165
+
166
+
167
+	/**
168
+	 * @return EE_Registration
169
+	 */
170
+	public function registration()
171
+	{
172
+		return $this->registration;
173
+	}
174 174
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     ) {
80 80
         // grab the related ticket object for this line_item
81 81
         $this->ticket = $ticket_line_item->ticket();
82
-        if (! $this->ticket instanceof EE_Ticket) {
82
+        if ( ! $this->ticket instanceof EE_Ticket) {
83 83
             throw new InvalidEntityException(
84 84
                 is_object($this->ticket) ? get_class($this->ticket) : gettype($this->ticket),
85 85
                 'EE_Ticket',
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     public function getCapCheck()
105 105
     {
106
-        if (! $this->cap_check instanceof CapCheckInterface) {
106
+        if ( ! $this->cap_check instanceof CapCheckInterface) {
107 107
             return new CapCheck('ee_edit_registrations', 'create_new_registration');
108 108
         }
109 109
         return $this->cap_check;
Please login to merge, or discard this patch.