Code Duplication    Length = 12-15 lines in 2 locations

core/libraries/rest_api/controllers/config/Read.php 1 location

@@ 36-50 (lines=15) @@
33
    public static function handleRequest(WP_REST_Request $request, $version)
34
    {
35
        $cap = EE_Restriction_Generator_Base::get_default_restrictions_cap();
36
        if (EE_Capabilities::instance()->current_user_can($cap, 'read_over_api')) {
37
            return EE_Config::instance();
38
        } else {
39
            return new WP_Error(
40
                'cannot_read_config',
41
                sprintf(
42
                    __(
43
                        'You do not have the necessary capabilities (%s) to read Event Espresso Configuration data',
44
                        'event_espresso'
45
                    ),
46
                    $cap
47
                ),
48
                array('status' => 403)
49
            );
50
        }
51
    }
52
53

core/libraries/rest_api/controllers/rpc/Checkin.php 1 location

@@ 81-92 (lines=12) @@
78
                )
79
            );
80
        }
81
        if (! EE_Capabilities::instance()->current_user_can('ee_edit_checkin', 'rest_api_checkin_endpoint', $reg_id)) {
82
            return $this->sendResponse(
83
                new WP_Error(
84
                    'rest_user_cannot_toggle_checkin',
85
                    sprintf(
86
                        __('You are not allowed to checkin registration with ID %1$s.', 'event_espresso'),
87
                        $reg_id
88
                    ),
89
                    array('status' => 403)
90
                )
91
            );
92
        }
93
        $success = $reg->toggle_checkin_status($dtt_id, ! $force);
94
        if ($success === false) {
95
            //check if we know they can't check in because they're not approved and we aren't forcing