setName('irstea:plantuml:generate') ->setDescription('Génère un graphe en PlantUML.') ->addArgument('graph', InputArgument::REQUIRED, 'Nom du graphe à générer'); } /** * @param InputInterface $input * @param OutputInterface $output * @SuppressWarnings(UnusedFormalParameter) */ protected function execute(InputInterface $input, OutputInterface $output) { $name = $input->getArgument('graph'); $serviceId = "irstea_plant_uml.graph.$name"; if (!$this->getContainer()->has($serviceId)) { throw new InvalidArgumentException("Le graphe '$name' n'est pas défini."); } $writer = new OutputWriter($output); $graph = $this->getContainer()->get($serviceId); $graph->visitAll(); $graph->writeTo($writer); } }