/** * Extract conversation from route * @return NamedConversationEntity * @throws NotFoundException */ private function getConversation() : NamedConversationEntity { try { $conversation = $this->repository->getBySlug($this->params('slug')); } catch (NamedConversationNotFound $e) { throw new NotFoundException('No conversation with that name exists'); } return $conversation; }