@@ -152,7 +152,8 @@ public function run(array $params)
152152 */
153153 protected function getClassName (): string
154154 {
155- $ name = $ this ->params [0 ] ?? CLI ::getSegment (0 );
155+ $ name = $ this ->params [0 ] ?? CLI ::getSegment (2 );
156+
156157 return $ name ?? '' ;
157158 }
158159
@@ -203,6 +204,7 @@ protected function qualifyClassName(string $class): string
203204 protected function getRootNamespace (): string
204205 {
205206 $ rootNamespace = $ this ->params ['n ' ] ?? CLI ::getOption ('n ' ) ?? APP_NAMESPACE ;
207+
206208 return trim (str_replace ('/ ' , '\\' , $ rootNamespace ), '\\' );
207209 }
208210
@@ -238,6 +240,7 @@ protected function buildPath(string $class): string
238240
239241 $ path = $ base . DIRECTORY_SEPARATOR . str_replace ('\\' , DIRECTORY_SEPARATOR , $ name ) . '.php ' ;
240242 $ filename = $ this ->modifyBasename (basename ($ path ));
243+
241244 return implode (DIRECTORY_SEPARATOR , array_slice (explode (DIRECTORY_SEPARATOR , $ path ), 0 , -1 )) . DIRECTORY_SEPARATOR . $ filename ;
242245 }
243246
@@ -310,6 +313,7 @@ protected function setReplacements(string $template, string $class): string
310313
311314 $ template = str_replace ($ namespaces , $ this ->getNamespace ($ class ), $ template );
312315 $ class = str_replace ($ this ->getNamespace ($ class ) . '\\' , '' , $ class );
316+
313317 return str_replace ($ classes , $ class , $ template );
314318 }
315319
@@ -326,11 +330,10 @@ protected function sortImports(string $template): string
326330 {
327331 $ imports = explode ("\n" , trim ($ match ['imports ' ]));
328332 sort ($ imports );
333+
329334 return str_replace (trim ($ match ['imports ' ]), implode ("\n" , $ imports ), $ template );
330335 }
331336
332- // @codeCoverageIgnoreStart
333- return $ template ;
334- // @codeCoverageIgnoreEnd
337+ return $ template ; // @codeCoverageIgnore
335338 }
336339}
0 commit comments