| Conditions | 4 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | public function create( $type = null ) { |
||
| 24 | $dbr = null; |
||
| 25 | |||
| 26 | $configType = $this->config->getSearchType(); |
||
| 27 | $alternatives = $this->config->getSearchTypes(); |
||
| 28 | |||
| 29 | if ( $type && in_array( $type, $alternatives ) ) { |
||
|
|
|||
| 30 | $class = $type; |
||
| 31 | } elseif ( $configType !== null ) { |
||
| 32 | $class = $configType; |
||
| 33 | } else { |
||
| 34 | $dbr = wfGetDB( DB_REPLICA ); |
||
| 35 | $class = self::getSearchEngineClass( $dbr ); |
||
| 36 | } |
||
| 37 | |||
| 38 | $search = new $class( $dbr ); |
||
| 39 | return $search; |
||
| 40 | } |
||
| 41 | |||
| 64 |
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: