2626 */
2727class GraphvizDumper implements DumperInterface
2828{
29- protected static $ defaultOptions = array (
30- 'graph ' => array ( 'ratio ' => 'compress ' , 'rankdir ' => 'LR ' ) ,
31- 'node ' => array ( 'fontsize ' => 9 , 'fontname ' => 'Arial ' , 'color ' => '#333333 ' , 'fillcolor ' => 'lightblue ' , 'fixedsize ' => 'false ' , '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 ' => 'false ' , 'width ' => 1 ] ,
32+ 'edge ' => [ 'fontsize ' => 9 , 'fontname ' => 'Arial ' , 'color ' => '#333333 ' , 'arrowhead ' => 'normal ' , 'arrowsize ' => 0.5 ] ,
33+ ] ;
3434
3535 /**
3636 * {@inheritdoc}
@@ -43,7 +43,7 @@ class GraphvizDumper implements DumperInterface
4343 * * node: The default options for nodes (places + transitions)
4444 * * edge: The default options for edges
4545 */
46- public function dump (Definition $ definition , Marking $ marking = null , array $ options = array () )
46+ public function dump (Definition $ definition , Marking $ marking = null , array $ options = [] )
4747 {
4848 $ places = $ this ->findPlaces ($ definition , $ marking );
4949 $ transitions = $ this ->findTransitions ($ definition );
@@ -63,20 +63,20 @@ public function dump(Definition $definition, Marking $marking = null, array $opt
6363 */
6464 protected function findPlaces (Definition $ definition , Marking $ marking = null )
6565 {
66- $ places = array () ;
66+ $ places = [] ;
6767
6868 foreach ($ definition ->getPlaces () as $ place ) {
69- $ attributes = array () ;
69+ $ attributes = [] ;
7070 if ($ place === $ definition ->getInitialPlace ()) {
7171 $ attributes ['style ' ] = 'filled ' ;
7272 }
7373 if ($ marking && $ marking ->has ($ place )) {
7474 $ attributes ['color ' ] = '#FF0000 ' ;
7575 $ attributes ['shape ' ] = 'doublecircle ' ;
7676 }
77- $ places [$ place ] = array (
77+ $ places [$ place ] = [
7878 'attributes ' => $ attributes ,
79- ) ;
79+ ] ;
8080 }
8181
8282 return $ places ;
@@ -87,13 +87,13 @@ protected function findPlaces(Definition $definition, Marking $marking = null)
8787 */
8888 protected function findTransitions (Definition $ definition )
8989 {
90- $ transitions = array () ;
90+ $ transitions = [] ;
9191
9292 foreach ($ definition ->getTransitions () as $ transition ) {
93- $ transitions [] = array (
94- 'attributes ' => array ( 'shape ' => 'box ' , 'regular ' => true ) ,
93+ $ transitions [] = [
94+ 'attributes ' => [ 'shape ' => 'box ' , 'regular ' => true ] ,
9595 'name ' => $ transition ->getName (),
96- ) ;
96+ ] ;
9797 }
9898
9999 return $ transitions ;
@@ -132,22 +132,22 @@ protected function addTransitions(array $transitions)
132132 */
133133 protected function findEdges (Definition $ definition )
134134 {
135- $ dotEdges = array () ;
135+ $ dotEdges = [] ;
136136
137137 foreach ($ definition ->getTransitions () as $ transition ) {
138138 foreach ($ transition ->getFroms () as $ from ) {
139- $ dotEdges [] = array (
139+ $ dotEdges [] = [
140140 'from ' => $ from ,
141141 'to ' => $ transition ->getName (),
142142 'direction ' => 'from ' ,
143- ) ;
143+ ] ;
144144 }
145145 foreach ($ transition ->getTos () as $ to ) {
146- $ dotEdges [] = array (
146+ $ dotEdges [] = [
147147 'from ' => $ transition ->getName (),
148148 'to ' => $ to ,
149149 'direction ' => 'to ' ,
150- ) ;
150+ ] ;
151151 }
152152 }
153153
@@ -211,7 +211,7 @@ protected function escape(string $string): string
211211
212212 private function addAttributes (array $ attributes ): string
213213 {
214- $ code = array () ;
214+ $ code = [] ;
215215
216216 foreach ($ attributes as $ k => $ v ) {
217217 $ code [] = sprintf ('%s="%s" ' , $ k , $ this ->escape ($ v ));
@@ -222,7 +222,7 @@ private function addAttributes(array $attributes): string
222222
223223 private function addOptions (array $ options ): string
224224 {
225- $ code = array () ;
225+ $ code = [] ;
226226
227227 foreach ($ options as $ k => $ v ) {
228228 $ code [] = sprintf ('%s="%s" ' , $ k , $ v );
0 commit comments