Code Duplication    Length = 27-27 lines in 2 locations

core/libraries/rest_api/calculations/Datetime.php 1 location

@@ 157-183 (lines=27) @@
154
     * @throws InvalidInterfaceException
155
     * @throws RestException
156
     */
157
    public function spotsTakenPendingPayment($wpdb_row, $request, $controller)
158
    {
159
        if (! is_array($wpdb_row) || ! isset($wpdb_row['Datetime.DTT_ID'])) {
160
            throw new EE_Error(
161
                sprintf(
162
                    __(
163
                    // @codingStandardsIgnoreStart
164
                        'Cannot calculate spots_taken_pending_payment because the database row %1$s does not have an entry for "Datetime.DTT_ID"',
165
                        // @codingStandardsIgnoreEnd
166
                        'event_espresso'
167
                    ),
168
                    print_r($wpdb_row, true)
169
                )
170
            );
171
        }
172
        $this->verifyCurrentUserCan('ee_read_registrations', 'spots_taken_pending_payment');
173
        return $this->registration_model->count(
174
            array(
175
                array(
176
                    'Ticket.Datetime.DTT_ID' => $wpdb_row['Datetime.DTT_ID'],
177
                    'STS_ID'                 => EEM_Registration::status_id_pending_payment,
178
                ),
179
            ),
180
            'REG_ID',
181
            true
182
        );
183
    }
184
185
186
    /**

core/libraries/rest_api/calculations/Event.php 1 location

@@ 218-244 (lines=27) @@
215
     * @throws InvalidInterfaceException
216
     * @throws RestException
217
     */
218
    public function spotsTakenPendingPayment($wpdb_row, $request, $controller)
219
    {
220
        if (! Event::wpdbRowHasEventId($wpdb_row)) {
221
            throw new EE_Error(
222
                sprintf(
223
                    __(
224
                    // @codingStandardsIgnoreStart
225
                        'Cannot calculate spots_taken_pending_payment because the database row %1$s does not have an entry for "Event_CPT.ID"',
226
                        // @codingStandardsIgnoreEnd
227
                        'event_espresso'
228
                    ),
229
                    print_r($wpdb_row, true)
230
                )
231
            );
232
        }
233
        $this->verifyCurrentUserCan('ee_read_registrations', 'spots_taken_pending_payment');
234
        return $this->registration_model->count(
235
            array(
236
                array(
237
                    'EVT_ID' => $wpdb_row['Event_CPT.ID'],
238
                    'STS_ID' => EEM_Registration::status_id_pending_payment,
239
                ),
240
            ),
241
            'REG_ID',
242
            true
243
        );
244
    }
245
246
247
    /**