1 | <?php |
||
31 | trait SetTrait |
||
32 | { |
||
33 | /** |
||
34 | * data storage |
||
35 | * |
||
36 | * @var array |
||
37 | * @access protected |
||
38 | */ |
||
39 | protected $set_data = []; |
||
40 | |||
41 | /** |
||
42 | * data row number |
||
43 | * |
||
44 | * @var int |
||
45 | * @access protected |
||
46 | */ |
||
47 | protected $set_row = 0; |
||
48 | |||
49 | /** |
||
50 | * storage for col names |
||
51 | * |
||
52 | * @var array |
||
53 | * @access protected |
||
54 | */ |
||
55 | protected $set_col = []; |
||
56 | |||
57 | /** |
||
58 | * {@inheritDoc} |
||
59 | */ |
||
60 | public function set($col, $value = ClauseInterface::NO_VALUE) |
||
75 | |||
76 | /** |
||
77 | * {@inheritDoc} |
||
78 | */ |
||
79 | public function setRaw($col, $value = ClauseInterface::NO_VALUE) |
||
91 | |||
92 | /** |
||
93 | * Batch SET |
||
94 | * |
||
95 | * @param array $data |
||
96 | * @return $this |
||
97 | * @access protected |
||
98 | */ |
||
99 | protected function setWithArrayData(array $data) |
||
113 | |||
114 | /** |
||
115 | * Build SET |
||
116 | * |
||
117 | * @param string $prefix |
||
118 | * @param array $settings |
||
119 | * @return string |
||
120 | * @access protected |
||
121 | */ |
||
122 | protected function buildSet( |
||
132 | |||
133 | /** |
||
134 | * Build SET for INSERT |
||
135 | * |
||
136 | * @param string $prefix |
||
137 | * @param array $settings |
||
138 | * @return string |
||
139 | * @access protected |
||
140 | */ |
||
141 | protected function buildInsertSet( |
||
155 | |||
156 | /** |
||
157 | * Build SET ... = ..., ... = ... |
||
158 | * |
||
159 | * |
||
160 | * @param string $prefix |
||
161 | * @param array $settings |
||
162 | * @return string |
||
163 | * @access protected |
||
164 | */ |
||
165 | protected function buildUpdateSet( |
||
176 | |||
177 | /** |
||
178 | * Build VALUES ( ... ) |
||
179 | * |
||
180 | * @param string $prefix |
||
181 | * @param array $settings |
||
182 | * @return string |
||
183 | * @access protected |
||
184 | */ |
||
185 | protected function buildValues( |
||
202 | |||
203 | /** |
||
204 | * Get NULL or DEFAULT for values base on the settings |
||
205 | * |
||
206 | * @param array $settings |
||
207 | * @return string |
||
208 | * @access protected |
||
209 | */ |
||
210 | protected function nullOrDefault(array $settings)/*# : string */ |
||
214 | |||
215 | abstract public function setSettings(array $settings); |
||
226 | } |
||
227 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.