语法错误,代码中出现意外的'public'(T_PUBLIC)? [重复]

I am getting unexpected 'public' (T_PUBLIC) in your code at public function mwb_plugin_details()..

any ideas what is wrong? When I remove public it works but not sure if that is correct approach or not

public function mwb_plugin_details()
{
    global $tab;
    if($tab == 'plugin-information' && $_REQUEST['plugin'] == 'woocommerce-refund-and-exchange'){

        $url = 'https://makewebbetter.com/pluginupdates/codecanyon/woocommerce-refund-and-exchange/update.php';

        $postdata = array(
                    'action' => 'check_update',
                    'license_code' => CED_RNX_LICENSE_KEY
                    );

        $args = array(
                    'method' => 'POST',
                    'body' => $postdata,
                    );

        $data = wp_remote_post( $url, $args );
        if(is_wp_error($data)){
            return;
        }

        if(isset($data['body'])){
            $all_data = json_decode($data['body'],true);

            if(is_array($all_data) && !empty($all_data)){
                $this->create_html_data($all_data);
            }
        }
    }
}
</div>