'Created Contact', 'message' => 'You have successfully created a new Contact' ]; } /** @var CreateContactProcessor */ private $createContactProcessor; /** * CreateContactLogic constructor. * @param CreateContactProcessor $createContactProcessor */ public function __construct(CreateContactProcessor $createContactProcessor) { $this->createContactProcessor = $createContactProcessor; } /** * @param Request $request * @return JsonResponse * @throws ErrorException */ public function logic(Request $request) : JsonResponse { try { return $this->resourceResponse(new ContactResource($this->createContactProcessor->execute($request))); } catch (\Exception $exception){ throw new ErrorException($exception->getMessage(), $exception->getCode()); } } }