File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed
Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change 22
33namespace Helldar \PrettyArray \Services ;
44
5- use function array_keys ;
6- use function file_exists ;
7-
85use Helldar \PrettyArray \Exceptions \FileDoesntExistsException ;
96use Helldar \Support \Facades \Arr ;
10- use function is_array ;
11- use function is_numeric ;
12- use function mb_strlen ;
13- use function str_pad ;
147
158final class Formatter
169{
@@ -20,6 +13,8 @@ final class Formatter
2013
2114 protected $ pad_length = 4 ;
2215
16+ protected $ line_break = "\r\n" ;
17+
2318 public static function make (): self
2419 {
2520 return new static ();
@@ -39,13 +34,13 @@ public function raw(array $array, int $pad = 1): string
3934 {
4035 $ keys_size = $ this ->sizeKeys ($ array );
4136 $ pad_length = $ this ->pad_length * $ pad ;
42- $ formatted = '[ ' . PHP_EOL ;
37+ $ formatted = '[ ' . $ this -> line_break ;
4338
4439 foreach ($ array as $ key => $ value ) {
4540 $ key = $ this ->key ($ key , $ keys_size );
4641 $ value = $ this ->value ($ value , $ pad + 1 );
4742
48- $ row = "{$ key } => {$ value }, " . PHP_EOL ;
43+ $ row = "{$ key } => {$ value }, " . $ this -> line_break ;
4944
5045 $ formatted .= $ this ->pad ($ row , $ pad_length );
5146 }
You can’t perform that action at this time.
0 commit comments