Passed
Push — main ( ecdc1f...dbd268 )
by Thierry
01:34
created

Input   A

Complexity

Total Complexity 18

Size/Duplication

Total Lines 114
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 29
c 1
b 0
f 0
dl 0
loc 114
rs 10
wmc 18

10 Methods

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