Code Duplication    Length = 23-23 lines in 2 locations

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

@@ 141-163 (lines=23) @@
138
     * @throws \EE_Error
139
     * @throws \EventEspresso\core\libraries\rest_api\RestException
140
     */
141
    public static function spotsTakenPendingPayment($wpdb_row, $request, $controller)
142
    {
143
        if (! is_array($wpdb_row) || ! isset($wpdb_row['Datetime.DTT_ID'])) {
144
            throw new \EE_Error(
145
                sprintf(
146
                    __(
147
                        // @codingStandardsIgnoreStart
148
                        'Cannot calculate spots_taken_pending_payment because the database row %1$s does not have an entry for "Datetime.DTT_ID"',
149
                        // @codingStandardsIgnoreEnd
150
                        'event_espresso'
151
                    ),
152
                    print_r($wpdb_row, true)
153
                )
154
            );
155
        }
156
        self::verifyCurrentUserCan('ee_read_registrations', 'spots_taken_pending_payment');
157
        return EEM_Registration::instance()->count(
158
            array(
159
                array(
160
                    'Ticket.Datetime.DTT_ID' => $wpdb_row['Datetime.DTT_ID'],
161
                    'STS_ID'                 => EEM_Registration::status_id_pending_payment,
162
                ),
163
            ),
164
            'REG_ID',
165
            true
166
        );

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

@@ 193-215 (lines=23) @@
190
     * @throws EE_Error
191
     * @throws RestException
192
     */
193
    public static function spotsTakenPendingPayment($wpdb_row, $request, $controller)
194
    {
195
        if (! is_array($wpdb_row) || ! isset($wpdb_row['Event_CPT.ID'])) {
196
            throw new EE_Error(
197
                sprintf(
198
                    __(
199
                        // @codingStandardsIgnoreStart
200
                        'Cannot calculate spots_taken_pending_payment because the database row %1$s does not have an entry for "Event_CPT.ID"',
201
                        // @codingStandardsIgnoreEnd
202
                        'event_espresso'
203
                    ),
204
                    print_r($wpdb_row, true)
205
                )
206
            );
207
        }
208
        self::verifyCurrentUserCan('ee_read_registrations', 'spots_taken_pending_payment');
209
        return EEM_Registration::instance()->count(
210
            array(
211
                array(
212
                    'EVT_ID' => $wpdb_row['Event_CPT.ID'],
213
                    'STS_ID' => EEM_Registration::status_id_pending_payment,
214
                ),
215
            ),
216
            'REG_ID',
217
            true
218
        );