@@ -24,15 +24,6 @@ abstract class AbstractApplication implements ApplicationInterface
2424{
2525 use InputOutputAwareTrait, SimpleEventTrait;
2626
27- /**
28- * @var array
29- * [
30- * 0 => logo text,
31- * 1 => color style, // 'info'
32- * ]
33- */
34- private static $ logoInfo ;
35-
3627 /** @var array */
3728 protected static $ internalCommands = [
3829 'version ' => 'Show application version information ' ,
@@ -66,6 +57,9 @@ abstract class AbstractApplication implements ApplicationInterface
6657 // 'env' => 'pdt', // dev test pdt
6758 // 'charset' => 'UTF-8',
6859
60+ 'logoText ' => '' ,
61+ 'logoStyle ' => 'info ' ,
62+
6963 // runtime stats
7064 '_stats ' => [],
7165 ];
@@ -366,16 +360,21 @@ public function showHelpInfo($quit = true, string $command = null)
366360 */
367361 public function showVersionInfo ($ quit = true )
368362 {
363+ $ os = PHP_OS ;
369364 $ date = date ('Y.m.d ' );
365+ $ logo = '' ;
370366 $ name = $ this ->getMeta ('name ' , 'Console Application ' );
371367 $ version = $ this ->getMeta ('version ' , 'Unknown ' );
372368 $ publishAt = $ this ->getMeta ('publishAt ' , 'Unknown ' );
373369 $ updateAt = $ this ->getMeta ('updateAt ' , 'Unknown ' );
374370 $ phpVersion = PHP_VERSION ;
375- $ os = PHP_OS ;
371+
372+ if ($ logoTxt = $ this ->getLogoText ()) {
373+ $ logo = Helper::wrapTag ($ logoTxt , $ this ->getLogoStyle ());
374+ }
376375
377376 $ this ->output ->aList ([
378- "\n <info> {$ name }</info>, Version <comment> $ version</comment> \n" ,
377+ "\n <info> {$ name }</info>, Version <comment> $ version</comment> \n$ logo " ,
379378 'System Info ' => "PHP version <info> $ phpVersion</info>, on <info> $ os</info> system " ,
380379 'Application Info ' => "Update at <info> $ updateAt</info>, publish at <info> $ publishAt</info>(current $ date) " ,
381380 ], null , [
@@ -606,49 +605,33 @@ public function isCommand($name)
606605 /**
607606 * @return string|null
608607 */
609- public static function getLogoTxt ()
608+ public function getLogoText ()
610609 {
611- return self :: $ logoInfo [ 0 ] ?? null ;
610+ return $ this -> meta [ ' logoText ' ] ?? null ;
612611 }
613612
614613 /**
615614 * @param string $logoTxt
616615 */
617- public static function setLogoTxt (string $ logoTxt )
616+ public function setLogoText (string $ logoTxt )
618617 {
619- self :: $ logoInfo [ 0 ] = $ logoTxt ;
618+ $ this -> meta [ ' logoText ' ] = $ logoTxt ;
620619 }
621620
622621 /**
623622 * @return string|null
624623 */
625- public static function getLogoStyle ()
624+ public function getLogoStyle ()
626625 {
627- return self :: $ logoInfo [ 1 ] ?? 'info ' ;
626+ return $ this -> meta [ ' logoStyle ' ] ?? 'info ' ;
628627 }
629628
630629 /**
631630 * @param string $style
632631 */
633- public static function setLogoStyle (string $ style )
634- {
635- self ::$ logoInfo [1 ] = $ style ;
636- }
637-
638- /**
639- * @return array
640- */
641- public static function getLogoInfo (): array
642- {
643- return self ::$ logoInfo ;
644- }
645-
646- /**
647- * @param array $logoInfo
648- */
649- public static function setLogoInfo (array $ logoInfo )
632+ public function setLogoStyle (string $ style )
650633 {
651- self :: $ logoInfo = $ logoInfo ;
634+ $ this -> meta [ ' logoStyle ' ] = $ style ;
652635 }
653636
654637 /**
0 commit comments