Skip to content

Commit c029f21

Browse files
committed
turn limit into property
1 parent 539209a commit c029f21

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Exporter.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@
3838

3939
final readonly class Exporter
4040
{
41-
private const MAX_SHORTENED_ITEMS = 10;
41+
public function __construct(
42+
private int $shortedArraysLongerThan = 10
43+
) {
44+
}
4245

4346
/**
4447
* Exports a value as a string.
@@ -75,8 +78,8 @@ public function shortenedRecursiveExport(array &$data, ?RecursionContext $proces
7578
$count = count($data, COUNT_RECURSIVE);
7679

7780
foreach ($array as $key => $value) {
78-
if ($count > self::MAX_SHORTENED_ITEMS && $i > self::MAX_SHORTENED_ITEMS) {
79-
$result[] = sprintf('...%d more elements', $count - self::MAX_SHORTENED_ITEMS);
81+
if ($count > $this->shortedArraysLongerThan && $i > $this->shortedArraysLongerThan) {
82+
$result[] = sprintf('...%d more elements', $count - $this->shortedArraysLongerThan);
8083

8184
break;
8285
}

0 commit comments

Comments
 (0)