command = $command; } public function list(): array { $commands = $this->command->list(); $commandsView = []; foreach ($commands as $command) { $commandsView[] = new CommandListView( $command->getId(), $command->getName() ); } return $commandsView; } }