*/
protected function addTables( $tables, $alias = null ) {
if ( is_array( $tables ) ) {
- if ( !is_null( $alias ) ) {
+ if ( $alias !== null ) {
ApiBase::dieDebug( __METHOD__, 'Multiple table aliases not supported' );
}
$this->tables = array_merge( $this->tables, $tables );
+ } elseif ( $alias !== null ) {
+ $this->tables[$alias] = $tables;
} else {
- if ( !is_null( $alias ) ) {
- $this->tables[$alias] = $tables;
- } else {
- $this->tables[] = $tables;
- }
+ $this->tables[] = $tables;
}
}
if ( count( $ids ) ) {
$ids = $this->filterIDs( [ [ $table, $field ] ], $ids );
- if ( !count( $ids ) ) {
+ if ( $ids === [] ) {
// Return nothing, no IDs are valid
$this->where[] = '0 = 1';
} else {
* @param string $prefix Module prefix
*/
public static function addTitleInfo( &$arr, $title, $prefix = '' ) {
- $arr[$prefix . 'ns'] = intval( $title->getNamespace() );
+ $arr[$prefix . 'ns'] = (int)$title->getNamespace();
$arr[$prefix . 'title'] = $title->getPrefixedText();
}
$result = $this->getResult();
ApiResult::setIndexedTagName( $data, $this->getModulePrefix() );
- return $result->addValue( [ 'query', 'pages', intval( $pageId ) ],
+ return $result->addValue( [ 'query', 'pages', (int)$pageId ],
$this->getModuleName(),
$data );
}