3535class Panel extends MessageFormatter
3636{
3737 /** @var string */
38- public $ title = '' ;
38+ public string $ title = '' ;
3939
4040 /** @var string */
41- public $ titleBorder = '- ' ;
41+ public string $ titleBorder = '- ' ;
4242
4343 /** @var string */
44- public $ titleStyle = 'bold ' ;
44+ public string $ titleStyle = 'bold ' ;
4545
4646 /** @var string */
47- public $ titleAlign = self ::ALIGN_LEFT ;
47+ public string $ titleAlign = self ::ALIGN_LEFT ;
4848
4949 /** @var string|array */
50- public $ data ;
50+ public string | array $ data ;
5151
5252 /** @var string */
53- public $ bodyAlign = self ::ALIGN_LEFT ;
53+ public string $ bodyAlign = self ::ALIGN_LEFT ;
5454
5555 /** @var string */
56- public $ footerBorder = '- ' ;
56+ public string $ footerBorder = '- ' ;
5757
5858 /** @var string */
59- public $ footer = '' ;
59+ public string $ footer = '' ;
6060
6161 /** @var bool */
62- public $ ucFirst = true ;
62+ public bool $ ucFirst = true ;
6363
6464 /** @var int */
65- public $ width = 0 ;
65+ public int $ width = 0 ;
6666
6767 /** @var bool */
68- public $ showBorder = true ;
68+ public bool $ showBorder = true ;
6969
7070 /** @var string */
71- public $ borderYChar = '- ' ;
71+ public string $ borderYChar = '- ' ;
7272
7373 /** @var string */
74- public $ borderXChar = '| ' ;
74+ public string $ borderXChar = '| ' ;
7575
7676 /**
7777 * @var string Template for the panel. don't contains border
7878 */
79- public $ template = <<<EOF
79+ public string $ template = <<<EOF
8080{%title%}
8181{%title-border%}
8282{%content%}
@@ -93,7 +93,7 @@ class Panel extends MessageFormatter
9393 *
9494 * @return int
9595 */
96- public static function show ($ data , string $ title = 'Information Panel ' , array $ opts = []): int
96+ public static function show (mixed $ data , string $ title = 'Information Panel ' , array $ opts = []): int
9797 {
9898 if (!$ data ) {
9999 Console::write ('<info>No data to display!</info> ' );
@@ -164,7 +164,7 @@ public static function show($data, string $title = 'Information Panel', array $o
164164 $ titleLength = mb_strlen ($ title , 'UTF-8 ' );
165165 $ panelWidth = $ panelWidth > $ titleLength ? $ panelWidth : $ titleLength ;
166166 $ indentSpace = Str::pad (' ' , ceil ($ panelWidth / 2 ) - ceil ($ titleLength / 2 ) + 2 * 2 , ' ' );
167- Console::write (" { $ indentSpace} <bold> { $ title} </bold> " );
167+ Console::write (" $ indentSpace<bold> $ title</bold> " );
168168 }
169169
170170 // output panel top border
@@ -226,7 +226,6 @@ public function format(): string
226226 if (is_array ($ value )) {
227227 $ temp = '' ;
228228
229- /** @var array $value */
230229 foreach ($ value as $ key => $ val ) {
231230 if (is_bool ($ val )) {
232231 $ val = $ val ? 'True ' : 'False ' ;
@@ -262,7 +261,7 @@ public function format(): string
262261 $ titleLength = mb_strlen ($ title , 'UTF-8 ' );
263262 $ panelWidth = $ panelWidth > $ titleLength ? $ panelWidth : $ titleLength ;
264263 $ indentSpace = Str::pad (' ' , ceil ($ panelWidth / 2 ) - ceil ($ titleLength / 2 ) + 2 * 2 , ' ' );
265- $ buffer ->write (" { $ indentSpace} <bold> { $ title} </bold> \n" );
264+ $ buffer ->write (" $ indentSpace<bold> $ title</bold> \n" );
266265 }
267266
268267 // output panel top border
@@ -297,7 +296,7 @@ public function format(): string
297296 *
298297 * @return $this
299298 */
300- public function showBorder ($ border ): self
299+ public function showBorder (bool $ border ): self
301300 {
302301 $ this ->showBorder = (bool )$ border ;
303302 return $ this ;
0 commit comments