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 | * Batch SET |
||
78 | * |
||
79 | * @param array $data |
||
80 | * @return $this |
||
81 | * @access protected |
||
82 | */ |
||
83 | protected function setWithArrayData(array $data) |
||
97 | |||
98 | /** |
||
99 | * Build SET |
||
100 | * |
||
101 | * @param string $prefix |
||
102 | * @param array $settings |
||
103 | * @return string |
||
104 | * @access protected |
||
105 | */ |
||
106 | protected function buildSet( |
||
116 | |||
117 | /** |
||
118 | * Build SET for INSERT |
||
119 | * |
||
120 | * @param string $prefix |
||
121 | * @param array $settings |
||
122 | * @return string |
||
123 | * @access protected |
||
124 | */ |
||
125 | protected function buildInsertSet( |
||
139 | |||
140 | /** |
||
141 | * Build SET ... = ..., ... = ... |
||
142 | * |
||
143 | * |
||
144 | * @param string $prefix |
||
145 | * @param array $settings |
||
146 | * @return string |
||
147 | * @access protected |
||
148 | */ |
||
149 | protected function buildUpdateSet( |
||
160 | |||
161 | /** |
||
162 | * Build VALUES ( ... ) |
||
163 | * |
||
164 | * @param string $prefix |
||
165 | * @param array $settings |
||
166 | * @return string |
||
167 | * @access protected |
||
168 | */ |
||
169 | protected function buildValues( |
||
186 | |||
187 | /** |
||
188 | * Get NULL or DEFAULT for values base on the settings |
||
189 | * |
||
190 | * @param array $settings |
||
191 | * @return string |
||
192 | * @access protected |
||
193 | */ |
||
194 | protected function nullOrDefault(array $settings)/*# : string */ |
||
198 | |||
199 | abstract protected function getType()/*# : string */; |
||
209 | } |
||
210 |
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.