Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like DB often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use DB, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 13 | final class DB |
||
| 14 | { |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var int |
||
| 18 | */ |
||
| 19 | public $query_count = 0; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var \mysqli |
||
| 23 | */ |
||
| 24 | private $link = false; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @var bool |
||
| 28 | */ |
||
| 29 | private $connected = false; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @var array |
||
| 33 | */ |
||
| 34 | private $mysqlDefaultTimeFunctions; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @var string |
||
| 38 | */ |
||
| 39 | private $hostname = ''; |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @var string |
||
| 43 | */ |
||
| 44 | private $username = ''; |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @var string |
||
| 48 | */ |
||
| 49 | private $password = ''; |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @var string |
||
| 53 | */ |
||
| 54 | private $database = ''; |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @var int |
||
| 58 | */ |
||
| 59 | private $port = 3306; |
||
| 60 | |||
| 61 | /** |
||
| 62 | * @var string |
||
| 63 | */ |
||
| 64 | private $charset = 'utf8'; |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @var string |
||
| 68 | */ |
||
| 69 | private $socket = ''; |
||
| 70 | |||
| 71 | /** |
||
| 72 | * @var bool |
||
| 73 | */ |
||
| 74 | private $session_to_db = false; |
||
| 75 | |||
| 76 | /** |
||
| 77 | * @var bool |
||
| 78 | */ |
||
| 79 | private $_in_transaction = false; |
||
| 80 | |||
| 81 | /** |
||
| 82 | * @var bool |
||
| 83 | */ |
||
| 84 | private $_convert_null_to_empty_string = false; |
||
| 85 | |||
| 86 | /** |
||
| 87 | * @var Debug |
||
| 88 | */ |
||
| 89 | private $_debug; |
||
| 90 | |||
| 91 | /** |
||
| 92 | * __construct() |
||
| 93 | * |
||
| 94 | * @param string $hostname |
||
| 95 | * @param string $username |
||
| 96 | * @param string $password |
||
| 97 | * @param string $database |
||
| 98 | * @param int $port |
||
| 99 | * @param string $charset |
||
| 100 | * @param boolean|string $exit_on_error use a empty string "" or false to disable it |
||
| 101 | * @param boolean|string $echo_on_error use a empty string "" or false to disable it |
||
| 102 | * @param string $logger_class_name |
||
| 103 | * @param string $logger_level 'TRACE', 'DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL' |
||
| 104 | * @param boolean|string $session_to_db use a empty string "" or false to disable it |
||
| 105 | */ |
||
| 106 | 10 | protected function __construct($hostname, $username, $password, $database, $port, $charset, $exit_on_error, $echo_on_error, $logger_class_name, $logger_level, $session_to_db) |
|
| 157 | |||
| 158 | /** |
||
| 159 | * Load the config from the constructor. |
||
| 160 | * |
||
| 161 | * @param string $hostname |
||
| 162 | * @param string $username |
||
| 163 | * @param string $password |
||
| 164 | * @param string $database |
||
| 165 | * @param int $port |
||
| 166 | * @param string $charset |
||
| 167 | * @param boolean|string $exit_on_error use a empty string "" or false to disable it |
||
| 168 | * @param boolean|string $echo_on_error use a empty string "" or false to disable it |
||
| 169 | * @param string $logger_class_name |
||
| 170 | * @param string $logger_level |
||
| 171 | * @param boolean|string $session_to_db use a empty string "" or false to disable it |
||
| 172 | * |
||
| 173 | * @return bool |
||
| 174 | */ |
||
| 175 | 10 | private function _loadConfig($hostname, $username, $password, $database, $port, $charset, $exit_on_error, $echo_on_error, $logger_class_name, $logger_level, $session_to_db) |
|
| 218 | |||
| 219 | /** |
||
| 220 | * Show config errors by throw exceptions. |
||
| 221 | * |
||
| 222 | * @return bool |
||
| 223 | * |
||
| 224 | * @throws \Exception |
||
| 225 | */ |
||
| 226 | 10 | public function showConfigError() |
|
| 254 | |||
| 255 | /** |
||
| 256 | * Open a new connection to the MySQL server. |
||
| 257 | * |
||
| 258 | * @return boolean |
||
| 259 | */ |
||
| 260 | 9 | public function connect() |
|
| 297 | |||
| 298 | /** |
||
| 299 | * Check if db-connection is ready. |
||
| 300 | * |
||
| 301 | * @return boolean |
||
| 302 | */ |
||
| 303 | 45 | public function isReady() |
|
| 307 | |||
| 308 | /** |
||
| 309 | * Get a new "Prepare"-Object for your sql-query. |
||
| 310 | * |
||
| 311 | * @param string $query |
||
| 312 | * |
||
| 313 | * @return Prepare |
||
| 314 | */ |
||
| 315 | 2 | public function prepare($query) |
|
| 319 | |||
| 320 | /** |
||
| 321 | * Execute a sql-query and return the result-array for select-statements. |
||
| 322 | * |
||
| 323 | * @param $query |
||
| 324 | * |
||
| 325 | * @return mixed |
||
| 326 | * @deprecated |
||
| 327 | * @throws \Exception |
||
| 328 | */ |
||
| 329 | public static function qry($query) |
||
| 330 | { |
||
| 331 | $db = self::getInstance(); |
||
| 332 | |||
| 333 | $args = func_get_args(); |
||
| 334 | /** @noinspection SuspiciousAssignmentsInspection */ |
||
| 335 | $query = array_shift($args); |
||
| 336 | $query = str_replace('?', '%s', $query); |
||
| 337 | $args = array_map( |
||
| 338 | array( |
||
| 339 | $db, |
||
| 340 | 'escape', |
||
| 341 | ), |
||
| 342 | $args |
||
| 343 | ); |
||
| 344 | array_unshift($args, $query); |
||
| 345 | $query = call_user_func_array('sprintf', $args); |
||
| 346 | $result = $db->query($query); |
||
| 347 | |||
| 348 | if ($result instanceof Result) { |
||
| 349 | return $result->fetchAllArray(); |
||
| 350 | } |
||
| 351 | |||
| 352 | return $result; |
||
| 353 | } |
||
| 354 | |||
| 355 | /** |
||
| 356 | * getInstance() |
||
| 357 | * |
||
| 358 | * @param string $hostname |
||
| 359 | * @param string $username |
||
| 360 | * @param string $password |
||
| 361 | * @param string $database |
||
| 362 | * @param string $port default is (int)3306 |
||
| 363 | * @param string $charset default is 'utf8' or 'utf8mb4' (if supported) |
||
| 364 | * @param bool|string $exit_on_error use a empty string "" or false to disable it |
||
| 365 | * @param bool|string $echo_on_error use a empty string "" or false to disable it |
||
| 366 | * @param string $logger_class_name |
||
| 367 | * @param string $logger_level |
||
| 368 | * @param bool|string $session_to_db use a empty string "" or false to disable it |
||
| 369 | * |
||
| 370 | * @return \voku\db\DB |
||
| 371 | */ |
||
| 372 | 57 | public static function getInstance($hostname = '', $username = '', $password = '', $database = '', $port = '', $charset = '', $exit_on_error = '', $echo_on_error = '', $logger_class_name = '', $logger_level = '', $session_to_db = '') |
|
| 418 | |||
| 419 | /** |
||
| 420 | * Execute a sql-query. |
||
| 421 | * |
||
| 422 | * @param string $sql sql-query |
||
| 423 | * |
||
| 424 | * @param array|boolean $params "array" of sql-query-parameters |
||
| 425 | * "false" if you don't need any parameter (default) |
||
| 426 | * |
||
| 427 | * @return bool|int|Result "Result" by "<b>SELECT</b>"-queries<br /> |
||
| 428 | * "int" (insert_id) by "<b>INSERT / REPLACE</b>"-queries<br /> |
||
| 429 | * "int" (affected_rows) by "<b>UPDATE / DELETE</b>"-queries<br /> |
||
| 430 | * "true" by e.g. "DROP"-queries<br /> |
||
| 431 | * "false" on error |
||
| 432 | * |
||
| 433 | * @throws \Exception |
||
| 434 | */ |
||
| 435 | 35 | public function query($sql = '', $params = false) |
|
| 509 | |||
| 510 | /** |
||
| 511 | * _parseQueryParams |
||
| 512 | * |
||
| 513 | * @param string $sql |
||
| 514 | * @param array $params |
||
| 515 | * |
||
| 516 | * @return string |
||
| 517 | */ |
||
| 518 | 3 | private function _parseQueryParams($sql, array $params) |
|
| 539 | |||
| 540 | /** |
||
| 541 | * Try to secure a variable, so can you use it in sql-queries. |
||
| 542 | * |
||
| 543 | * <p> |
||
| 544 | * <strong>int:</strong> (also strings that contains only an int-value)<br /> |
||
| 545 | * 1. parse into "int" |
||
| 546 | * </p><br /> |
||
| 547 | * |
||
| 548 | * <p> |
||
| 549 | * <strong>float:</strong><br /> |
||
| 550 | * 1. return "float" |
||
| 551 | * </p><br /> |
||
| 552 | * |
||
| 553 | * <p> |
||
| 554 | * <strong>string:</strong><br /> |
||
| 555 | * 1. check if the string isn't a default mysql-time-function e.g. 'CURDATE()'<br /> |
||
| 556 | * 2. trim whitespace<br /> |
||
| 557 | * 3. trim '<br /> |
||
| 558 | * 4. escape the string (and remove non utf-8 chars)<br /> |
||
| 559 | * 5. trim ' again (because we maybe removed some chars)<br /> |
||
| 560 | * 6. add ' around the new string<br /> |
||
| 561 | * </p><br /> |
||
| 562 | * |
||
| 563 | * <p> |
||
| 564 | * <strong>array:</strong><br /> |
||
| 565 | * 1. return null |
||
| 566 | * </p><br /> |
||
| 567 | * |
||
| 568 | * <p> |
||
| 569 | * <strong>object:</strong><br /> |
||
| 570 | * 1. return false |
||
| 571 | * </p><br /> |
||
| 572 | * |
||
| 573 | * <p> |
||
| 574 | * <strong>null:</strong><br /> |
||
| 575 | * 1. return null |
||
| 576 | * </p> |
||
| 577 | * |
||
| 578 | * @param mixed $var |
||
| 579 | * |
||
| 580 | * @return mixed |
||
| 581 | */ |
||
| 582 | 26 | public function secure($var) |
|
| 608 | |||
| 609 | /** |
||
| 610 | * Escape: Use "mysqli_real_escape_string" and clean non UTF-8 chars + some extra optional stuff. |
||
| 611 | * |
||
| 612 | * @param mixed $var boolean: convert into "integer"<br /> |
||
| 613 | * int: int (don't change it)<br /> |
||
| 614 | * float: float (don't change it)<br /> |
||
| 615 | * null: null (don't change it)<br /> |
||
| 616 | * array: run escape() for every key => value<br /> |
||
| 617 | * string: run UTF8::cleanup() and mysqli_real_escape_string()<br /> |
||
| 618 | * @param bool $stripe_non_utf8 |
||
| 619 | * @param bool $html_entity_decode |
||
| 620 | * @param bool|null $convert_array <strong>false</strong> => Keep the array.<br /> |
||
| 621 | * <strong>true</strong> => Convert to string var1,var2,var3...<br /> |
||
| 622 | * <strong>null</strong> => Convert the array into null, every time. |
||
| 623 | * |
||
| 624 | * @return mixed |
||
| 625 | */ |
||
| 626 | 33 | public function escape($var = '', $stripe_non_utf8 = true, $html_entity_decode = false, $convert_array = false) |
|
| 740 | |||
| 741 | /** |
||
| 742 | * Get the mysqli-link (link identifier returned by mysqli-connect). |
||
| 743 | * |
||
| 744 | * @return \mysqli |
||
| 745 | */ |
||
| 746 | 35 | public function getLink() |
|
| 750 | |||
| 751 | /** |
||
| 752 | * Returns the auto generated id used in the last query. |
||
| 753 | * |
||
| 754 | * @return int|string |
||
| 755 | */ |
||
| 756 | 22 | public function insert_id() |
|
| 760 | |||
| 761 | /** |
||
| 762 | * Gets the number of affected rows in a previous MySQL operation. |
||
| 763 | * |
||
| 764 | * @return int |
||
| 765 | */ |
||
| 766 | 7 | public function affected_rows() |
|
| 770 | |||
| 771 | /** |
||
| 772 | * Error-handling for the sql-query. |
||
| 773 | * |
||
| 774 | * @param string $errorMsg |
||
| 775 | * @param string $sql |
||
| 776 | * @param array|bool $sqlParams false if there wasn't any parameter |
||
| 777 | * |
||
| 778 | * @throws \Exception |
||
| 779 | * |
||
| 780 | * @return bool |
||
| 781 | */ |
||
| 782 | 9 | View Code Duplication | protected function queryErrorHandling($errorMsg, $sql, $sqlParams = false) |
| 810 | |||
| 811 | /** |
||
| 812 | * Reconnect to the MySQL-Server. |
||
| 813 | * |
||
| 814 | * @param bool $checkViaPing |
||
| 815 | * |
||
| 816 | * @return bool |
||
| 817 | */ |
||
| 818 | 3 | public function reconnect($checkViaPing = false) |
|
| 833 | |||
| 834 | /** |
||
| 835 | * Pings a server connection, or tries to reconnect |
||
| 836 | * if the connection has gone down. |
||
| 837 | * |
||
| 838 | * @return boolean |
||
| 839 | */ |
||
| 840 | 3 | public function ping() |
|
| 853 | |||
| 854 | /** |
||
| 855 | * Execute select/insert/update/delete sql-queries. |
||
| 856 | * |
||
| 857 | * @param string $query sql-query |
||
| 858 | * @param bool $useCache use cache? |
||
| 859 | * @param int $cacheTTL cache-ttl in seconds |
||
| 860 | * |
||
| 861 | * @return mixed "array" by "<b>SELECT</b>"-queries<br /> |
||
| 862 | * "int" (insert_id) by "<b>INSERT</b>"-queries<br /> |
||
| 863 | * "int" (affected_rows) by "<b>UPDATE / DELETE</b>"-queries<br /> |
||
| 864 | * "true" by e.g. "DROP"-queries<br /> |
||
| 865 | * "false" on error |
||
| 866 | */ |
||
| 867 | 3 | public static function execSQL($query, $useCache = false, $cacheTTL = 3600) |
|
| 914 | |||
| 915 | /** |
||
| 916 | * Get the current charset. |
||
| 917 | * |
||
| 918 | * @return string |
||
| 919 | */ |
||
| 920 | 1 | public function get_charset() |
|
| 924 | |||
| 925 | /** |
||
| 926 | * Enables or disables internal report functions |
||
| 927 | * |
||
| 928 | * @link http://php.net/manual/en/function.mysqli-report.php |
||
| 929 | * |
||
| 930 | * @param int $flags <p> |
||
| 931 | * <table> |
||
| 932 | * Supported flags |
||
| 933 | * <tr valign="top"> |
||
| 934 | * <td>Name</td> |
||
| 935 | * <td>Description</td> |
||
| 936 | * </tr> |
||
| 937 | * <tr valign="top"> |
||
| 938 | * <td><b>MYSQLI_REPORT_OFF</b></td> |
||
| 939 | * <td>Turns reporting off</td> |
||
| 940 | * </tr> |
||
| 941 | * <tr valign="top"> |
||
| 942 | * <td><b>MYSQLI_REPORT_ERROR</b></td> |
||
| 943 | * <td>Report errors from mysqli function calls</td> |
||
| 944 | * </tr> |
||
| 945 | * <tr valign="top"> |
||
| 946 | * <td><b>MYSQLI_REPORT_STRICT</b></td> |
||
| 947 | * <td> |
||
| 948 | * Throw <b>mysqli_sql_exception</b> for errors |
||
| 949 | * instead of warnings |
||
| 950 | * </td> |
||
| 951 | * </tr> |
||
| 952 | * <tr valign="top"> |
||
| 953 | * <td><b>MYSQLI_REPORT_INDEX</b></td> |
||
| 954 | * <td>Report if no index or bad index was used in a query</td> |
||
| 955 | * </tr> |
||
| 956 | * <tr valign="top"> |
||
| 957 | * <td><b>MYSQLI_REPORT_ALL</b></td> |
||
| 958 | * <td>Set all options (report all)</td> |
||
| 959 | * </tr> |
||
| 960 | * </table> |
||
| 961 | * </p> |
||
| 962 | * |
||
| 963 | * @return bool |
||
| 964 | */ |
||
| 965 | public function set_mysqli_report($flags) |
||
| 969 | |||
| 970 | /** |
||
| 971 | * Set the current charset. |
||
| 972 | * |
||
| 973 | * @param string $charset |
||
| 974 | * |
||
| 975 | * @return bool |
||
| 976 | */ |
||
| 977 | 7 | public function set_charset($charset) |
|
| 997 | |||
| 998 | /** |
||
| 999 | * Set the option to convert null to "''" (empty string). |
||
| 1000 | * |
||
| 1001 | * Used in secure() => select(), insert(), update(), delete() |
||
| 1002 | * |
||
| 1003 | * @param $bool |
||
| 1004 | */ |
||
| 1005 | 1 | public function set_convert_null_to_empty_string($bool) |
|
| 1009 | |||
| 1010 | /** |
||
| 1011 | * Get all table-names via "SHOW TABLES". |
||
| 1012 | * |
||
| 1013 | * @return array |
||
| 1014 | */ |
||
| 1015 | 1 | public function getAllTables() |
|
| 1022 | |||
| 1023 | /** |
||
| 1024 | * Execute a sql-multi-query. |
||
| 1025 | * |
||
| 1026 | * @param string $sql |
||
| 1027 | * |
||
| 1028 | * @return false|Result[] "Result"-Array by "<b>SELECT</b>"-queries<br /> |
||
| 1029 | * "boolean" by only "<b>INSERT</b>"-queries<br /> |
||
| 1030 | * "boolean" by only (affected_rows) by "<b>UPDATE / DELETE</b>"-queries<br /> |
||
| 1031 | * "boolean" by only by e.g. "DROP"-queries<br /> |
||
| 1032 | * |
||
| 1033 | * @throws \Exception |
||
| 1034 | */ |
||
| 1035 | 1 | public function multi_query($sql) |
|
| 1097 | |||
| 1098 | /** |
||
| 1099 | * alias: "beginTransaction()" |
||
| 1100 | */ |
||
| 1101 | 1 | public function startTransaction() |
|
| 1105 | |||
| 1106 | /** |
||
| 1107 | * Begins a transaction, by turning off auto commit. |
||
| 1108 | * |
||
| 1109 | * @return boolean this will return true or false indicating success of transaction |
||
| 1110 | */ |
||
| 1111 | 4 | public function beginTransaction() |
|
| 1132 | |||
| 1133 | /** |
||
| 1134 | * Clear the errors in "_debug->_errors". |
||
| 1135 | * |
||
| 1136 | * @return bool |
||
| 1137 | */ |
||
| 1138 | 4 | public function clearErrors() |
|
| 1142 | |||
| 1143 | /** |
||
| 1144 | * Check if we are in a transaction. |
||
| 1145 | * |
||
| 1146 | * @return boolean |
||
| 1147 | */ |
||
| 1148 | 4 | public function inTransaction() |
|
| 1152 | |||
| 1153 | /** |
||
| 1154 | * Ends a transaction and commits if no errors, then ends autocommit. |
||
| 1155 | * |
||
| 1156 | * @return boolean this will return true or false indicating success of transactions |
||
| 1157 | */ |
||
| 1158 | 2 | public function endTransaction() |
|
| 1174 | |||
| 1175 | /** |
||
| 1176 | * Get all errors from "$this->_errors". |
||
| 1177 | * |
||
| 1178 | * @return array|false false === on errors |
||
| 1179 | */ |
||
| 1180 | 2 | public function errors() |
|
| 1186 | |||
| 1187 | /** |
||
| 1188 | * Rollback in a transaction. |
||
| 1189 | */ |
||
| 1190 | 2 | public function rollback() |
|
| 1203 | |||
| 1204 | /** |
||
| 1205 | * Execute a "insert"-query. |
||
| 1206 | * |
||
| 1207 | * @param string $table |
||
| 1208 | * @param array $data |
||
| 1209 | * @param string|null $databaseName <p>use <strong>null</strong> if you will use the current database</p> |
||
| 1210 | * |
||
| 1211 | * @return false|int false on error |
||
| 1212 | */ |
||
| 1213 | 21 | public function insert($table, array $data = array(), $databaseName = null) |
|
| 1240 | |||
| 1241 | /** |
||
| 1242 | * Parses arrays with value pairs and generates SQL to use in queries. |
||
| 1243 | * |
||
| 1244 | * @param array $arrayPair |
||
| 1245 | * @param string $glue this is the separator |
||
| 1246 | * |
||
| 1247 | * @return string |
||
| 1248 | * |
||
| 1249 | * @internal |
||
| 1250 | */ |
||
| 1251 | 23 | public function _parseArrayPair($arrayPair, $glue = ',') |
|
| 1397 | |||
| 1398 | /** |
||
| 1399 | * Quote && Escape e.g. a table name string. |
||
| 1400 | * |
||
| 1401 | * @param string $str |
||
| 1402 | * |
||
| 1403 | * @return string |
||
| 1404 | */ |
||
| 1405 | 26 | public function quote_string($str) |
|
| 1418 | |||
| 1419 | /** |
||
| 1420 | * Get errors from "$this->_errors". |
||
| 1421 | * |
||
| 1422 | * @return array |
||
| 1423 | */ |
||
| 1424 | 1 | public function getErrors() |
|
| 1428 | |||
| 1429 | /** |
||
| 1430 | * Execute a "replace"-query. |
||
| 1431 | * |
||
| 1432 | * @param string $table |
||
| 1433 | * @param array $data |
||
| 1434 | * @param null|string $databaseName <p>use <strong>null</strong> if you will use the current database</p> |
||
| 1435 | * |
||
| 1436 | * @return false|int false on error |
||
| 1437 | */ |
||
| 1438 | 1 | public function replace($table, array $data = array(), $databaseName = null) |
|
| 1479 | |||
| 1480 | /** |
||
| 1481 | * Execute a "update"-query. |
||
| 1482 | * |
||
| 1483 | * @param string $table |
||
| 1484 | * @param array $data |
||
| 1485 | * @param array|string $where |
||
| 1486 | * @param null|string $databaseName <p>use <strong>null</strong> if you will use the current database</p> |
||
| 1487 | * |
||
| 1488 | * @return false|int false on error |
||
| 1489 | */ |
||
| 1490 | 6 | public function update($table, array $data = array(), $where = '1=1', $databaseName = null) |
|
| 1525 | |||
| 1526 | /** |
||
| 1527 | * Execute a "delete"-query. |
||
| 1528 | * |
||
| 1529 | * @param string $table |
||
| 1530 | * @param string|array $where |
||
| 1531 | * @param string|null $databaseName <p>use <strong>null</strong> if you will use the current database</p> |
||
| 1532 | * |
||
| 1533 | * @return false|int false on error |
||
| 1534 | */ |
||
| 1535 | 1 | public function delete($table, $where, $databaseName = null) |
|
| 1562 | |||
| 1563 | /** |
||
| 1564 | * Execute a "select"-query. |
||
| 1565 | * |
||
| 1566 | * @param string $table |
||
| 1567 | * @param string|array $where |
||
| 1568 | * @param string|null $databaseName <p>use <strong>null</strong> if you will use the current database</p> |
||
| 1569 | * |
||
| 1570 | * @return false|Result false on error |
||
| 1571 | */ |
||
| 1572 | 20 | public function select($table, $where = '1=1', $databaseName = null) |
|
| 1599 | |||
| 1600 | /** |
||
| 1601 | * Get the last sql-error. |
||
| 1602 | * |
||
| 1603 | * @return string false on error |
||
| 1604 | */ |
||
| 1605 | 1 | public function lastError() |
|
| 1611 | |||
| 1612 | /** |
||
| 1613 | * @return Debug |
||
| 1614 | */ |
||
| 1615 | 9 | public function getDebugger() |
|
| 1619 | |||
| 1620 | /** |
||
| 1621 | * __destruct |
||
| 1622 | * |
||
| 1623 | */ |
||
| 1624 | public function __destruct() |
||
| 1631 | |||
| 1632 | /** |
||
| 1633 | * Closes a previously opened database connection. |
||
| 1634 | */ |
||
| 1635 | 2 | public function close() |
|
| 1643 | |||
| 1644 | /** |
||
| 1645 | * Prevent the instance from being cloned. |
||
| 1646 | * |
||
| 1647 | * @return void |
||
| 1648 | */ |
||
| 1649 | private function __clone() |
||
| 1652 | |||
| 1653 | /** |
||
| 1654 | * __wakeup |
||
| 1655 | * |
||
| 1656 | * @return void |
||
| 1657 | */ |
||
| 1658 | 2 | public function __wakeup() |
|
| 1662 | |||
| 1663 | } |
||
| 1664 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..