@@ -39,15 +39,15 @@ protected function configure()
39
39
->setDefinition (array (
40
40
new InputArgument ('name ' , InputArgument::REQUIRED , 'A workflow name ' ),
41
41
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 ' ),
43
43
new InputOption ('dump-format ' , null , InputOption::VALUE_REQUIRED , 'The dump format [dot|puml] ' , 'dot ' ),
44
44
))
45
45
->setDescription ('Dump a workflow ' )
46
46
->setHelp (<<<'EOF'
47
47
The <info>%command.name%</info> command dumps the graphical representation of a
48
48
workflow in different formats
49
49
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
51
51
<info>PUML</info>: %command.full_name% <workflow name> --dump-format=puml | java -jar plantuml.jar -p > workflow.png
52
52
53
53
EOF
@@ -74,9 +74,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
74
74
}
75
75
76
76
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 );
80
79
} elseif ('workflow ' === $ type ) {
81
80
$ dumper = new GraphvizDumper ();
82
81
} else {
@@ -89,12 +88,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
89
88
$ marking ->mark ($ place );
90
89
}
91
90
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
+ );
98
98
$ output ->writeln ($ dumper ->dump ($ workflow ->getDefinition (), $ marking , $ options ));
99
99
}
100
100
}
0 commit comments