EncodeOptions::compact()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Squareetlabs\LaravelToon\Toon;
6
7
class EncodeOptions
8
{
9
    public function __construct(
10
        public readonly int $indent = 2,
11
        public readonly string $delimiter = ',',
12
        public readonly bool $prettyPrint = false,
13
        public readonly int $minRowsToTabular = 2,
14
        public readonly int $maxPreviewItems = 200,
15
    ) {}
16
17
    public static function compact(): self
18
    {
19
        return new self(
20
            indent: 0,
21
            delimiter: ',',
22
            prettyPrint: false,
23
            minRowsToTabular: 2,
24
        );
25
    }
26
27
    public static function readable(): self
28
    {
29
        return new self(
30
            indent: 2,
31
            delimiter: ',',
32
            prettyPrint: true,
33
            minRowsToTabular: 2,
34
        );
35
    }
36
37
    public static function tabular(): self
38
    {
39
        return new self(
40
            indent: 0,
41
            delimiter: "\t",
42
            prettyPrint: false,
43
            minRowsToTabular: 1,
44
        );
45
    }
46
}
47
48