1 | <?php |
||
6 | class DBStaticRecord { |
||
7 | |||
8 | public static $_table = '_table'; |
||
9 | public static $_idField = 'id'; |
||
10 | |||
11 | /** |
||
12 | * @var db_mysql $dbStatic |
||
13 | */ |
||
14 | protected static $dbStatic; |
||
15 | |||
16 | /** |
||
17 | * DBStaticRecord constructor. |
||
18 | * |
||
19 | * @param db_mysql|null $db |
||
20 | */ |
||
21 | public static function _init($db = null) { |
||
24 | |||
25 | /** |
||
26 | * @return DbSqlStatement |
||
27 | */ |
||
28 | public static function buildSelect() { |
||
31 | |||
32 | /** |
||
33 | * @return DbSqlStatement |
||
34 | */ |
||
35 | public static function buildSelectAll() { |
||
38 | |||
39 | /** |
||
40 | * @return DbSqlStatement |
||
41 | */ |
||
42 | public static function buildSelectLock() { |
||
47 | |||
48 | /** |
||
49 | * @param array $where |
||
50 | * @param mixed|array $fieldList |
||
51 | * Field list can be scalar - it would be converted to array and used as field name |
||
52 | * @param bool $for_update |
||
53 | * |
||
54 | * @return array|null |
||
55 | * |
||
56 | * @see static::getRecordList |
||
57 | */ |
||
58 | protected static function getRecord($where = array(), $fieldList = '*', $for_update = false) { |
||
66 | |||
67 | /** |
||
68 | * Get maximum ID from table |
||
69 | * |
||
70 | * @return int |
||
71 | */ |
||
72 | public static function getMaxId() { |
||
77 | |||
78 | /** |
||
79 | * @param int|string $recordId |
||
80 | * @param mixed|array $fieldList |
||
81 | * @param bool $forUpdate |
||
82 | * |
||
83 | * @return array|null |
||
84 | */ |
||
85 | public static function getRecordById($recordId, $fieldList = '*', $forUpdate = false) { |
||
88 | |||
89 | /** |
||
90 | * @param DbSqlStatement $statement |
||
91 | * |
||
92 | * @return array|bool|mysqli_result|null |
||
93 | */ |
||
94 | protected static function execute($statement) { |
||
97 | |||
98 | /** |
||
99 | * @param DbSqlStatement $statement |
||
100 | * |
||
101 | * @return array|null |
||
102 | */ |
||
103 | protected static function fetchOne($statement) { |
||
106 | |||
107 | /** |
||
108 | * @param array $idList |
||
109 | * |
||
110 | * @return mysqli_result|null |
||
111 | */ |
||
112 | /** |
||
113 | * @param array $idList |
||
114 | * |
||
115 | * @return mysqli_result|null |
||
116 | */ |
||
117 | public static function queryExistsIdInList($idList) { |
||
129 | |||
130 | |||
131 | /** |
||
132 | * @param string $idList |
||
133 | * |
||
134 | * @return string |
||
135 | */ |
||
136 | public static function filterIdListStringRepack($idList) { |
||
151 | |||
152 | /** |
||
153 | * |
||
154 | */ |
||
155 | public static function lockAllRecords() { |
||
160 | |||
161 | /** |
||
162 | * Builds and Executes prepared statement |
||
163 | * |
||
164 | * @param string $sqlQuery |
||
165 | * @param array $values |
||
166 | * |
||
167 | * @return array|bool|mysqli_result|null |
||
168 | */ |
||
169 | protected static function prepareExecute($sqlQuery, $values = array()) { |
||
172 | |||
173 | /** |
||
174 | * Builds and executes prepared statement then return first record from sets |
||
175 | * |
||
176 | * @param string $sqlQuery |
||
177 | * @param array $values |
||
178 | * |
||
179 | * @return array|null |
||
180 | */ |
||
181 | protected static function prepareFetchOne($sqlQuery, $values = array()) { |
||
184 | |||
185 | /** |
||
186 | * Builds and executes prepared statement then fetches first record from sets and returns value from first field |
||
187 | * |
||
188 | * @param string $sqlQuery |
||
189 | * @param array $values |
||
190 | * |
||
191 | * @return mixed|null |
||
192 | */ |
||
193 | protected static function prepareFetchValue($sqlQuery, $values = array()) { |
||
203 | |||
204 | } |
||
205 | |||
207 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.