Test Failed
Push — master ( 894c40...e5d2d2 )
by Julien
11:34
created

Builder::getColumns()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
/**
4
 * This file is part of the Zemit Framework.
5
 *
6
 * (c) Zemit Team <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE.txt
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Zemit\Support\Exposer;
13
14
class Builder implements BuilderInterface
15
{
16
    private $value;
17
    
18
    private $parent;
19
    
20
    private ?array $columns = null;
21
    
22
    private ?string $field = null;
23
    
24
    private ?string $key = null;
25
    
26
    private ?string $contextKey = null;
27
    
28
    private bool $expose = true;
29
    
30
    private bool $protected = false;
31
    
32
    
33
    public function getValue()
34
    {
35
        return $this->value;
36
    }
37
    
38
    public function setValue($value = null): void
39
    {
40
        $this->value = $value;
41
    }
42
    
43
    public function getParent()
44
    {
45
        return $this->parent;
46
    }
47
    
48
    public function setParent($parent = null): void
49
    {
50
        $this->parent = $parent;
51
    }
52
    
53
    public function getKey(): ?string
54
    {
55
        return $this->key;
56
    }
57
    
58
    public function setKey(?string $key = null): void
59
    {
60
        $this->key = (is_string($key) ? trim(mb_strtolower($key)) : null);
61
    }
62
    
63
    public function getContextKey(): ?string
64
    {
65
        return $this->contextKey;
66
    }
67
    
68
    public function setContextKey(?string $contextKey = null): void
69
    {
70
        $this->contextKey = $contextKey;
71
    }
72
    
73
    public function getField(): string
74
    {
75
        return $this->field;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->field could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
76
    }
77
    
78
    public function setField(?string $field = null): void
79
    {
80
        $this->field = $field;
81
    }
82
    
83
    public function getColumns(): ?array
84
    {
85
        return $this->columns;
86
    }
87
    
88
    public function setColumns(?array $columns = null): void
89
    {
90
        $this->columns = $columns;
91
    }
92
    
93
    public function getExpose(): bool
94
    {
95
        return $this->expose;
96
    }
97
    
98
    public function setExpose(bool $expose): void
99
    {
100
        $this->expose = $expose;
101
    }
102
    
103
    public function getProtected(): bool
104
    {
105
        return $this->protected;
106
    }
107
    
108
    public function setProtected(bool $protected): void
109
    {
110
        $this->protected = $protected;
111
    }
112
    
113
    public function getFullKey(): ?string
114
    {
115
        $key = $this->getKey();
116
        $keyContext = $this->getContextKey();
117
        return $keyContext . (empty($key) ? null : (empty($keyContext) ? $key : '.' . $key));
118
    }
119
}
120