@@ -39,15 +39,15 @@ protected function configure()
3939 ->setDefinition (array (
4040 new InputArgument ('name ' , InputArgument::REQUIRED , 'A workflow name ' ),
4141 new InputArgument ('marking ' , InputArgument::IS_ARRAY , 'A marking (a list of places) ' ),
42- new InputOption ('label ' , 'l ' , InputArgument:: OPTIONAL , 'Labels a graph ' ),
42+ new InputOption ('label ' , 'l ' , InputOption:: VALUE_REQUIRED , 'Labels a graph ' ),
4343 new InputOption ('dump-format ' , null , InputOption::VALUE_REQUIRED , 'The dump format [dot|puml] ' , 'dot ' ),
4444 ))
4545 ->setDescription ('Dump a workflow ' )
4646 ->setHelp (<<<'EOF'
4747The <info>%command.name%</info> command dumps the graphical representation of a
4848workflow in different formats
4949
50- <info>DOT</info>: %command.full_name% <workflow name> | dot -Tpng > workflow.png
50+ <info>DOT</info>: %command.full_name% <workflow name> | dot -Tpng > workflow.png
5151<info>PUML</info>: %command.full_name% <workflow name> --dump-format=puml | java -jar plantuml.jar -p > workflow.png
5252
5353EOF
@@ -74,9 +74,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
7474 }
7575
7676 if ('puml ' === $ input ->getOption ('dump-format ' )) {
77- $ dumper = new PlantUmlDumper (
78- 'workflow ' === $ type ? PlantUmlDumper::WORKFLOW_TRANSITION : PlantUmlDumper::STATEMACHINE_TRANSITION
79- );
77+ $ transitionType = 'workflow ' === $ type ? PlantUmlDumper::WORKFLOW_TRANSITION : PlantUmlDumper::STATEMACHINE_TRANSITION ;
78+ $ dumper = new PlantUmlDumper ($ transitionType );
8079 } elseif ('workflow ' === $ type ) {
8180 $ dumper = new GraphvizDumper ();
8281 } else {
@@ -89,12 +88,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
8988 $ marking ->mark ($ place );
9089 }
9190
92- $ options = array ();
93- $ label = $ input ->getOption ('label ' );
94- if (null !== $ label && '' !== trim ($ label )) {
95- $ options = array ('graph ' => array ('label ' => $ label ));
96- }
97- $ options = array_replace ($ options , array ('name ' => $ serviceId , 'nofooter ' => true ));
91+ $ options = array (
92+ 'name ' => $ serviceId ,
93+ 'nofooter ' => true ,
94+ 'graph ' => array (
95+ 'label ' => $ input ->getOption ('label ' ),
96+ ),
97+ );
9898 $ output ->writeln ($ dumper ->dump ($ workflow ->getDefinition (), $ marking , $ options ));
9999 }
100100}
0 commit comments