1 | <?php |
||
19 | class DataBaseQuery |
||
20 | { |
||
21 | protected $tableName; |
||
22 | protected $splitTableField; |
||
23 | protected $formatTableValues; |
||
24 | protected $dbConnection; |
||
25 | |||
26 | /** |
||
27 | * This method create or insert new users to the table. |
||
28 | * |
||
29 | * @param $associativeArray |
||
30 | * @param $tableName |
||
31 | * |
||
32 | * @return array |
||
|
|||
33 | */ |
||
34 | 72 | public function __construct($dbConn = null) |
|
42 | |||
43 | /** |
||
44 | * This method create or insert new users to the table. |
||
45 | * |
||
46 | * @param $associativeArray |
||
47 | * @param $tableName |
||
48 | * |
||
49 | * @return array |
||
50 | */ |
||
51 | 6 | public function create($associativeArrayToCreate, $tableName) |
|
75 | |||
76 | /** |
||
77 | * This method read the data in the table name of the id being passed to it. |
||
78 | * |
||
79 | * @param $id |
||
80 | * @param $tableName |
||
81 | * |
||
82 | * @return array |
||
83 | */ |
||
84 | 9 | public static function read($id, $tableName, $dbConn = null) |
|
102 | |||
103 | /** |
||
104 | * This method delete the table name of the id being passed to it. |
||
105 | * |
||
106 | * @param $update Params |
||
107 | * @param $associativeArrayToUpdate |
||
108 | * @param $tableName |
||
109 | * |
||
110 | * @return bool |
||
111 | */ |
||
112 | 6 | public function update($updateParams, $associativeArrayToUpdate, $tableName) |
|
138 | |||
139 | /** |
||
140 | * This method delete the table name of the id passed to it. |
||
141 | * |
||
142 | * @param $id |
||
143 | * @param $tableName |
||
144 | * |
||
145 | * @return bool |
||
146 | */ |
||
147 | 9 | public static function delete($id, $tableName, $dbConn = null) |
|
167 | |||
168 | /** |
||
169 | * This method returns a string form an array by making us of the implode function. |
||
170 | * |
||
171 | * @param $tableField |
||
172 | * |
||
173 | * @return string |
||
174 | */ |
||
175 | 12 | public function splitTableField($tableField) |
|
181 | |||
182 | /** |
||
183 | * This method returns a string formed fron an array, It format the array. |
||
184 | * |
||
185 | * @param $tableValues |
||
186 | * |
||
187 | * @return string |
||
188 | */ |
||
189 | 3 | public function formatTableValues($tableValues) |
|
201 | |||
202 | /** |
||
203 | * This method returns a string formed from an array. |
||
204 | * |
||
205 | * @param $array |
||
206 | * |
||
207 | * @return string |
||
208 | */ |
||
209 | 6 | public function updateArraySql($array) |
|
221 | |||
222 | /** |
||
223 | * This method returns column fields of a particular table. |
||
224 | * |
||
225 | * @param $table |
||
226 | * |
||
227 | * @return array |
||
228 | */ |
||
229 | 15 | public function getColumnNames($table) |
|
245 | } |
||
246 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.