Completed
Branch dev (97838e)
by
unknown
18:15 queued 10:24
created
core/services/locators/Locator.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
      */
52 52
     public function setFlags($flags)
53 53
     {
54
-        if (! is_array($flags)) {
54
+        if ( ! is_array($flags)) {
55 55
             throw new InvalidDataTypeException('$flags', $flags, 'array');
56 56
         }
57 57
         $this->flags = $flags;
Please login to merge, or discard this patch.
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -16,43 +16,43 @@
 block discarded – undo
16 16
  */
17 17
 abstract class Locator implements LocatorInterface, Countable
18 18
 {
19
-    /**
20
-     * @var array $flags
21
-     */
22
-    protected $flags = array();
19
+	/**
20
+	 * @var array $flags
21
+	 */
22
+	protected $flags = array();
23 23
 
24 24
 
25
-    /**
26
-     * FileLocator constructor.
27
-     *
28
-     * @access public
29
-     * @param array $flags controls how files are found and/or file data is returned
30
-     * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
31
-     */
32
-    public function __construct($flags = array())
33
-    {
34
-        if (empty($flags)) {
35
-            $flags = array(
36
-                FilesystemIterator::SKIP_DOTS,
37
-                FilesystemIterator::UNIX_PATHS,
38
-                FilesystemIterator::CURRENT_AS_PATHNAME,
39
-            );
40
-        }
41
-        $this->setFlags($flags);
42
-    }
25
+	/**
26
+	 * FileLocator constructor.
27
+	 *
28
+	 * @access public
29
+	 * @param array $flags controls how files are found and/or file data is returned
30
+	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
31
+	 */
32
+	public function __construct($flags = array())
33
+	{
34
+		if (empty($flags)) {
35
+			$flags = array(
36
+				FilesystemIterator::SKIP_DOTS,
37
+				FilesystemIterator::UNIX_PATHS,
38
+				FilesystemIterator::CURRENT_AS_PATHNAME,
39
+			);
40
+		}
41
+		$this->setFlags($flags);
42
+	}
43 43
 
44 44
 
45
-    /**
46
-     * @see    http://php.net/manual/en/class.filesystemiterator.php#filesystemiterator.constants
47
-     * @access public
48
-     * @param array $flags
49
-     * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
50
-     */
51
-    public function setFlags($flags)
52
-    {
53
-        if (! is_array($flags)) {
54
-            throw new InvalidDataTypeException('$flags', $flags, 'array');
55
-        }
56
-        $this->flags = $flags;
57
-    }
45
+	/**
46
+	 * @see    http://php.net/manual/en/class.filesystemiterator.php#filesystemiterator.constants
47
+	 * @access public
48
+	 * @param array $flags
49
+	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
50
+	 */
51
+	public function setFlags($flags)
52
+	{
53
+		if (! is_array($flags)) {
54
+			throw new InvalidDataTypeException('$flags', $flags, 'array');
55
+		}
56
+		$this->flags = $flags;
57
+	}
58 58
 }
Please login to merge, or discard this patch.
core/services/address/formatters/AddressFormatter.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -12,38 +12,38 @@
 block discarded – undo
12 12
  */
13 13
 class AddressFormatter
14 14
 {
15
-    // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
16
-    /**
17
-     * @param string $address
18
-     * @param string $address2
19
-     * @param string $city
20
-     * @param string $state
21
-     * @param string $zip
22
-     * @param string $country
23
-     * @param string $formatted_address
24
-     * @param string $sub
25
-     * @return mixed
26
-     */
27
-    protected function parse_formatted_address(
28
-        $address,
29
-        $address2,
30
-        $city,
31
-        $state,
32
-        $zip,
33
-        $country,
34
-        $formatted_address,
35
-        $sub
36
-    ) {
37
-        // swap address part placeholders for the real text
38
-        $formatted_address = str_replace(
39
-            // find
40
-            array('{address}', '{address2}', '{city}', '{state}', '{zip}', '{country}'),
41
-            // replace
42
-            array($address, $address2, $city, $state, $zip, $country),
43
-            // string
44
-            $formatted_address
45
-        );
46
-        // remove placeholder from start and end, reduce repeating placeholders to singles, then replace with HTML line breaks
47
-        return preg_replace('/%+/', $sub, trim($formatted_address, '%'));
48
-    }
15
+	// phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps
16
+	/**
17
+	 * @param string $address
18
+	 * @param string $address2
19
+	 * @param string $city
20
+	 * @param string $state
21
+	 * @param string $zip
22
+	 * @param string $country
23
+	 * @param string $formatted_address
24
+	 * @param string $sub
25
+	 * @return mixed
26
+	 */
27
+	protected function parse_formatted_address(
28
+		$address,
29
+		$address2,
30
+		$city,
31
+		$state,
32
+		$zip,
33
+		$country,
34
+		$formatted_address,
35
+		$sub
36
+	) {
37
+		// swap address part placeholders for the real text
38
+		$formatted_address = str_replace(
39
+			// find
40
+			array('{address}', '{address2}', '{city}', '{state}', '{zip}', '{country}'),
41
+			// replace
42
+			array($address, $address2, $city, $state, $zip, $country),
43
+			// string
44
+			$formatted_address
45
+		);
46
+		// remove placeholder from start and end, reduce repeating placeholders to singles, then replace with HTML line breaks
47
+		return preg_replace('/%+/', $sub, trim($formatted_address, '%'));
48
+	}
49 49
 }
Please login to merge, or discard this patch.
core/services/commands/registration/CreateRegistrationCommand.php 2 patches
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.
Indentation   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -24,151 +24,151 @@
 block discarded – undo
24 24
  */
25 25
 class CreateRegistrationCommand extends Command implements CommandRequiresCapCheckInterface
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
-                    esc_html__('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 CapCheckInterface
102
-     * @throws 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
+					esc_html__('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 CapCheckInterface
102
+	 * @throws 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.
core/libraries/rest_api/controllers/rpc/Checkin.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             $force = false;
57 57
         }
58 58
         $reg = EEM_Registration::instance()->get_one_by_ID($reg_id);
59
-        if (! $reg instanceof EE_Registration) {
59
+        if ( ! $reg instanceof EE_Registration) {
60 60
             return $this->sendResponse(
61 61
                 new WP_Error(
62 62
                     'rest_registration_toggle_checkin_invalid_id',
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
                 )
72 72
             );
73 73
         }
74
-        if (! EE_Capabilities::instance()->current_user_can('ee_edit_checkin', 'rest_api_checkin_endpoint', $reg_id)) {
74
+        if ( ! EE_Capabilities::instance()->current_user_can('ee_edit_checkin', 'rest_api_checkin_endpoint', $reg_id)) {
75 75
             return $this->sendResponse(
76 76
                 new WP_Error(
77 77
                     'rest_user_cannot_toggle_checkin',
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         $success = $reg->toggle_checkin_status($dtt_id, ! $force);
87 87
         if ($success === false) {
88 88
             // check if we know they can't check in because they're not approved and we aren't forcing
89
-            if (! $reg->is_approved() && ! $force) {
89
+            if ( ! $reg->is_approved() && ! $force) {
90 90
                 // rely on EE_Error::add_error messages to have been added to give more data about why it failed
91 91
                 return $this->sendResponse(
92 92
                     new WP_Error(
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
                 ),
119 119
             )
120 120
         );
121
-        if (! $checkin instanceof EE_Checkin) {
121
+        if ( ! $checkin instanceof EE_Checkin) {
122 122
             return $this->sendResponse(
123 123
                 new WP_Error(
124 124
                     'rest_toggle_checkin_error',
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         }
138 138
         $get_request = new WP_REST_Request(
139 139
             'GET',
140
-            '/' . EED_Core_Rest_Api::ee_api_namespace . 'v' . $version . '/checkins/' . $checkin->ID()
140
+            '/'.EED_Core_Rest_Api::ee_api_namespace.'v'.$version.'/checkins/'.$checkin->ID()
141 141
         );
142 142
         $get_request->set_url_params(
143 143
             array(
Please login to merge, or discard this patch.
Indentation   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -25,124 +25,124 @@
 block discarded – undo
25 25
  */
26 26
 class Checkin extends Base
27 27
 {
28
-    /**
29
-     * @param WP_REST_Request $request
30
-     * @param string          $version
31
-     * @return WP_Error|WP_REST_Response
32
-     */
33
-    public static function handleRequestToggleCheckin(WP_REST_Request $request, $version)
34
-    {
35
-        $controller = new Checkin();
36
-        return $controller->createCheckinCheckoutObject($request, $version);
37
-    }
28
+	/**
29
+	 * @param WP_REST_Request $request
30
+	 * @param string          $version
31
+	 * @return WP_Error|WP_REST_Response
32
+	 */
33
+	public static function handleRequestToggleCheckin(WP_REST_Request $request, $version)
34
+	{
35
+		$controller = new Checkin();
36
+		return $controller->createCheckinCheckoutObject($request, $version);
37
+	}
38 38
 
39 39
 
40
-    /**
41
-     * Toggles whether the user is checked in or not.
42
-     *
43
-     * @param WP_REST_Request $request
44
-     * @param string          $version
45
-     * @return WP_Error|WP_REST_Response
46
-     */
47
-    protected function createCheckinCheckoutObject(WP_REST_Request $request, $version)
48
-    {
49
-        $reg_id = $request->get_param('REG_ID');
50
-        $dtt_id = $request->get_param('DTT_ID');
51
-        $force = $request->get_param('force');
52
-        if ($force == 'true') {
53
-            $force = true;
54
-        } else {
55
-            $force = false;
56
-        }
57
-        $reg = EEM_Registration::instance()->get_one_by_ID($reg_id);
58
-        if (! $reg instanceof EE_Registration) {
59
-            return $this->sendResponse(
60
-                new WP_Error(
61
-                    'rest_registration_toggle_checkin_invalid_id',
62
-                    sprintf(
63
-                        esc_html__(
64
-                            'You cannot checkin registration with ID %1$s because it doesn\'t exist.',
65
-                            'event_espresso'
66
-                        ),
67
-                        $reg_id
68
-                    ),
69
-                    array('status' => 422)
70
-                )
71
-            );
72
-        }
73
-        if (! EE_Capabilities::instance()->current_user_can('ee_edit_checkin', 'rest_api_checkin_endpoint', $reg_id)) {
74
-            return $this->sendResponse(
75
-                new WP_Error(
76
-                    'rest_user_cannot_toggle_checkin',
77
-                    sprintf(
78
-                        esc_html__('You are not allowed to checkin registration with ID %1$s.', 'event_espresso'),
79
-                        $reg_id
80
-                    ),
81
-                    array('status' => 403)
82
-                )
83
-            );
84
-        }
85
-        $success = $reg->toggle_checkin_status($dtt_id, ! $force);
86
-        if ($success === false) {
87
-            // check if we know they can't check in because they're not approved and we aren't forcing
88
-            if (! $reg->is_approved() && ! $force) {
89
-                // rely on EE_Error::add_error messages to have been added to give more data about why it failed
90
-                return $this->sendResponse(
91
-                    new WP_Error(
92
-                        'rest_toggle_checkin_failed',
93
-                        esc_html__(
94
-                        // @codingStandardsIgnoreStart
95
-                            'Registration check-in failed because the registration is not approved. You may attempt to force checking in though.',
96
-                            // @codingStandardsIgnoreEnd
97
-                            'event_espresso'
98
-                        )
99
-                    )
100
-                );
101
-            }
102
-            return $this->sendResponse(
103
-                new WP_Error(
104
-                    'rest_toggle_checkin_failed_not_forceable',
105
-                    esc_html__('Registration checkin failed. Please see additional error data.', 'event_espresso')
106
-                )
107
-            );
108
-        }
109
-        $checkin = EEM_Checkin::instance()->get_one(
110
-            array(
111
-                array(
112
-                    'REG_ID' => $reg_id,
113
-                    'DTT_ID' => $dtt_id,
114
-                ),
115
-                'order_by' => array(
116
-                    'CHK_timestamp' => 'DESC',
117
-                ),
118
-            )
119
-        );
120
-        if (! $checkin instanceof EE_Checkin) {
121
-            return $this->sendResponse(
122
-                new WP_Error(
123
-                    'rest_toggle_checkin_error',
124
-                    sprintf(
125
-                        esc_html__(
126
-                        // @codingStandardsIgnoreStart
127
-                            'Supposedly we created a new checkin object for registration %1$s at datetime %2$s, but we can\'t find it.',
128
-                            // @codingStandardsIgnoreEnd
129
-                            'event_espresso'
130
-                        ),
131
-                        $reg_id,
132
-                        $dtt_id
133
-                    )
134
-                )
135
-            );
136
-        }
137
-        $get_request = new WP_REST_Request(
138
-            'GET',
139
-            '/' . EED_Core_Rest_Api::ee_api_namespace . 'v' . $version . '/checkins/' . $checkin->ID()
140
-        );
141
-        $get_request->set_url_params(
142
-            array(
143
-                'id' => $checkin->ID(),
144
-            )
145
-        );
146
-        return Read::handleRequestGetOne($get_request, $version, 'Checkin');
147
-    }
40
+	/**
41
+	 * Toggles whether the user is checked in or not.
42
+	 *
43
+	 * @param WP_REST_Request $request
44
+	 * @param string          $version
45
+	 * @return WP_Error|WP_REST_Response
46
+	 */
47
+	protected function createCheckinCheckoutObject(WP_REST_Request $request, $version)
48
+	{
49
+		$reg_id = $request->get_param('REG_ID');
50
+		$dtt_id = $request->get_param('DTT_ID');
51
+		$force = $request->get_param('force');
52
+		if ($force == 'true') {
53
+			$force = true;
54
+		} else {
55
+			$force = false;
56
+		}
57
+		$reg = EEM_Registration::instance()->get_one_by_ID($reg_id);
58
+		if (! $reg instanceof EE_Registration) {
59
+			return $this->sendResponse(
60
+				new WP_Error(
61
+					'rest_registration_toggle_checkin_invalid_id',
62
+					sprintf(
63
+						esc_html__(
64
+							'You cannot checkin registration with ID %1$s because it doesn\'t exist.',
65
+							'event_espresso'
66
+						),
67
+						$reg_id
68
+					),
69
+					array('status' => 422)
70
+				)
71
+			);
72
+		}
73
+		if (! EE_Capabilities::instance()->current_user_can('ee_edit_checkin', 'rest_api_checkin_endpoint', $reg_id)) {
74
+			return $this->sendResponse(
75
+				new WP_Error(
76
+					'rest_user_cannot_toggle_checkin',
77
+					sprintf(
78
+						esc_html__('You are not allowed to checkin registration with ID %1$s.', 'event_espresso'),
79
+						$reg_id
80
+					),
81
+					array('status' => 403)
82
+				)
83
+			);
84
+		}
85
+		$success = $reg->toggle_checkin_status($dtt_id, ! $force);
86
+		if ($success === false) {
87
+			// check if we know they can't check in because they're not approved and we aren't forcing
88
+			if (! $reg->is_approved() && ! $force) {
89
+				// rely on EE_Error::add_error messages to have been added to give more data about why it failed
90
+				return $this->sendResponse(
91
+					new WP_Error(
92
+						'rest_toggle_checkin_failed',
93
+						esc_html__(
94
+						// @codingStandardsIgnoreStart
95
+							'Registration check-in failed because the registration is not approved. You may attempt to force checking in though.',
96
+							// @codingStandardsIgnoreEnd
97
+							'event_espresso'
98
+						)
99
+					)
100
+				);
101
+			}
102
+			return $this->sendResponse(
103
+				new WP_Error(
104
+					'rest_toggle_checkin_failed_not_forceable',
105
+					esc_html__('Registration checkin failed. Please see additional error data.', 'event_espresso')
106
+				)
107
+			);
108
+		}
109
+		$checkin = EEM_Checkin::instance()->get_one(
110
+			array(
111
+				array(
112
+					'REG_ID' => $reg_id,
113
+					'DTT_ID' => $dtt_id,
114
+				),
115
+				'order_by' => array(
116
+					'CHK_timestamp' => 'DESC',
117
+				),
118
+			)
119
+		);
120
+		if (! $checkin instanceof EE_Checkin) {
121
+			return $this->sendResponse(
122
+				new WP_Error(
123
+					'rest_toggle_checkin_error',
124
+					sprintf(
125
+						esc_html__(
126
+						// @codingStandardsIgnoreStart
127
+							'Supposedly we created a new checkin object for registration %1$s at datetime %2$s, but we can\'t find it.',
128
+							// @codingStandardsIgnoreEnd
129
+							'event_espresso'
130
+						),
131
+						$reg_id,
132
+						$dtt_id
133
+					)
134
+				)
135
+			);
136
+		}
137
+		$get_request = new WP_REST_Request(
138
+			'GET',
139
+			'/' . EED_Core_Rest_Api::ee_api_namespace . 'v' . $version . '/checkins/' . $checkin->ID()
140
+		);
141
+		$get_request->set_url_params(
142
+			array(
143
+				'id' => $checkin->ID(),
144
+			)
145
+		);
146
+		return Read::handleRequestGetOne($get_request, $version, 'Checkin');
147
+	}
148 148
 }
Please login to merge, or discard this patch.
core/libraries/batch/Helpers/BatchRequestException.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,5 +14,5 @@
 block discarded – undo
14 14
  */
15 15
 class BatchRequestException extends \Exception
16 16
 {
17
-    // so far the same as exception
17
+	// so far the same as exception
18 18
 }
Please login to merge, or discard this patch.
core/entities/interfaces/HasSchemaInterface.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -4,63 +4,63 @@
 block discarded – undo
4 4
 
5 5
 interface HasSchemaInterface
6 6
 {
7
-    /**
8
-     * Returns whatever is set as the nicename for the object.
9
-     *
10
-     * @return string
11
-     */
12
-    public function getSchemaDescription();
7
+	/**
8
+	 * Returns whatever is set as the nicename for the object.
9
+	 *
10
+	 * @return string
11
+	 */
12
+	public function getSchemaDescription();
13 13
 
14 14
 
15
-    /**
16
-     * Returns whatever is set as the $_schema_type property for the object.
17
-     * Note: this will automatically add 'null' to the schema if the object is_nullable()
18
-     *
19
-     * @return string|array
20
-     */
21
-    public function getSchemaType();
15
+	/**
16
+	 * Returns whatever is set as the $_schema_type property for the object.
17
+	 * Note: this will automatically add 'null' to the schema if the object is_nullable()
18
+	 *
19
+	 * @return string|array
20
+	 */
21
+	public function getSchemaType();
22 22
 
23 23
 
24
-    /**
25
-     * This is usually present when the $_schema_type property is 'object'.  Any child classes will need to override
26
-     * this method and return the properties for the schema.
27
-     * The reason this is not a property on the class is because there may be filters set on the values for the property
28
-     * that won't be exposed on construct.  For example enum type schemas may have the enum values filtered.
29
-     *
30
-     * @return array
31
-     */
32
-    public function getSchemaProperties();
24
+	/**
25
+	 * This is usually present when the $_schema_type property is 'object'.  Any child classes will need to override
26
+	 * this method and return the properties for the schema.
27
+	 * The reason this is not a property on the class is because there may be filters set on the values for the property
28
+	 * that won't be exposed on construct.  For example enum type schemas may have the enum values filtered.
29
+	 *
30
+	 * @return array
31
+	 */
32
+	public function getSchemaProperties();
33 33
 
34
-    /**
35
-     * If a child class has enum values, they should override this method and provide a simple array
36
-     * of the enum values.
37
-     * The reason this is not a property on the class is because there may be filterable enum values that
38
-     * are set on the instantiated object that could be filtered after construct.
39
-     *
40
-     * @return array
41
-     */
42
-    public function getSchemaEnum();
34
+	/**
35
+	 * If a child class has enum values, they should override this method and provide a simple array
36
+	 * of the enum values.
37
+	 * The reason this is not a property on the class is because there may be filterable enum values that
38
+	 * are set on the instantiated object that could be filtered after construct.
39
+	 *
40
+	 * @return array
41
+	 */
42
+	public function getSchemaEnum();
43 43
 
44
-    /**
45
-     * This returns the value of the $_schema_format property on the object.
46
-     *
47
-     * @return string
48
-     */
49
-    public function getSchemaFormat();
44
+	/**
45
+	 * This returns the value of the $_schema_format property on the object.
46
+	 *
47
+	 * @return string
48
+	 */
49
+	public function getSchemaFormat();
50 50
 
51
-    /**
52
-     * This returns the value of the $_schema_readonly property on the object.
53
-     *
54
-     * @return bool
55
-     */
56
-    public function getSchemaReadonly();
51
+	/**
52
+	 * This returns the value of the $_schema_readonly property on the object.
53
+	 *
54
+	 * @return bool
55
+	 */
56
+	public function getSchemaReadonly();
57 57
 
58 58
 
59
-    /**
60
-     * This returns elements used to represent this field in the json schema.
61
-     *
62
-     * @link http://json-schema.org/
63
-     * @return array
64
-     */
65
-    public function getSchema();
59
+	/**
60
+	 * This returns elements used to represent this field in the json schema.
61
+	 *
62
+	 * @link http://json-schema.org/
63
+	 * @return array
64
+	 */
65
+	public function getSchema();
66 66
 }
Please login to merge, or discard this patch.
core/domain/CaffeinatedInterface.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@
 block discarded – undo
12 12
  */
13 13
 interface CaffeinatedInterface
14 14
 {
15
-    /**
16
-     * Used to indicate when functionality is caffeinated or not.
17
-     * @return bool
18
-     */
19
-    public function isCaffeinated();
15
+	/**
16
+	 * Used to indicate when functionality is caffeinated or not.
17
+	 * @return bool
18
+	 */
19
+	public function isCaffeinated();
20 20
 }
Please login to merge, or discard this patch.
core/domain/services/session/SessionIdentifierInterface.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@
 block discarded – undo
5 5
 interface SessionIdentifierInterface
6 6
 {
7 7
 
8
-    /**
9
-     * @return    string
10
-     */
11
-    public function id();
8
+	/**
9
+	 * @return    string
10
+	 */
11
+	public function id();
12 12
 }
Please login to merge, or discard this patch.
core/domain/services/validation/email/strategies/WordPress.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
     public function validate($email_address)
24 24
     {
25 25
         parent::validate($email_address);
26
-        if (! is_email($email_address)) {
26
+        if ( ! is_email($email_address)) {
27 27
             throw new EmailValidationException(
28 28
                 esc_html__('The email address provided is not valid.', 'event_espresso')
29 29
             );
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -14,19 +14,19 @@
 block discarded – undo
14 14
  */
15 15
 class WordPress extends Basic
16 16
 {
17
-    /**
18
-     * @param string $email_address
19
-     * @return boolean
20
-     * @throws EmailValidationException
21
-     */
22
-    public function validate($email_address)
23
-    {
24
-        parent::validate($email_address);
25
-        if (! is_email($email_address)) {
26
-            throw new EmailValidationException(
27
-                esc_html__('The email address provided is not valid.', 'event_espresso')
28
-            );
29
-        }
30
-        return true;
31
-    }
17
+	/**
18
+	 * @param string $email_address
19
+	 * @return boolean
20
+	 * @throws EmailValidationException
21
+	 */
22
+	public function validate($email_address)
23
+	{
24
+		parent::validate($email_address);
25
+		if (! is_email($email_address)) {
26
+			throw new EmailValidationException(
27
+				esc_html__('The email address provided is not valid.', 'event_espresso')
28
+			);
29
+		}
30
+		return true;
31
+	}
32 32
 }
Please login to merge, or discard this patch.