11<?php
22
3+ declare (strict_types=1 );
4+
35namespace HiFolks \Fusion \Console \Commands ;
46
57use Illuminate \Console \Command ;
@@ -63,13 +65,15 @@ public function handle(): ?bool
6365
6466 $ this ->components ->twoColumnDetail (
6567 'Parsing the Markdown Directory ' ,
66- sprintf ('<info>%s</info> ' , $ markdownPath ));
68+ sprintf ('<info>%s</info> ' , $ markdownPath ),
69+ );
6770
6871 $ modelName = basename ($ markdownPath );
6972
7073 $ this ->components ->twoColumnDetail (
7174 'Folder Markdown Name ' ,
72- sprintf ('<info>%s</info> ' , $ modelName ));
75+ sprintf ('<info>%s</info> ' , $ modelName ),
76+ );
7377
7478 if (! is_dir ($ markdownPath )) {
7579 $ this ->error (sprintf ('The Folder %s does not exist! ' , $ markdownPath ));
@@ -78,7 +82,7 @@ public function handle(): ?bool
7882 // return Command::INVALID;
7983 }
8084
81- $ filesystem = new FileSystem ;
85+ $ filesystem = new FileSystem () ;
8286
8387 $ collectedFields = [];
8488 foreach (File::files ($ markdownPath ) as $ file ) {
@@ -92,49 +96,55 @@ public function handle(): ?bool
9296 $ collectedFields = array_unique (
9397 array_merge (
9498 $ collectedFields ,
95- array_keys ($ object ->matter ())
96- )
99+ array_keys ($ object ->matter ()),
100+ ),
97101 );
98102
99103 }
100104
101105 $ this ->modelName = Str::studly ($ modelName );
102106 $ this ->components ->twoColumnDetail (
103107 'Model Name ' ,
104- sprintf ('<info>%s</info> ' , $ this ->modelName ));
108+ sprintf ('<info>%s</info> ' , $ this ->modelName ),
109+ );
105110 $ className = $ this ->qualifyClass ($ this ->getNameInput ());
106111 $ path = $ this ->getPath ($ className );
107112 $ this ->components ->twoColumnDetail (
108113 'Model Name (with Namespace) ' ,
109- sprintf ('<info>%s</info> ' , $ className ));
114+ sprintf ('<info>%s</info> ' , $ className ),
115+ );
110116 $ this ->components ->twoColumnDetail (
111117 'Model path ' ,
112- sprintf ('<info>%s</info> ' , $ path ));
118+ sprintf ('<info>%s</info> ' , $ path ),
119+ );
113120 if (is_file ($ path )) {
114121 $ this ->components ->twoColumnDetail (
115122 'Check file ' ,
116- '<info>File exists</info> ' );
123+ '<info>File exists</info> ' ,
124+ );
117125 } else {
118126 $ this ->components ->twoColumnDetail (
119127 'Check file ' ,
120- '<fg=yellow>Does NOT exists</> ' );
128+ '<fg=yellow>Does NOT exists</> ' ,
129+ );
121130 }
122131
123132 $ this ->output ->newLine ();
124133 if ($ collectedFields === []) {
125134 $ this ->components ->twoColumnDetail (
126135 'Frontmatter fields ' ,
127- sprintf ('<fg=yellow>NO frontmatter fields found in %s path</> ' , $ markdownPath ));
136+ sprintf ('<fg=yellow>NO frontmatter fields found in %s path</> ' , $ markdownPath ),
137+ );
128138
129139 } else {
130- $ this ->frontmatterFields = '" ' . implode ('"," ' , $ collectedFields ). '" ' ;
140+ $ this ->frontmatterFields = '" ' . implode ('"," ' , $ collectedFields ) . '" ' ;
131141 $ this ->components ->twoColumnDetail (
132142 'In the frontmatterFields() method you have to return: ' ,
133- ''
143+ '' ,
134144 );
135145 $ this ->components ->twoColumnDetail (
136146 '' ,
137- $ this ->frontmatterFields
147+ $ this ->frontmatterFields ,
138148 );
139149
140150 }
@@ -150,15 +160,15 @@ public function handle(): ?bool
150160
151161 protected function getNameInput ()
152162 {
153- return '\\App \\Models \\' . $ this ->modelName ;
163+ return '\\App \\Models \\' . $ this ->modelName ;
154164 }
155165
156166 protected function getStub ()
157167 {
158168 return realpath (
159- __DIR__ .
160- '/../../.. ' .
161- '/stubs/app/Models/BasicFusionTemplateModel.stub '
169+ __DIR__
170+ . '/../../.. '
171+ . '/stubs/app/Models/BasicFusionTemplateModel.stub ' ,
162172 );
163173 }
164174
@@ -167,7 +177,7 @@ protected function replaceClass($stub, $name)
167177 $ stub = str_replace (
168178 '{{ fields }} ' ,
169179 $ this ->frontmatterFields ,
170- $ stub
180+ $ stub,
171181 );
172182
173183 return parent ::replaceClass ($ stub , $ name );
0 commit comments