Passed
Push — master ( 687cbc...187bee )
by Petr
02:53
created

Options::__clone()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 3

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 3
nc 4
nop 0
crap 3
1
<?php
2
3
namespace kalanis\nested_tree\Support;
4
5
/**
6
 * Options for reading data from DB
7
 * Note: not everything is need in each used method
8
 */
9
class Options
10
{
11
    /**
12
     * @var int|null
13
     * The filter taxonomy ID
14
     */
15
    public ?int $currentId = null;
16
17
    /**
18
     * @var int|null
19
     * The filter parent ID.
20
     */
21
    public ?int $parentId = null;
22
23
    /**
24
     * @var Search|null
25
     * The search object
26
     */
27
    public ?Search $search = null;
28
29
    /**
30
     * @var array<string|int>
31
     * The taxonomy ID to look with `IN()` database function.
32
     * The array values must be integer, example `array(1,3,4,5)`.
33
     * This will flatten the result even when `listFlattened` was not set.
34
     */
35
    public array $filterIdBy = [];
36
37
    /**
38
     * @var Conditions|null
39
     * The custom where conditions.
40
     */
41
    public ?Conditions $where = null;
42
43
    /**
44
     * @var array<int, string>
45
     */
46
    public array $additionalColumns = [];
47
48
    /**
49
     * @var bool
50
     * Set to `true` to do not sort order the result.
51
     */
52
    public bool $noSortOrder = false;
53
54
    /**
55
     * @var bool
56
     * Set to `true` to do not limit the result.
57
     */
58
    public bool $unlimited = false;
59
60
    /**
61
     * @var int|null
62
     * The offset in the query
63
     */
64
    public ?int $offset = null;
65
66
    /**
67
     * @var int|null
68
     * The limit number in the query.
69
     */
70
    public ?int $limit = null;
71
72
    /**
73
     * @var bool
74
     * Set to `true` to list the result flatten.
75
     */
76
    public bool $listFlattened = false;
77
78
    /**
79
     * @var bool
80
     * Set to `true` to skip currently selected item.
81
     */
82
    public bool $skipCurrent = false;
83
84
    /**
85
     * @var bool
86
     * Set to `true` to explicit join of children
87
     */
88
    public bool $joinChild = false;
89
90 2
    public function __clone()
91
    {
92 2
        $this->search = is_null($this->search) ? null : clone $this->search;
93 2
        $this->where = is_null($this->where) ? null : clone $this->where;
94
    }
95
}
96