get($id); if (!$tag) { throw new BadRequestException('question_query.invalid_tag'); } return $tag->id; } public function checkSort($sort) { $types = QuestionModel::sortTypes(); if (!isset($types[$sort])) { throw new BadRequestException('question_query.invalid_sort'); } return $sort; } }