Skip to content

Commit 53b6176

Browse files
author
Andrey Helldar
authored
Replaced PHP_EOL to $this->line_break
1 parent 97c7bdd commit 53b6176

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/Services/Formatter.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,8 @@
22

33
namespace Helldar\PrettyArray\Services;
44

5-
use function array_keys;
6-
use function file_exists;
7-
85
use Helldar\PrettyArray\Exceptions\FileDoesntExistsException;
96
use 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

158
final 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
}

0 commit comments

Comments
 (0)