em->getRepository(Task::class)->find($uriVariables['taskId'] ?? 0); if (null === $task) { throw new NotFoundHttpException('Task not found.'); } $type = $uriVariables['type'] ?? 'feature'; if (!in_array($type, self::ALLOWED_TYPES, true)) { throw new BadRequestHttpException('Invalid branch type.'); } $dto = new GiteaBranchName(); $dto->name = $this->giteaApiService->generateBranchName($task, $type); return $dto; } }