@@ -17,11 +17,16 @@ if (!is_file($playerFile)) {
17
17
copy (__DIR__ . '/player.php.sample ' , $ playerFile );
18
18
}
19
19
20
+ function line (string $ text , string $ fill = ' ' ): string
21
+ {
22
+ return str_pad ($ text , 120 , $ fill , STR_PAD_RIGHT );
23
+ }
24
+
20
25
$ config = include __DIR__ . '/../../../player.php ' ;
21
26
$ 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 ' );
25
30
26
31
try {
27
32
Player::create ()->check ($ config );
43
48
44
49
$ total = array_reduce ($ exception ->leaking , fn (int $ reduced , array $ imports ) => $ reduced + count ($ imports ), 0 );
45
50
46
- $ redline = '<fg=black;bg=red> ' . str_repeat ( ' ' , 120 ) . '</> ' ;
51
+ $ redline = '<fg=black;bg=red> ' . line ( '' ) . '</> ' ;
47
52
$ 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 );
49
54
50
55
$ console ->writeln ($ redline );
51
56
$ console ->writeln ("<fg=white;bg=red> $ error</> " );
0 commit comments