get('q'), new InvalidArgumentException('A search query is required.')); $count = (int) $request->get('count', SearchService::DEFAULT_EXCERPT_RESULT_COUNT); throw_if($count < 0, new InvalidArgumentException('Invalid count parameter.')); return [ 'results' => $this->searchService->excerptSearch($request->get('q'), $count), ]; } }