EncodeOptions   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 37
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A readable() 0 7 1
A compact() 0 7 1
A __construct() 0 7 1
A tabular() 0 7 1
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