public static function execute() { if ( !isset($_GET['search']) ) { $_GET['search'] = ''; } if ( !isset($_GET['cid']) ) { $_GET['cid'] = 0; } if ( !empty($_GET['search']) ) { $result = Products::find($_GET['search'], $_GET['cid']); } else { $result = Products::getAll($_GET['cid']); } $result['rpcStatus'] = RPC::STATUS_SUCCESS; echo json_encode($result); }