File tree 1 file changed +23
-22
lines changed
1 file changed +23
-22
lines changed Original file line number Diff line number Diff line change @@ -32,28 +32,29 @@ class Gv implements ExporterInterface
32
32
*/
33
33
public function export (NodeInterface $ node ): string
34
34
{
35
- $ attributes = [];
36
- foreach ($ this ->attributes as $ key => $ attribute ) {
37
- if (\is_string ($ attribute )) {
38
- $ attributes [] = \sprintf (
39
- ' %s = %s ' ,
40
- $ key ,
41
- $ attribute
42
- );
43
-
44
- continue ;
45
- }
46
-
47
- if (\is_array ($ attribute )) {
48
- $ attributes [] = \sprintf (
49
- ' %s %s ' ,
50
- $ key ,
51
- $ this ->attributesArrayToText ($ attribute )
52
- );
53
-
54
- continue ;
55
- }
56
- }
35
+ $ attributes = \array_map (
36
+ function ($ key , $ data ) {
37
+ if (\is_string ($ data )) {
38
+ return \sprintf (
39
+ ' %s = %s ' ,
40
+ $ key ,
41
+ $ data
42
+ );
43
+ }
44
+
45
+ if (\is_array ($ data )) {
46
+ return \sprintf (
47
+ ' %s %s ' ,
48
+ $ key ,
49
+ $ this ->attributesArrayToText ($ data )
50
+ );
51
+ }
52
+
53
+ return null ;
54
+ },
55
+ \array_keys ($ this ->attributes ),
56
+ $ this ->attributes
57
+ );
57
58
58
59
$ nodes = [];
59
60
foreach ($ node ->all () as $ child ) {
You can’t perform that action at this time.
0 commit comments