code = $code; $this->model = $model; $this->tokenQuery = $tokenQuery; $this->userConfirmationService = $userConfirmationService; } public function run() { $token = $this->tokenQuery->whereIsConfirmationType($this->model->id, $this->code)->one(); if ($token instanceof Token && !$token->getIsExpired()) { $token->delete(); return $this->userConfirmationService->run(); } return false; } }