1 | <?php |
||
7 | abstract class AbstractSQLDatabase extends AbstractDatabase |
||
8 | { |
||
9 | |||
10 | /** |
||
11 | * @param SqlStatementBuilder $statement |
||
12 | * @param array $options |
||
13 | * @param bool $returnResult |
||
14 | * @return array[]|null |
||
15 | */ |
||
16 | abstract protected function sendQueryToDatabase(SqlStatementBuilder $statement, array $options, $returnResult); |
||
17 | |||
18 | /** |
||
19 | * @return SqlStatementBuilder |
||
20 | */ |
||
21 | 18 | protected static function getSqlStatement() |
|
25 | |||
26 | /** |
||
27 | * @param string $table The table that will be accessed and written. |
||
28 | * @param array $fields A list of fields and values to be used when creating a new record. |
||
29 | * @param array $options The list of options that will help with creating the records. |
||
30 | * @return void |
||
31 | */ |
||
32 | 4 | public function create($table, array $fields, array $options = []) |
|
38 | |||
39 | /** |
||
40 | * @param string $table The table that will be accessed and written. |
||
41 | * @param array $fields A list of fields and values to be used when updating a record. |
||
42 | * @param Condition|null $criteria The criteria that will filter the data. |
||
43 | * @param array $options The list of options that will help with updating the records. |
||
44 | * @return void |
||
45 | */ |
||
46 | 2 | public function update($table, array $fields, Condition $criteria = null, array $options = []) |
|
52 | |||
53 | /** |
||
54 | * @param string $table The table that will be accessed and written. |
||
55 | * @param Condition|null $criteria The criteria that will filter the data. |
||
56 | * @param array $options The list of options that will help with deleting the records. |
||
57 | * @return void |
||
58 | */ |
||
59 | 2 | public function delete($table, Condition $criteria = null, array $options = []) |
|
65 | |||
66 | /** |
||
67 | * @param string $table The table that will be accessed and written. |
||
68 | * @param Condition|null $criteria The criteria that will filter the records. |
||
69 | * @param array $options The list of options that will help with finding the records. |
||
70 | * @return array[] Multiple records from the table that match the criteria. |
||
|
|||
71 | */ |
||
72 | 5 | public function findAll($table, Condition $criteria = null, array $options = []) |
|
94 | |||
95 | /** |
||
96 | * @param string $table The table that will be accessed and written. |
||
97 | * @param Condition|null $criteria The criteria that will filter the records. |
||
98 | * @param array $options The list of options that help with counting the records. |
||
99 | * @return int The number of records that match the criteria. |
||
100 | */ |
||
101 | 3 | public function count($table, Condition $criteria = null, array $options = []) |
|
106 | |||
107 | /** |
||
108 | * @param string $table The table that will be accessed and written. |
||
109 | * @param Condition|null $criteria The criteria that will filter the records. |
||
110 | * @param array $options The list of options that will help with finding the records. |
||
111 | * @return boolean A boolean value indicating if any record matches the criteria. |
||
112 | */ |
||
113 | 2 | public function has($table, Condition $criteria = null, array $options = []) |
|
118 | |||
119 | /** |
||
120 | * @param string $columns |
||
121 | * @param string $table |
||
122 | * @param Condition|null $criteria |
||
123 | * @param array $options |
||
124 | * @return array |
||
125 | */ |
||
126 | 5 | private function selectOnlyOneValue($columns, $table, Condition $criteria = null, array $options = []) |
|
132 | |||
133 | /** |
||
134 | * Logs the given exception, and returns it. |
||
135 | * |
||
136 | * @param Exception $error The exception to log and return. |
||
137 | * @return Exception The exception that was passed in as an argument. |
||
138 | */ |
||
139 | 2 | protected function logException(Exception $error) |
|
144 | |||
145 | /** |
||
146 | * @param SqlStatementBuilder $statement |
||
147 | * @param array $options |
||
148 | * @return array<string|array> An array that contains the query and the bindings. |
||
149 | */ |
||
150 | 18 | protected static function compileQueriesAndBindings(SqlStatementBuilder $statement, array $options) |
|
176 | } |
||
177 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.