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 DatabaseMysqlBase 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 DatabaseMysqlBase, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 32 | abstract class DatabaseMysqlBase extends DatabaseBase { |
||
| 33 | /** @var MysqlMasterPos */ |
||
| 34 | protected $lastKnownReplicaPos; |
||
| 35 | /** @var string Method to detect replica DB lag */ |
||
| 36 | protected $lagDetectionMethod; |
||
| 37 | /** @var array Method to detect replica DB lag */ |
||
| 38 | protected $lagDetectionOptions = []; |
||
| 39 | /** @var bool bool Whether to use GTID methods */ |
||
| 40 | protected $useGTIDs = false; |
||
| 41 | /** @var string|null */ |
||
| 42 | protected $sslKeyPath; |
||
| 43 | /** @var string|null */ |
||
| 44 | protected $sslCertPath; |
||
| 45 | /** @var string|null */ |
||
| 46 | protected $sslCAPath; |
||
| 47 | /** @var string[]|null */ |
||
| 48 | protected $sslCiphers; |
||
| 49 | /** @var string sql_mode value to send on connection */ |
||
| 50 | protected $sqlMode; |
||
| 51 | /** @var bool Use experimental UTF-8 transmission encoding */ |
||
| 52 | protected $utf8Mode; |
||
| 53 | |||
| 54 | /** @var string|null */ |
||
| 55 | private $serverVersion = null; |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Additional $params include: |
||
| 59 | * - lagDetectionMethod : set to one of (Seconds_Behind_Master,pt-heartbeat). |
||
| 60 | * pt-heartbeat assumes the table is at heartbeat.heartbeat |
||
| 61 | * and uses UTC timestamps in the heartbeat.ts column. |
||
| 62 | * (https://www.percona.com/doc/percona-toolkit/2.2/pt-heartbeat.html) |
||
| 63 | * - lagDetectionOptions : if using pt-heartbeat, this can be set to an array map to change |
||
| 64 | * the default behavior. Normally, the heartbeat row with the server |
||
| 65 | * ID of this server's master will be used. Set the "conds" field to |
||
| 66 | * override the query conditions, e.g. ['shard' => 's1']. |
||
| 67 | * - useGTIDs : use GTID methods like MASTER_GTID_WAIT() when possible. |
||
| 68 | * - sslKeyPath : path to key file [default: null] |
||
| 69 | * - sslCertPath : path to certificate file [default: null] |
||
| 70 | * - sslCAPath : parth to certificate authority PEM files [default: null] |
||
| 71 | * - sslCiphers : array list of allowable ciphers [default: null] |
||
| 72 | * @param array $params |
||
| 73 | */ |
||
| 74 | function __construct( array $params ) { |
||
| 93 | |||
| 94 | /** |
||
| 95 | * @return string |
||
| 96 | */ |
||
| 97 | function getType() { |
||
| 100 | |||
| 101 | /** |
||
| 102 | * @param string $server |
||
| 103 | * @param string $user |
||
| 104 | * @param string $password |
||
| 105 | * @param string $dbName |
||
| 106 | * @throws Exception|DBConnectionError |
||
| 107 | * @return bool |
||
| 108 | */ |
||
| 109 | function open( $server, $user, $password, $dbName ) { |
||
| 204 | |||
| 205 | /** |
||
| 206 | * Set the character set information right after connection |
||
| 207 | * @return bool |
||
| 208 | */ |
||
| 209 | protected function connectInitCharset() { |
||
| 218 | |||
| 219 | /** |
||
| 220 | * Open a connection to a MySQL server |
||
| 221 | * |
||
| 222 | * @param string $realServer |
||
| 223 | * @return mixed Raw connection |
||
| 224 | * @throws DBConnectionError |
||
| 225 | */ |
||
| 226 | abstract protected function mysqlConnect( $realServer ); |
||
| 227 | |||
| 228 | /** |
||
| 229 | * Set the character set of the MySQL link |
||
| 230 | * |
||
| 231 | * @param string $charset |
||
| 232 | * @return bool |
||
| 233 | */ |
||
| 234 | abstract protected function mysqlSetCharset( $charset ); |
||
| 235 | |||
| 236 | /** |
||
| 237 | * @param ResultWrapper|resource $res |
||
| 238 | * @throws DBUnexpectedError |
||
| 239 | */ |
||
| 240 | View Code Duplication | function freeResult( $res ) { |
|
| 251 | |||
| 252 | /** |
||
| 253 | * Free result memory |
||
| 254 | * |
||
| 255 | * @param resource $res Raw result |
||
| 256 | * @return bool |
||
| 257 | */ |
||
| 258 | abstract protected function mysqlFreeResult( $res ); |
||
| 259 | |||
| 260 | /** |
||
| 261 | * @param ResultWrapper|resource $res |
||
| 262 | * @return stdClass|bool |
||
| 263 | * @throws DBUnexpectedError |
||
| 264 | */ |
||
| 265 | View Code Duplication | function fetchObject( $res ) { |
|
| 287 | |||
| 288 | /** |
||
| 289 | * Fetch a result row as an object |
||
| 290 | * |
||
| 291 | * @param resource $res Raw result |
||
| 292 | * @return stdClass |
||
| 293 | */ |
||
| 294 | abstract protected function mysqlFetchObject( $res ); |
||
| 295 | |||
| 296 | /** |
||
| 297 | * @param ResultWrapper|resource $res |
||
| 298 | * @return array|bool |
||
| 299 | * @throws DBUnexpectedError |
||
| 300 | */ |
||
| 301 | View Code Duplication | function fetchRow( $res ) { |
|
| 323 | |||
| 324 | /** |
||
| 325 | * Fetch a result row as an associative and numeric array |
||
| 326 | * |
||
| 327 | * @param resource $res Raw result |
||
| 328 | * @return array |
||
| 329 | */ |
||
| 330 | abstract protected function mysqlFetchArray( $res ); |
||
| 331 | |||
| 332 | /** |
||
| 333 | * @throws DBUnexpectedError |
||
| 334 | * @param ResultWrapper|resource $res |
||
| 335 | * @return int |
||
| 336 | */ |
||
| 337 | function numRows( $res ) { |
||
| 352 | |||
| 353 | /** |
||
| 354 | * Get number of rows in result |
||
| 355 | * |
||
| 356 | * @param resource $res Raw result |
||
| 357 | * @return int |
||
| 358 | */ |
||
| 359 | abstract protected function mysqlNumRows( $res ); |
||
| 360 | |||
| 361 | /** |
||
| 362 | * @param ResultWrapper|resource $res |
||
| 363 | * @return int |
||
| 364 | */ |
||
| 365 | function numFields( $res ) { |
||
| 372 | |||
| 373 | /** |
||
| 374 | * Get number of fields in result |
||
| 375 | * |
||
| 376 | * @param resource $res Raw result |
||
| 377 | * @return int |
||
| 378 | */ |
||
| 379 | abstract protected function mysqlNumFields( $res ); |
||
| 380 | |||
| 381 | /** |
||
| 382 | * @param ResultWrapper|resource $res |
||
| 383 | * @param int $n |
||
| 384 | * @return string |
||
| 385 | */ |
||
| 386 | function fieldName( $res, $n ) { |
||
| 393 | |||
| 394 | /** |
||
| 395 | * Get the name of the specified field in a result |
||
| 396 | * |
||
| 397 | * @param ResultWrapper|resource $res |
||
| 398 | * @param int $n |
||
| 399 | * @return string |
||
| 400 | */ |
||
| 401 | abstract protected function mysqlFieldName( $res, $n ); |
||
| 402 | |||
| 403 | /** |
||
| 404 | * mysql_field_type() wrapper |
||
| 405 | * @param ResultWrapper|resource $res |
||
| 406 | * @param int $n |
||
| 407 | * @return string |
||
| 408 | */ |
||
| 409 | public function fieldType( $res, $n ) { |
||
| 416 | |||
| 417 | /** |
||
| 418 | * Get the type of the specified field in a result |
||
| 419 | * |
||
| 420 | * @param ResultWrapper|resource $res |
||
| 421 | * @param int $n |
||
| 422 | * @return string |
||
| 423 | */ |
||
| 424 | abstract protected function mysqlFieldType( $res, $n ); |
||
| 425 | |||
| 426 | /** |
||
| 427 | * @param ResultWrapper|resource $res |
||
| 428 | * @param int $row |
||
| 429 | * @return bool |
||
| 430 | */ |
||
| 431 | function dataSeek( $res, $row ) { |
||
| 438 | |||
| 439 | /** |
||
| 440 | * Move internal result pointer |
||
| 441 | * |
||
| 442 | * @param ResultWrapper|resource $res |
||
| 443 | * @param int $row |
||
| 444 | * @return bool |
||
| 445 | */ |
||
| 446 | abstract protected function mysqlDataSeek( $res, $row ); |
||
| 447 | |||
| 448 | /** |
||
| 449 | * @return string |
||
| 450 | */ |
||
| 451 | function lastError() { |
||
| 469 | |||
| 470 | /** |
||
| 471 | * Returns the text of the error message from previous MySQL operation |
||
| 472 | * |
||
| 473 | * @param resource $conn Raw connection |
||
| 474 | * @return string |
||
| 475 | */ |
||
| 476 | abstract protected function mysqlError( $conn = null ); |
||
| 477 | |||
| 478 | /** |
||
| 479 | * @param string $table |
||
| 480 | * @param array $uniqueIndexes |
||
| 481 | * @param array $rows |
||
| 482 | * @param string $fname |
||
| 483 | * @return ResultWrapper |
||
| 484 | */ |
||
| 485 | function replace( $table, $uniqueIndexes, $rows, $fname = __METHOD__ ) { |
||
| 488 | |||
| 489 | /** |
||
| 490 | * Estimate rows in dataset |
||
| 491 | * Returns estimated count, based on EXPLAIN output |
||
| 492 | * Takes same arguments as Database::select() |
||
| 493 | * |
||
| 494 | * @param string|array $table |
||
| 495 | * @param string|array $vars |
||
| 496 | * @param string|array $conds |
||
| 497 | * @param string $fname |
||
| 498 | * @param string|array $options |
||
| 499 | * @return bool|int |
||
| 500 | */ |
||
| 501 | public function estimateRowCount( $table, $vars = '*', $conds = '', |
||
| 520 | |||
| 521 | function tableExists( $table, $fname = __METHOD__ ) { |
||
| 531 | |||
| 532 | /** |
||
| 533 | * @param string $table |
||
| 534 | * @param string $field |
||
| 535 | * @return bool|MySQLField |
||
| 536 | */ |
||
| 537 | function fieldInfo( $table, $field ) { |
||
| 553 | |||
| 554 | /** |
||
| 555 | * Get column information from a result |
||
| 556 | * |
||
| 557 | * @param resource $res Raw result |
||
| 558 | * @param int $n |
||
| 559 | * @return stdClass |
||
| 560 | */ |
||
| 561 | abstract protected function mysqlFetchField( $res, $n ); |
||
| 562 | |||
| 563 | /** |
||
| 564 | * Get information about an index into an object |
||
| 565 | * Returns false if the index does not exist |
||
| 566 | * |
||
| 567 | * @param string $table |
||
| 568 | * @param string $index |
||
| 569 | * @param string $fname |
||
| 570 | * @return bool|array|null False or null on failure |
||
| 571 | */ |
||
| 572 | function indexInfo( $table, $index, $fname = __METHOD__ ) { |
||
| 596 | |||
| 597 | /** |
||
| 598 | * @param string $s |
||
| 599 | * @return string |
||
| 600 | */ |
||
| 601 | function strencode( $s ) { |
||
| 604 | |||
| 605 | /** |
||
| 606 | * @param string $s |
||
| 607 | * @return mixed |
||
| 608 | */ |
||
| 609 | abstract protected function mysqlRealEscapeString( $s ); |
||
| 610 | |||
| 611 | /** |
||
| 612 | * MySQL uses `backticks` for identifier quoting instead of the sql standard "double quotes". |
||
| 613 | * |
||
| 614 | * @param string $s |
||
| 615 | * @return string |
||
| 616 | */ |
||
| 617 | public function addIdentifierQuotes( $s ) { |
||
| 622 | |||
| 623 | /** |
||
| 624 | * @param string $name |
||
| 625 | * @return bool |
||
| 626 | */ |
||
| 627 | public function isQuotedIdentifier( $name ) { |
||
| 630 | |||
| 631 | function getLag() { |
||
| 638 | |||
| 639 | /** |
||
| 640 | * @return string |
||
| 641 | */ |
||
| 642 | protected function getLagDetectionMethod() { |
||
| 645 | |||
| 646 | /** |
||
| 647 | * @return bool|int |
||
| 648 | */ |
||
| 649 | protected function getLagFromSlaveStatus() { |
||
| 658 | |||
| 659 | /** |
||
| 660 | * @return bool|float |
||
| 661 | */ |
||
| 662 | protected function getLagFromPtHeartbeat() { |
||
| 704 | |||
| 705 | protected function getMasterServerInfo() { |
||
| 742 | |||
| 743 | /** |
||
| 744 | * @param array $conds WHERE clause conditions to find a row |
||
| 745 | * @return array (heartbeat `ts` column value or null, UNIX timestamp) for the newest beat |
||
| 746 | * @see https://www.percona.com/doc/percona-toolkit/2.1/pt-heartbeat.html |
||
| 747 | */ |
||
| 748 | protected function getHeartbeatData( array $conds ) { |
||
| 760 | |||
| 761 | public function getApproximateLagStatus() { |
||
| 778 | |||
| 779 | function masterPosWait( DBMasterPos $pos, $timeout ) { |
||
| 826 | |||
| 827 | /** |
||
| 828 | * Get the position of the master from SHOW SLAVE STATUS |
||
| 829 | * |
||
| 830 | * @return MySQLMasterPos|bool |
||
| 831 | */ |
||
| 832 | function getReplicaPos() { |
||
| 833 | $res = $this->query( 'SHOW SLAVE STATUS', __METHOD__ ); |
||
| 834 | $row = $this->fetchObject( $res ); |
||
| 835 | |||
| 836 | if ( $row ) { |
||
| 837 | $pos = isset( $row->Exec_master_log_pos ) |
||
| 838 | ? $row->Exec_master_log_pos |
||
| 839 | : $row->Exec_Master_Log_Pos; |
||
| 840 | // Also fetch the last-applied GTID set (MariaDB) |
||
| 841 | View Code Duplication | if ( $this->useGTIDs ) { |
|
| 842 | $res = $this->query( "SHOW GLOBAL VARIABLES LIKE 'gtid_slave_pos'", __METHOD__ ); |
||
| 843 | $gtidRow = $this->fetchObject( $res ); |
||
| 844 | $gtidSet = $gtidRow ? $gtidRow->Value : ''; |
||
| 845 | } else { |
||
| 846 | $gtidSet = ''; |
||
| 847 | } |
||
| 848 | |||
| 849 | return new MySQLMasterPos( $row->Relay_Master_Log_File, $pos, $gtidSet ); |
||
| 850 | } else { |
||
| 851 | return false; |
||
| 852 | } |
||
| 853 | } |
||
| 854 | |||
| 855 | /** |
||
| 856 | * Get the position of the master from SHOW MASTER STATUS |
||
| 857 | * |
||
| 858 | * @return MySQLMasterPos|bool |
||
| 859 | */ |
||
| 860 | function getMasterPos() { |
||
| 879 | |||
| 880 | public function serverIsReadOnly() { |
||
| 886 | |||
| 887 | /** |
||
| 888 | * @param string $index |
||
| 889 | * @return string |
||
| 890 | */ |
||
| 891 | function useIndexClause( $index ) { |
||
| 894 | |||
| 895 | /** |
||
| 896 | * @param string $index |
||
| 897 | * @return string |
||
| 898 | */ |
||
| 899 | function ignoreIndexClause( $index ) { |
||
| 902 | |||
| 903 | /** |
||
| 904 | * @return string |
||
| 905 | */ |
||
| 906 | function lowPriorityOption() { |
||
| 909 | |||
| 910 | /** |
||
| 911 | * @return string |
||
| 912 | */ |
||
| 913 | public function getSoftwareLink() { |
||
| 927 | |||
| 928 | /** |
||
| 929 | * @return string |
||
| 930 | */ |
||
| 931 | public function getServerVersion() { |
||
| 940 | |||
| 941 | /** |
||
| 942 | * @param array $options |
||
| 943 | */ |
||
| 944 | public function setSessionOptions( array $options ) { |
||
| 951 | |||
| 952 | /** |
||
| 953 | * @param string $sql |
||
| 954 | * @param string $newLine |
||
| 955 | * @return bool |
||
| 956 | */ |
||
| 957 | public function streamStatementEnd( &$sql, &$newLine ) { |
||
| 966 | |||
| 967 | /** |
||
| 968 | * Check to see if a named lock is available. This is non-blocking. |
||
| 969 | * |
||
| 970 | * @param string $lockName Name of lock to poll |
||
| 971 | * @param string $method Name of method calling us |
||
| 972 | * @return bool |
||
| 973 | * @since 1.20 |
||
| 974 | */ |
||
| 975 | View Code Duplication | public function lockIsFree( $lockName, $method ) { |
|
| 982 | |||
| 983 | /** |
||
| 984 | * @param string $lockName |
||
| 985 | * @param string $method |
||
| 986 | * @param int $timeout |
||
| 987 | * @return bool |
||
| 988 | */ |
||
| 989 | View Code Duplication | public function lock( $lockName, $method, $timeout = 5 ) { |
|
| 1003 | |||
| 1004 | /** |
||
| 1005 | * FROM MYSQL DOCS: |
||
| 1006 | * http://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html#function_release-lock |
||
| 1007 | * @param string $lockName |
||
| 1008 | * @param string $method |
||
| 1009 | * @return bool |
||
| 1010 | */ |
||
| 1011 | View Code Duplication | public function unlock( $lockName, $method ) { |
|
| 1025 | |||
| 1026 | private function makeLockName( $lockName ) { |
||
| 1031 | |||
| 1032 | public function namedLocksEnqueue() { |
||
| 1035 | |||
| 1036 | /** |
||
| 1037 | * @param array $read |
||
| 1038 | * @param array $write |
||
| 1039 | * @param string $method |
||
| 1040 | * @param bool $lowPriority |
||
| 1041 | * @return bool |
||
| 1042 | */ |
||
| 1043 | public function lockTables( $read, $write, $method, $lowPriority = true ) { |
||
| 1060 | |||
| 1061 | /** |
||
| 1062 | * @param string $method |
||
| 1063 | * @return bool |
||
| 1064 | */ |
||
| 1065 | public function unlockTables( $method ) { |
||
| 1070 | |||
| 1071 | /** |
||
| 1072 | * @param bool $value |
||
| 1073 | */ |
||
| 1074 | public function setBigSelects( $value = true ) { |
||
| 1089 | |||
| 1090 | /** |
||
| 1091 | * DELETE where the condition is a join. MySql uses multi-table deletes. |
||
| 1092 | * @param string $delTable |
||
| 1093 | * @param string $joinTable |
||
| 1094 | * @param string $delVar |
||
| 1095 | * @param string $joinVar |
||
| 1096 | * @param array|string $conds |
||
| 1097 | * @param bool|string $fname |
||
| 1098 | * @throws DBUnexpectedError |
||
| 1099 | * @return bool|ResultWrapper |
||
| 1100 | */ |
||
| 1101 | View Code Duplication | function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds, $fname = __METHOD__ ) { |
|
| 1116 | |||
| 1117 | /** |
||
| 1118 | * @param string $table |
||
| 1119 | * @param array $rows |
||
| 1120 | * @param array $uniqueIndexes |
||
| 1121 | * @param array $set |
||
| 1122 | * @param string $fname |
||
| 1123 | * @return bool |
||
| 1124 | */ |
||
| 1125 | public function upsert( $table, array $rows, array $uniqueIndexes, |
||
| 1149 | |||
| 1150 | /** |
||
| 1151 | * Determines how long the server has been up |
||
| 1152 | * |
||
| 1153 | * @return int |
||
| 1154 | */ |
||
| 1155 | function getServerUptime() { |
||
| 1160 | |||
| 1161 | /** |
||
| 1162 | * Determines if the last failure was due to a deadlock |
||
| 1163 | * |
||
| 1164 | * @return bool |
||
| 1165 | */ |
||
| 1166 | function wasDeadlock() { |
||
| 1169 | |||
| 1170 | /** |
||
| 1171 | * Determines if the last failure was due to a lock timeout |
||
| 1172 | * |
||
| 1173 | * @return bool |
||
| 1174 | */ |
||
| 1175 | function wasLockTimeout() { |
||
| 1178 | |||
| 1179 | function wasErrorReissuable() { |
||
| 1182 | |||
| 1183 | /** |
||
| 1184 | * Determines if the last failure was due to the database being read-only. |
||
| 1185 | * |
||
| 1186 | * @return bool |
||
| 1187 | */ |
||
| 1188 | function wasReadOnlyError() { |
||
| 1192 | |||
| 1193 | function wasConnectionError( $errno ) { |
||
| 1196 | |||
| 1197 | /** |
||
| 1198 | * Get the underlying binding handle, mConn |
||
| 1199 | * |
||
| 1200 | * Makes sure that mConn is set (disconnects and ping() failure can unset it). |
||
| 1201 | * This catches broken callers than catch and ignore disconnection exceptions. |
||
| 1202 | * Unlike checking isOpen(), this is safe to call inside of open(). |
||
| 1203 | * |
||
| 1204 | * @return resource|object |
||
| 1205 | * @throws DBUnexpectedError |
||
| 1206 | * @since 1.26 |
||
| 1207 | */ |
||
| 1208 | protected function getBindingHandle() { |
||
| 1218 | |||
| 1219 | /** |
||
| 1220 | * @param string $oldName |
||
| 1221 | * @param string $newName |
||
| 1222 | * @param bool $temporary |
||
| 1223 | * @param string $fname |
||
| 1224 | * @return bool |
||
| 1225 | */ |
||
| 1226 | function duplicateTableStructure( $oldName, $newName, $temporary = false, $fname = __METHOD__ ) { |
||
| 1234 | |||
| 1235 | /** |
||
| 1236 | * List all tables on the database |
||
| 1237 | * |
||
| 1238 | * @param string $prefix Only show tables with this prefix, e.g. mw_ |
||
| 1239 | * @param string $fname Calling function name |
||
| 1240 | * @return array |
||
| 1241 | */ |
||
| 1242 | function listTables( $prefix = null, $fname = __METHOD__ ) { |
||
| 1258 | |||
| 1259 | /** |
||
| 1260 | * @param string $tableName |
||
| 1261 | * @param string $fName |
||
| 1262 | * @return bool|ResultWrapper |
||
| 1263 | */ |
||
| 1264 | View Code Duplication | public function dropTable( $tableName, $fName = __METHOD__ ) { |
|
| 1271 | |||
| 1272 | /** |
||
| 1273 | * Get status information from SHOW STATUS in an associative array |
||
| 1274 | * |
||
| 1275 | * @param string $which |
||
| 1276 | * @return array |
||
| 1277 | */ |
||
| 1278 | function getMysqlStatus( $which = "%" ) { |
||
| 1288 | |||
| 1289 | /** |
||
| 1290 | * Lists VIEWs in the database |
||
| 1291 | * |
||
| 1292 | * @param string $prefix Only show VIEWs with this prefix, eg. |
||
| 1293 | * unit_test_, or $wgDBprefix. Default: null, would return all views. |
||
| 1294 | * @param string $fname Name of calling function |
||
| 1295 | * @return array |
||
| 1296 | * @since 1.22 |
||
| 1297 | */ |
||
| 1298 | public function listViews( $prefix = null, $fname = __METHOD__ ) { |
||
| 1323 | |||
| 1324 | /** |
||
| 1325 | * Differentiates between a TABLE and a VIEW. |
||
| 1326 | * |
||
| 1327 | * @param string $name Name of the TABLE/VIEW to test |
||
| 1328 | * @param string $prefix |
||
| 1329 | * @return bool |
||
| 1330 | * @since 1.22 |
||
| 1331 | */ |
||
| 1332 | public function isView( $name, $prefix = null ) { |
||
| 1335 | } |
||
| 1336 | |||
| 1337 |
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
stringvalues, the empty string''is a special case, in particular the following results might be unexpected: