//Get classes require_once '../api.php'; //Request $request = RestUtils::processRequest(); $transactions = new Transactions(); switch ($request->getMethod()) { /* * ====================================== * GET method * ====================================== */ case 'get': //Get by Id if (!empty($_GET['id'])) { if ($_GET['id'] == 'types') { echo json_encode($transactions->getTypes()); } //Get ALL } else { isset($_GET['count']) ? $count = intval($_GET['count']) : ($count = 10); isset($_GET['from']) ? $from = $_GET['from'] : ($from = ""); isset($_GET['to']) ? $to = $_GET['to'] : ($to = ""); isset($_GET['account']) ? $account = $_GET['account'] : ($account = ""); echo json_encode($transactions->get($count, $from, $to, $account)); } break; /* * ====================================== * PUT method * ====================================== */