@@ -58,6 +58,13 @@ class Console
58
58
'light_gray ' => '47 ' ,
59
59
];
60
60
61
+ /**
62
+ * Max default line length.
63
+ *
64
+ * @var int
65
+ */
66
+ public static $ maxLineLength = 80 ;
67
+
61
68
/**
62
69
* Get new line char.
63
70
*
@@ -84,8 +91,6 @@ public static function header()
84
91
return ;
85
92
}
86
93
87
- $ version = Scanner::getVersion ();
88
- self ::newLine (2 );
89
94
$ header = <<<EOD
90
95
█████╗ ███╗ ███╗██╗ ██╗███████╗ ██████╗ █████╗ ███╗ ██╗
91
96
██╔══██╗████╗ ████║██║ ██║██╔════╝██╔════╝██╔══██╗████╗ ██║
@@ -95,6 +100,15 @@ public static function header()
95
100
╚═╝ ╚═╝╚═╝ ╚═╝ ╚══╝╚══╝ ╚══════╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═══╝
96
101
Github: https://github.com/marcocesarato/PHP-Antimalware-Scanner
97
102
EOD ;
103
+ $ headerArray = explode ("\n" , $ header );
104
+ foreach ($ headerArray as $ key => $ value ) {
105
+ $ diff = strlen ($ value ) - mb_strlen ($ value );
106
+ $ headerArray [$ key ] = str_pad ($ value , self ::$ maxLineLength + $ diff , ' ' , STR_PAD_BOTH );
107
+ }
108
+ $ header = implode (PHP_EOL , $ headerArray );
109
+ $ version = Scanner::getVersion ();
110
+
111
+ self ::newLine ();
98
112
self ::displayLine ($ header , 2 , 'green ' );
99
113
$ title = self ::title ('version ' . $ version );
100
114
self ::display ($ title , 'green ' );
@@ -132,8 +146,11 @@ public static function header()
132
146
*
133
147
* @return string
134
148
*/
135
- public static function title ($ text , $ char = ' ' , $ length = 64 )
149
+ public static function title ($ text , $ char = ' ' , $ length = null )
136
150
{
151
+ if ($ length === null ) {
152
+ $ length = self ::$ maxLineLength ;
153
+ }
137
154
$ result = '' ;
138
155
$ strLength = strlen ($ text );
139
156
$ spaces = $ length - $ strLength ;
@@ -528,7 +545,7 @@ public static function helplist($type = null)
528
545
*/
529
546
public static function wordWrap ($ text )
530
547
{
531
- return wordwrap ($ text , 80 );
548
+ return wordwrap ($ text , self :: $ maxLineLength );
532
549
}
533
550
534
551
/**
0 commit comments