model = new ComplexesModel(); } public function getComplexes($id) { // Валидация и санитизация входных данных if (!is_array($id)) { return $this->response(['error' => 'Invalid ID'], 400); } $params = $id; $catalog = $this->model->getComplexes($params); return $this->response($catalog); } public function getApartment($id) { // Валидация и санитизация входных данных if (!is_array($id)) { return $this->response(['error' => 'Invalid ID'], 400); } $token = isset($_GET['token']) ? filter_var($_GET['token'], FILTER_SANITIZE_STRING) : null; if (!$token) { return $this->response(['error' => 'Token is required'], 400); } $apartment = $this->model->getApartment($id, $token); return $this->response($apartment); } }