Code Duplication    Length = 14-15 lines in 4 locations

core/libraries/rest_api/calculations/Datetime.php 2 locations

@@ 76-90 (lines=15) @@
73
     * @throws \EE_Error
74
     * @throws \EventEspresso\core\libraries\rest_api\RestException
75
     */
76
    public static function registrationsCheckedInCount($wpdb_row, $request, $controller)
77
    {
78
        if (! is_array($wpdb_row) || ! isset($wpdb_row['Datetime.DTT_ID'])) {
79
            throw new \EE_Error(
80
                sprintf(
81
                    __(
82
                        // @codingStandardsIgnoreStart
83
                        'Cannot calculate registrations_checked_in_count because the database row %1$s does not have an entry for "Datetime.DTT_ID"',
84
                        // @codingStandardsIgnoreEnd
85
                        'event_espresso'
86
                    ),
87
                    print_r($wpdb_row, true)
88
                )
89
            );
90
        }
91
        self::verifyCurrentUserCan('ee_read_checkins', 'registrations_checked_in_count');
92
        return EEM_Registration::instance()
93
                                ->count_registrations_checked_into_datetime($wpdb_row['Datetime.DTT_ID'], true);
@@ 108-122 (lines=15) @@
105
     * @throws \EE_Error
106
     * @throws \EventEspresso\core\libraries\rest_api\RestException
107
     */
108
    public static function registrationsCheckedOutCount($wpdb_row, $request, $controller)
109
    {
110
        if (! is_array($wpdb_row) || ! isset($wpdb_row['Datetime.DTT_ID'])) {
111
            throw new \EE_Error(
112
                sprintf(
113
                    __(
114
                        // @codingStandardsIgnoreStart
115
                        'Cannot calculate registrations_checked_out_count because the database row %1$s does not have an entry for "Datetime.DTT_ID"',
116
                        // @codingStandardsIgnoreEnd
117
                        'event_espresso'
118
                    ),
119
                    print_r($wpdb_row, true)
120
                )
121
            );
122
        }
123
        self::verifyCurrentUserCan('ee_read_checkins', 'registrations_checked_out_count');
124
        return EEM_Registration::instance()
125
                                ->count_registrations_checked_into_datetime($wpdb_row['Datetime.DTT_ID'], false);

core/libraries/rest_api/calculations/Event.php 2 locations

@@ 234-247 (lines=14) @@
231
     * @throws EE_Error
232
     * @throws RestException
233
     */
234
    public static function registrationsCheckedInCount($wpdb_row, $request, $controller)
235
    {
236
        if (! is_array($wpdb_row) || ! isset($wpdb_row['Event_CPT.ID'])) {
237
            throw new EE_Error(
238
                sprintf(
239
                    __(
240
                        // @codingStandardsIgnoreStart
241
                        'Cannot calculate registrations_checked_in_count because the database row %1$s does not have an entry for "Event_CPT.ID"',
242
                        // @codingStandardsIgnoreEnd
243
                        'event_espresso'
244
                    ),
245
                    print_r($wpdb_row, true)
246
                )
247
            );
248
        }
249
        self::verifyCurrentUserCan('ee_read_checkins', 'registrations_checked_in_count');
250
        return EEM_Registration::instance()->count_registrations_checked_into_event($wpdb_row['Event_CPT.ID'], true);
@@ 266-279 (lines=14) @@
263
     * @throws EE_Error
264
     * @throws RestException
265
     */
266
    public static function registrationsCheckedOutCount($wpdb_row, $request, $controller)
267
    {
268
        if (! is_array($wpdb_row) || ! isset($wpdb_row['Event_CPT.ID'])) {
269
            throw new EE_Error(
270
                sprintf(
271
                    __(
272
                        // @codingStandardsIgnoreStart
273
                        'Cannot calculate registrations_checked_out_count because the database row %1$s does not have an entry for "Event_CPT.ID"',
274
                        // @codingStandardsIgnoreEnd
275
                        'event_espresso'
276
                    ),
277
                    print_r($wpdb_row, true)
278
                )
279
            );
280
        }
281
        self::verifyCurrentUserCan('ee_read_checkins', 'registrations_checked_out_count');
282
        return EEM_Registration::instance()->count_registrations_checked_into_event($wpdb_row['Event_CPT.ID'], false);