@@ -17,11 +17,16 @@ if (!is_file($playerFile)) {
1717 copy (__DIR__ . '/player.php.sample ' , $ playerFile );
1818}
1919
20+ function line (string $ text , string $ fill = ' ' ): string
21+ {
22+ return str_pad ($ text , 120 , $ fill , STR_PAD_RIGHT );
23+ }
24+
2025$ config = include __DIR__ . '/../../../player.php ' ;
2126$ console = new ConsoleOutput ();
22- $ separator = str_repeat ( ' - ' , 120 );
23- $ greanline = '<fg=black;bg=green> ' . str_repeat ( ' ' , 105 ) . '</> ' ;
24- $ success = str_pad (' [OK] No leaking imports ' , 120 , ' ' , STR_PAD_RIGHT );
27+ $ separator = line ( ' ' , ' - ' );
28+ $ greanline = '<fg=black;bg=green> ' . line ( '' ) . '</> ' ;
29+ $ success = line (' [OK] No leaking imports ' );
2530
2631try {
2732 Player::create ()->check ($ config );
4348
4449 $ total = array_reduce ($ exception ->leaking , fn (int $ reduced , array $ imports ) => $ reduced + count ($ imports ), 0 );
4550
46- $ redline = '<fg=black;bg=red> ' . str_repeat ( ' ' , 120 ) . '</> ' ;
51+ $ redline = '<fg=black;bg=red> ' . line ( '' ) . '</> ' ;
4752 $ message = sprintf (' [ERROR] Found %s unacceptable imports in %s classes ' , $ total , count ($ exception ->leaking ));
48- $ error = str_pad ($ message, 120 , ' ' , STR_PAD_RIGHT );
53+ $ error = line ($ message );
4954
5055 $ console ->writeln ($ redline );
5156 $ console ->writeln ("<fg=white;bg=red> $ error</> " );
0 commit comments