26
26
*/
27
27
class GraphvizDumper implements DumperInterface
28
28
{
29
- protected static $ defaultOptions = array (
30
- 'graph ' => array ( 'ratio ' => 'compress ' , 'rankdir ' => 'LR ' ) ,
31
- 'node ' => array ( 'fontsize ' => 9 , 'fontname ' => 'Arial ' , 'color ' => '#333333 ' , 'fillcolor ' => 'lightblue ' , 'fixedsize ' => true , 'width ' => 1 ) ,
32
- 'edge ' => array ( 'fontsize ' => 9 , 'fontname ' => 'Arial ' , 'color ' => '#333333 ' , 'arrowhead ' => 'normal ' , 'arrowsize ' => 0.5 ) ,
33
- ) ;
29
+ protected static $ defaultOptions = [
30
+ 'graph ' => [ 'ratio ' => 'compress ' , 'rankdir ' => 'LR ' ] ,
31
+ 'node ' => [ 'fontsize ' => 9 , 'fontname ' => 'Arial ' , 'color ' => '#333333 ' , 'fillcolor ' => 'lightblue ' , 'fixedsize ' => true , 'width ' => 1 ] ,
32
+ 'edge ' => [ 'fontsize ' => 9 , 'fontname ' => 'Arial ' , 'color ' => '#333333 ' , 'arrowhead ' => 'normal ' , 'arrowsize ' => 0.5 ] ,
33
+ ] ;
34
34
35
35
/**
36
36
* {@inheritdoc}
@@ -43,7 +43,7 @@ class GraphvizDumper implements DumperInterface
43
43
* * node: The default options for nodes (places + transitions)
44
44
* * edge: The default options for edges
45
45
*/
46
- public function dump (Definition $ definition , Marking $ marking = null , array $ options = array () )
46
+ public function dump (Definition $ definition , Marking $ marking = null , array $ options = [] )
47
47
{
48
48
$ places = $ this ->findPlaces ($ definition , $ marking );
49
49
$ transitions = $ this ->findTransitions ($ definition );
@@ -63,20 +63,20 @@ public function dump(Definition $definition, Marking $marking = null, array $opt
63
63
*/
64
64
protected function findPlaces (Definition $ definition , Marking $ marking = null )
65
65
{
66
- $ places = array () ;
66
+ $ places = [] ;
67
67
68
68
foreach ($ definition ->getPlaces () as $ place ) {
69
- $ attributes = array () ;
69
+ $ attributes = [] ;
70
70
if ($ place === $ definition ->getInitialPlace ()) {
71
71
$ attributes ['style ' ] = 'filled ' ;
72
72
}
73
73
if ($ marking && $ marking ->has ($ place )) {
74
74
$ attributes ['color ' ] = '#FF0000 ' ;
75
75
$ attributes ['shape ' ] = 'doublecircle ' ;
76
76
}
77
- $ places [$ place ] = array (
77
+ $ places [$ place ] = [
78
78
'attributes ' => $ attributes ,
79
- ) ;
79
+ ] ;
80
80
}
81
81
82
82
return $ places ;
@@ -87,13 +87,13 @@ protected function findPlaces(Definition $definition, Marking $marking = null)
87
87
*/
88
88
protected function findTransitions (Definition $ definition )
89
89
{
90
- $ transitions = array () ;
90
+ $ transitions = [] ;
91
91
92
92
foreach ($ definition ->getTransitions () as $ transition ) {
93
- $ transitions [] = array (
94
- 'attributes ' => array ( 'shape ' => 'box ' , 'regular ' => true ) ,
93
+ $ transitions [] = [
94
+ 'attributes ' => [ 'shape ' => 'box ' , 'regular ' => true ] ,
95
95
'name ' => $ transition ->getName (),
96
- ) ;
96
+ ] ;
97
97
}
98
98
99
99
return $ transitions ;
@@ -132,22 +132,22 @@ protected function addTransitions(array $transitions)
132
132
*/
133
133
protected function findEdges (Definition $ definition )
134
134
{
135
- $ dotEdges = array () ;
135
+ $ dotEdges = [] ;
136
136
137
137
foreach ($ definition ->getTransitions () as $ transition ) {
138
138
foreach ($ transition ->getFroms () as $ from ) {
139
- $ dotEdges [] = array (
139
+ $ dotEdges [] = [
140
140
'from ' => $ from ,
141
141
'to ' => $ transition ->getName (),
142
142
'direction ' => 'from ' ,
143
- ) ;
143
+ ] ;
144
144
}
145
145
foreach ($ transition ->getTos () as $ to ) {
146
- $ dotEdges [] = array (
146
+ $ dotEdges [] = [
147
147
'from ' => $ transition ->getName (),
148
148
'to ' => $ to ,
149
149
'direction ' => 'to ' ,
150
- ) ;
150
+ ] ;
151
151
}
152
152
}
153
153
@@ -203,7 +203,7 @@ protected function dotize($id)
203
203
204
204
private function addAttributes (array $ attributes )
205
205
{
206
- $ code = array () ;
206
+ $ code = [] ;
207
207
208
208
foreach ($ attributes as $ k => $ v ) {
209
209
$ code [] = sprintf ('%s="%s" ' , $ k , $ v );
@@ -214,7 +214,7 @@ private function addAttributes(array $attributes)
214
214
215
215
private function addOptions (array $ options )
216
216
{
217
- $ code = array () ;
217
+ $ code = [] ;
218
218
219
219
foreach ($ options as $ k => $ v ) {
220
220
$ code [] = sprintf ('%s="%s" ' , $ k , $ v );
0 commit comments