Passed
Push — main ( dbd268...d05f8d )
by Thierry
01:41
created

Input::setValues()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Lagdo\DbAdmin\Driver;
4
5
class Input
6
{
7
    /**
8
     * @var string
9
     */
10
    public $table = '';
11
12
    /**
13
     * @var array
14
     */
15
    public $values = [];
16
17
    /**
18
     * Set the input values
19
     *
20
     * @param array $values
21
     */
22
    public function setValues(array $values)
23
    {
24
        $this->values = $values;
25
    }
26
27
    /**
28
     * @inheritDoc
29
     */
30
    public function getTable(): string
31
    {
32
        return $this->table;
33
    }
34
35
    /**
36
     * @inheritDoc
37
     */
38
    public function hasTable(): bool
39
    {
40
        return $this->table !== '';
41
    }
42
43
    /**
44
     * @inheritDoc
45
     */
46
    public function getSelect(): array
47
    {
48
        if (!isset($this->values['select'])) {
49
            return [];
50
        }
51
        return $this->values['select'];
52
    }
53
54
    /**
55
     * @inheritDoc
56
     */
57
    public function getWhere(): array
58
    {
59
        if (!isset($this->values['where'])) {
60
            return [];
61
        }
62
        return $this->values['where'];
63
    }
64
65
    /**
66
     * @inheritDoc
67
     */
68
    public function getLimit(): int
69
    {
70
        if (!isset($this->values['limit'])) {
71
            return 0;
72
        }
73
        return $this->values['limit'];
74
    }
75
76
    /**
77
     * @inheritDoc
78
     */
79
    public function getFields(): array
80
    {
81
        if (!isset($this->values['fields'])) {
82
            return [];
83
        }
84
        return $this->values['fields'];
85
    }
86
87
    /**
88
     * @inheritDoc
89
     */
90
    public function getAutoIncrementStep(): string
91
    {
92
        if (!isset($this->values['autoIncrementStep'])) {
93
            return '';
94
        }
95
        return $this->values['autoIncrementStep'];
96
    }
97
98
    /**
99
     * @inheritDoc
100
     */
101
    public function getAutoIncrementField(): string
102
    {
103
        if (!isset($this->values['autoIncrementCol'])) {
104
            return '0';
105
        }
106
        return $this->values['autoIncrementCol'];
107
    }
108
109
    /**
110
     * @inheritDoc
111
     */
112
    public function getChecks(): array
113
    {
114
        if (!isset($this->values['checks'])) {
115
            return [];
116
        }
117
        return $this->values['checks'];
118
    }
119
120
    /**
121
     * @inheritDoc
122
     */
123
    public function getOverwrite(): bool
124
    {
125
        if (!isset($this->values['overwrite'])) {
126
            return false;
127
        }
128
        return $this->values['overwrite'];
129
    }
130
}
131