. */ namespace SP\Modules\Web\Controllers\Account; use Exception; use SP\Core\Application; use SP\Core\Events\Event; use SP\Domain\Core\Exceptions\SPException; use SP\Modules\Web\Controllers\Helpers\Account\AccountSearchHelper; use SP\Modules\Web\Controllers\Traits\JsonTrait; use SP\Mvc\Controller\WebControllerHelper; use function SP\processException; /** * SearchController */ final class SearchController extends AccountControllerBase { use JsonTrait; public function __construct( Application $application, WebControllerHelper $webControllerHelper, private readonly AccountSearchHelper $accountSearchHelper ) { parent::__construct($application, $webControllerHelper); } /** * @return bool|null * @throws SPException */ public function searchAction(): ?bool { try { $this->accountSearchHelper->getAccountSearch(); $this->eventDispatcher->notify('show.account.search', new Event($this)); return $this->returnJsonResponseData(['html' => $this->render()]); } catch (Exception $e) { processException($e); $this->eventDispatcher->notify('exception', new Event($e)); return $this->returnJsonResponseException($e); } } }