@@ -70,19 +70,9 @@ public function handle()
70
70
);
71
71
});
72
72
73
- // Check if output filename has .txt extension
74
- $ outputFileName = $ this ->getOutputFileName ();
75
- if (pathinfo ($ outputFileName , PATHINFO_EXTENSION ) === 'txt ' ) {
76
- // Generate structured text output for .txt files
77
- $ textOutput = $ this ->graphBuilder ->generateStructuredTextRepresentation ($ models );
78
- file_put_contents ($ outputFileName , $ textOutput );
79
- $ this ->info (PHP_EOL );
80
- $ this ->info ('Wrote structured ER diagram to ' . $ outputFileName );
81
- return ;
82
- }
83
-
84
73
$ graph = $ this ->graphBuilder ->buildGraph ($ models );
85
74
75
+ // First check for text-output option
86
76
if ($ this ->option ('text-output ' ) || $ this ->option ('format ' ) === self ::FORMAT_TEXT ) {
87
77
$ textOutput = $ graph ->__toString ();
88
78
@@ -100,6 +90,17 @@ public function handle()
100
90
return ;
101
91
}
102
92
93
+ // Then check for .txt extension in filename
94
+ $ outputFileName = $ this ->getOutputFileName ();
95
+ if (pathinfo ($ outputFileName , PATHINFO_EXTENSION ) === 'txt ' ) {
96
+ // Generate structured text output for .txt files
97
+ $ textOutput = $ this ->graphBuilder ->generateStructuredTextRepresentation ($ models );
98
+ file_put_contents ($ outputFileName , $ textOutput );
99
+ $ this ->info (PHP_EOL );
100
+ $ this ->info ('Wrote structured ER diagram to ' . $ outputFileName );
101
+ return ;
102
+ }
103
+
103
104
$ graph ->export ($ this ->option ('format ' ), $ outputFileName );
104
105
105
106
$ this ->info (PHP_EOL );
0 commit comments