workflowStorage = $workflowStorage; } public function handle(Request $request): Response { $workflows = $this->workflowStorage->getWorkflows(); return new Response(array_map(function (Workflow $workflow) { return $this->buildWorkflow($workflow); }, $workflows)); } private function buildWorkflow(Workflow $workflow): array { return [ 'id' => $workflow->getId(), 'name' => $workflow->getName(), 'status' => $workflow->getStatus(), 'created_at' => $workflow->getCreatedAt()->format(DateTimeImmutable::W3C), 'updated_at' => $workflow->getUpdatedAt()->format(DateTimeImmutable::W3C), 'activated_at' => $workflow->getActivatedAt() ? $workflow->getActivatedAt()->format(DateTimeImmutable::W3C) : null, ]; } }