All of core uses implode() consistently now.
Change-Id: Iba50898c64c43f356d1caf8869f484e90d9ff651
$repl2[] = preg_quote( substr( $prot, 0, -1 ), '/' );
}
}
- $repl2 = $repl2 ? '/\b(' . join( '|', $repl2 ) . '):/i' : '/^(?!)/';
+ $repl2 = $repl2 ? '/\b(' . implode( '|', $repl2 ) . '):/i' : '/^(?!)/';
}
$text = substr( strtr( "\n$text", $repl ), 1 );
$text = preg_replace( $repl2, '$1:', $text );
foreach ( SessionManager::singleton()->getVaryHeaders() as $header => $options ) {
$this->addVaryHeader( $header, $options );
}
- return 'Vary: ' . join( ', ', array_keys( $this->mVaryHeader ) );
+ return 'Vary: ' . implode( ', ', array_keys( $this->mVaryHeader ) );
}
/**
// make sure we are using the right one. To detect changes over the course
// of a request, we remember a fingerprint of the config used to create the
// codec singleton, and re-create it if the fingerprint doesn't match.
- $fingerprint = spl_object_hash( $wgContLang ) . '|' . join( '+', $wgLocalInterwikis );
+ $fingerprint = spl_object_hash( $wgContLang ) . '|' . implode( '+', $wgLocalInterwikis );
if ( $fingerprint !== $titleCodecFingerprint ) {
$titleCodec = null;
$qs = $k;
$msg = self::escapeWikiText( $v );
if ( is_array( $msg ) ) {
- $msg = join( ' ', $msg );
+ $msg = implode( ' ', $msg );
}
}
$parent = $module;
$manager = $parent->getModuleManager();
if ( $manager === null ) {
- $errorPath = join( '+', array_slice( $parts, 0, $i ) );
+ $errorPath = implode( '+', array_slice( $parts, 0, $i ) );
$this->dieUsage( "The module \"$errorPath\" has no submodules", 'badmodule' );
}
$module = $manager->getModule( $parts[$i] );
if ( $module === null ) {
- $errorPath = $i ? join( '+', array_slice( $parts, 0, $i ) ) : $parent->getModuleName();
+ $errorPath = $i ? implode( '+', array_slice( $parts, 0, $i ) ) : $parent->getModuleName();
$this->dieUsage(
"The module \"$errorPath\" does not have a submodule \"{$parts[$i]}\"",
'badmodule'
Hooks::run( 'APIGetDescription', [ &$this, &$desc ] );
$desc = self::escapeWikiText( $desc );
if ( is_array( $desc ) ) {
- $desc = join( "\n", $desc );
+ $desc = implode( "\n", $desc );
} else {
$desc = (string)$desc;
}
}
return $line;
}, $d );
- $d = join( ' ', $d );
+ $d = implode( ' ', $d );
}
if ( isset( $settings[ApiBase::PARAM_HELP_MSG] ) ) {
}
$paramName = $module->encodeParamName( $paramName );
if ( is_array( $paramValue ) ) {
- $paramValue = join( '|', $paramValue );
+ $paramValue = implode( '|', $paramValue );
}
$this->continuationData[$name][$paramName] = $paramValue;
}
$name = $module->getModuleName();
$paramName = $module->encodeParamName( $paramName );
if ( is_array( $paramValue ) ) {
- $paramValue = join( '|', $paramValue );
+ $paramValue = implode( '|', $paramValue );
}
$this->generatorContinuationData[$name][$paramName] = $paramValue;
}
$data += $kvp;
}
$data += $this->generatorParams;
- $generatorKeys = join( '|', array_keys( $this->generatorParams ) );
+ $generatorKeys = implode( '|', array_keys( $this->generatorParams ) );
} elseif ( $this->generatorContinuationData ) {
// All the generator-using modules are complete, but the
// generator isn't. Continue the generator and restart the
}
$data += $generatorParams;
$finishedModules = array_diff( $finishedModules, $this->generatedModules );
- $generatorKeys = join( '|', array_keys( $generatorParams ) );
+ $generatorKeys = implode( '|', array_keys( $generatorParams ) );
$batchcomplete = true;
} else {
// Generator and prop modules are all done. Mark it so.
// Set 'continue' if any continuation data is set or if the generator
// still needs to run
if ( $data || $generatorKeys !== '-' ) {
- $data['continue'] = $generatorKeys . '||' . join( '|', $finishedModules );
+ $data['continue'] = $generatorKeys . '||' . implode( '|', $finishedModules );
}
return [ $data, $batchcomplete ];
'level' => $level,
'anchor' => $anchor,
'line' => $header,
- 'number' => join( '.', $tocnumber ),
+ 'number' => implode( '.', $tocnumber ),
'index' => false,
];
if ( empty( $options['noheader'] ) ) {
->parse();
}
if ( $extra ) {
- $info[] = join( ' ', $extra );
+ $info[] = implode( ' ', $extra );
}
}
}
}
if ( $description ) {
- $description = join( '', $description );
+ $description = implode( '', $description );
$description = preg_replace( '!\s*</([oud]l)>\s*<\1>\s*!', "\n", $description );
$help['parameters'] .= Html::rawElement( 'dd',
[ 'class' => 'description' ], $description );
Hooks::run( 'APIHelpModifyOutput', [ $module, &$help, $suboptions, &$haveModules ] );
- $out .= join( "\n", $help );
+ $out .= implode( "\n", $help );
}
return $out;
// If a majority of slaves are too lagged then disallow writes
$slaveCount = wfGetLB()->getServerCount() - 1;
if ( $numLagged >= ceil( $slaveCount / 2 ) ) {
- $laggedServers = join( ', ', $laggedServers );
+ $laggedServers = implode( ', ', $laggedServers );
wfDebugLog(
'api-readonly',
"Api request failed as read only because the following DBs are lagged: $laggedServers"
$ret = $this->getRequest()->getVal( $name );
if ( $ret === null ) {
if ( $this->getRequest()->getArray( $name ) !== null ) {
- // See bug 10262 for why we don't just join( '|', ... ) the
+ // See bug 10262 for why we don't just implode( '|', ... ) the
// array.
$this->setWarning(
"Parameter '$name' uses unsupported PHP array syntax"
'level' => $level,
'anchor' => 'main/datatypes',
'line' => $header,
- 'number' => join( '.', $tocnumber ),
+ 'number' => implode( '.', $tocnumber ),
'index' => false,
];
}
'level' => $level,
'anchor' => 'main/credits',
'line' => $header,
- 'number' => join( '.', $tocnumber ),
+ 'number' => implode( '.', $tocnumber ),
'index' => false,
];
}
foreach ( $msgs as $m ) {
$ret[] = $m->setContext( $this->context )->text();
}
- $res[$key] = join( "\n\n", $ret );
+ $res[$key] = implode( "\n\n", $ret );
if ( $joinLists ) {
$res[$key] = preg_replace( '!^(([*#:;])[^\n]*)\n\n(?=\2)!m', "$1\n", $res[$key] );
}
foreach ( $msgs as $m ) {
$ret[] = $m->setContext( $this->context )->parseAsBlock();
}
- $ret = join( "\n", $ret );
+ $ret = implode( "\n", $ret );
if ( $joinLists ) {
$ret = preg_replace( '!\s*</([oud]l)>\s*<\1>\s*!', "\n", $ret );
}
if ( $matches ) {
$p = $this->getModulePrefix();
$this->dieUsage(
- "Cannot use {$p}prop=" . join( '|', array_keys( $matches ) ) . " with {$p}unique",
+ "Cannot use {$p}prop=" . implode( '|', array_keys( $matches ) ) . " with {$p}unique",
'params'
);
}
// Note we must keep the parameters for the first query constant
// This may be overridden at a later step
$title = $row->{$this->bl_title};
- $this->continueStr = join( '|', array_slice( $this->cont, 0, 2 ) ) .
+ $this->continueStr = implode( '|', array_slice( $this->cont, 0, 2 ) ) .
"|$ns|$title|{$row->from_ns}|{$row->page_id}";
break;
}
[ 'query', $this->getModuleName() ],
$idx, array_diff_key( $arr, [ 'redirlinks' => '' ] ) );
if ( !$fit ) {
- $this->continueStr = join( '|', array_slice( $this->cont, 0, 6 ) ) .
+ $this->continueStr = implode( '|', array_slice( $this->cont, 0, 6 ) ) .
"|$pageID";
break;
}
[ 'query', $this->getModuleName(), $idx, 'redirlinks' ],
null, $redir );
if ( !$fit ) {
- $this->continueStr = join( '|', array_slice( $this->cont, 0, 6 ) ) .
+ $this->continueStr = implode( '|', array_slice( $this->cont, 0, 6 ) ) .
"|$pageID|$key";
break;
}
foreach ( $sortby as $field => $v ) {
$cont[] = $row->$field;
}
- $this->setContinueEnumParameter( 'continue', join( '|', $cont ) );
+ $this->setContinueEnumParameter( 'continue', implode( '|', $cont ) );
}
public function getCacheMode( $params ) {
return [
'prop' => [
- ApiBase::PARAM_DFLT => join( '|', $props ),
+ ApiBase::PARAM_DFLT => implode( '|', $props ),
ApiBase::PARAM_ISMULTI => true,
ApiBase::PARAM_TYPE => $props,
],
if ( !$conflicts ) {
$arr[$name] += $value;
} else {
- $keys = join( ', ', array_keys( $conflicts ) );
+ $keys = implode( ', ', array_keys( $conflicts ) );
throw new RuntimeException(
"Conflicting keys ($keys) when attempting to merge element $name"
);
$tmp = [];
return $tmp;
default:
- $fail = join( '.', array_slice( $path, 0, $i + 1 ) );
+ $fail = implode( '.', array_slice( $path, 0, $i + 1 ) );
throw new InvalidArgumentException( "Path $fail does not exist" );
}
}
if ( !is_array( $ret[$k] ) ) {
- $fail = join( '.', array_slice( $path, 0, $i + 1 ) );
+ $fail = implode( '.', array_slice( $path, 0, $i + 1 ) );
throw new InvalidArgumentException( "Path $fail is not an array" );
}
$ret = &$ret[$k];
$msg = 'Filetype not permitted: ';
if ( isset( $verification['blacklistedExt'] ) ) {
- $msg .= join( ', ', $verification['blacklistedExt'] );
+ $msg .= implode( ', ', $verification['blacklistedExt'] );
$extradata['blacklisted'] = array_values( $verification['blacklistedExt'] );
ApiResult::setIndexedTagName( $extradata['blacklisted'], 'ext' );
} else {
);
}
return Html::rawElement( 'table', [ 'class' => 'mw-json' ],
- Html::rawElement( 'tbody', [], join( '', $rows ) )
+ Html::rawElement( 'tbody', [], implode( '', $rows ) )
);
}
);
}
return Html::rawElement( 'table', [ 'class' => 'mw-json' ],
- Html::rawElement( 'tbody', [], join( "\n", $rows ) )
+ Html::rawElement( 'tbody', [], implode( "\n", $rows ) )
);
}
$table = $this->tableName( $table );
// "INSERT INTO tables (a, b, c)"
- $sql = "INSERT INTO " . $table . " (" . join( ',', array_keys( $row ) ) . ')';
+ $sql = "INSERT INTO " . $table . " (" . implode( ',', array_keys( $row ) ) . ')';
$sql .= " VALUES (";
// for each value, append ":key"
* @since 1.23
*/
protected static function getIIProps() {
- return join( '|', self::$imageInfoProps );
+ return implode( '|', self::$imageInfoProps );
}
/**
$prev_title = $row->cur_title;
$prev_namespace = $row->cur_namespace;
}
- $sql = "DELETE FROM $cur WHERE cur_id IN ( " . join( ',', $deleteId ) . ')';
+ $sql = "DELETE FROM $cur WHERE cur_id IN ( " . implode( ',', $deleteId ) . ')';
$this->db->query( $sql, __METHOD__ );
$this->output( wfTimestamp( TS_DB ) );
$this->output( "......<b>Deleted</b> " . $this->db->affectedRows() . " records.\n" );
$anchor = $safeHeadline;
$legacyAnchor = $legacyHeadline;
if ( isset( $refers[$arrayKey] ) ) {
- // @codingStandardsIgnoreStart
+ // @codingStandardsIgnoreStart
for ( $i = 2; isset( $refers["${arrayKey}_$i"] ); ++$i );
// @codingStandardsIgnoreEnd
$anchor .= "_$i";
$refers[$arrayKey] = true;
}
if ( $legacyHeadline !== false && isset( $refers[$legacyArrayKey] ) ) {
- // @codingStandardsIgnoreStart
+ // @codingStandardsIgnoreStart
for ( $i = 2; isset( $refers["${legacyArrayKey}_$i"] ); ++$i );
// @codingStandardsIgnoreEnd
$legacyAnchor .= "_$i";
$sections[0] = $sections[0] . $toc . "\n";
}
- $full .= join( '', $sections );
+ $full .= implode( '', $sections );
if ( $this->mForceTocPosition ) {
return str_replace( '<!--MWTOC-->', $toc, $full );
}
}
- $searchon = $this->db->addQuotes( join( ',', $q ) );
+ $searchon = $this->db->addQuotes( implode( ',', $q ) );
$field = $this->getIndexField( $fulltext );
return "$field, $searchon";
}
if ( $missingKeys ) {
$this->logger->info( 'Session "{session}": Missing metadata: {missing}', [
'session' => $info,
- 'missing' => join( ', ', $missingKeys ),
+ 'missing' => implode( ', ', $missingKeys ),
] );
return false;
}
$new = true;
}
if ( is_array( $salt ) ) {
- $salt = join( '|', $salt );
+ $salt = implode( '|', $salt );
}
return new Token( $secret, (string)$salt, $new );
}
// Make sure there's exactly one
if ( count( $infos ) > 1 ) {
throw new \UnexpectedValueException(
- 'Multiple empty sessions tied for top priority: ' . join( ', ', $infos )
+ 'Multiple empty sessions tied for top priority: ' . implode( ', ', $infos )
);
} elseif ( count( $infos ) < 1 ) {
throw new \UnexpectedValueException( 'No provider could provide an empty session!' );
if ( count( $retInfos ) > 1 ) {
$ex = new \OverflowException(
- 'Multiple sessions for this request tied for top priority: ' . join( ', ', $retInfos )
+ 'Multiple sessions for this request tied for top priority: ' . implode( ', ', $retInfos )
);
$ex->sessionInfos = $retInfos;
throw $ex;
$invalidKeys = array_diff( $keys, $validKeys );
if ( $invalidKeys ) {
throw new InvalidArgumentException(
- 'Array contains invalid keys: ' . join( ', ', $invalidKeys )
+ 'Array contains invalid keys: ' . implode( ', ', $invalidKeys )
);
}
$missingKeys = array_diff( $neededKeys, $keys );
if ( $missingKeys ) {
throw new InvalidArgumentException(
- 'Array is missing required keys: ' . join( ', ', $missingKeys )
+ 'Array is missing required keys: ' . implode( ', ', $missingKeys )
);
}
if ( !preg_match( "/[a-zA-Z_]/us", $word ) ) {
switch ( $case ) {
case 'genitive': # родительный падеж
- if ( ( join( '', array_slice( $ar[0], -4 ) ) == 'вики' )
- || ( join( '', array_slice( $ar[0], -4 ) ) == 'Вики' )
+ if ( ( implode( '', array_slice( $ar[0], -4 ) ) == 'вики' )
+ || ( implode( '', array_slice( $ar[0], -4 ) ) == 'Вики' )
) {
- } elseif ( join( '', array_slice( $ar[0], -2 ) ) == 'ї' ) {
- $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'їѩ';
+ } elseif ( implode( '', array_slice( $ar[0], -2 ) ) == 'ї' ) {
+ $word = implode( '', array_slice( $ar[0], 0, -2 ) ) . 'їѩ';
}
break;
case 'accusative': # винительный падеж
if ( !preg_match( "/[a-zA-Z_]/us", $word ) ) {
switch ( $case ) {
case 'genitive': # սեռական հոլով
- if ( join( '', array_slice( $ar[0], -1 ) ) == 'ա' ) {
- $word = join( '', array_slice( $ar[0], 0, -1 ) ) . 'այի';
- } elseif ( join( '', array_slice( $ar[0], -1 ) ) == 'ո' ) {
- $word = join( '', array_slice( $ar[0], 0, -1 ) ) . 'ոյի';
- } elseif ( join( '', array_slice( $ar[0], -4 ) ) == 'գիրք' ) {
- $word = join( '', array_slice( $ar[0], 0, -4 ) ) . 'գրքի';
+ if ( implode( '', array_slice( $ar[0], -1 ) ) == 'ա' ) {
+ $word = implode( '', array_slice( $ar[0], 0, -1 ) ) . 'այի';
+ } elseif ( implode( '', array_slice( $ar[0], -1 ) ) == 'ո' ) {
+ $word = implode( '', array_slice( $ar[0], 0, -1 ) ) . 'ոյի';
+ } elseif ( implode( '', array_slice( $ar[0], -4 ) ) == 'գիրք' ) {
+ $word = implode( '', array_slice( $ar[0], 0, -4 ) ) . 'գրքի';
} else {
$word .= 'ի';
}
if ( !preg_match( "/[a-zA-Z_]/us", $word ) ) {
switch ( $case ) {
case 'genitive': # родовий відмінок
- if ( join( '', array_slice( $ar[0], -2 ) ) === 'ія' ) {
- $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'ії';
- } elseif ( join( '', array_slice( $ar[0], -2 ) ) === 'ти' ) {
- $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'т';
- } elseif ( join( '', array_slice( $ar[0], -2 ) ) === 'ди' ) {
- $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'дів';
- } elseif ( join( '', array_slice( $ar[0], -3 ) ) === 'ник' ) {
- $word = join( '', array_slice( $ar[0], 0, -3 ) ) . 'ника';
+ if ( implode( '', array_slice( $ar[0], -2 ) ) === 'ія' ) {
+ $word = implode( '', array_slice( $ar[0], 0, -2 ) ) . 'ії';
+ } elseif ( implode( '', array_slice( $ar[0], -2 ) ) === 'ти' ) {
+ $word = implode( '', array_slice( $ar[0], 0, -2 ) ) . 'т';
+ } elseif ( implode( '', array_slice( $ar[0], -2 ) ) === 'ди' ) {
+ $word = implode( '', array_slice( $ar[0], 0, -2 ) ) . 'дів';
+ } elseif ( implode( '', array_slice( $ar[0], -3 ) ) === 'ник' ) {
+ $word = implode( '', array_slice( $ar[0], 0, -3 ) ) . 'ника';
}
break;
case 'accusative': # знахідний відмінок
- if ( join( '', array_slice( $ar[0], -2 ) ) === 'ія' ) {
- $word = join( '', array_slice( $ar[0], 0, -2 ) ) . 'ію';
+ if ( implode( '', array_slice( $ar[0], -2 ) ) === 'ія' ) {
+ $word = implode( '', array_slice( $ar[0], 0, -2 ) ) . 'ію';
}
break;
}
$ret .= sprintf( "%s times: function %s(%s) :\n",
$res['count'],
$res['function'],
- join( ', ', $res['arguments'] )
+ implode( ', ', $res['arguments'] )
);
$ret .= sprintf( " %6.2fms (%6.2fms each)\n",
$res['delta'] * 1000,
$this->addOption( 'regex', 'regex to filter variables with', false, true );
$this->addOption( 'iregex', 'same as --regex but case insensitive', false, true );
$this->addOption( 'settings', 'Space-separated list of wg* variables', false, true );
- $this->addOption( 'format', join( ', ', self::$outFormats ), false, true );
+ $this->addOption( 'format', implode( ', ', self::$outFormats ), false, true );
}
protected function validateParamsAndArgs() {
$points[] = $point['x'] . ',' . $point['y'];
}
- return join( " ", $points );
+ return implode( " ", $points );
}
/**
$components[] = mt_rand( 0, 255 );
}
- return 'rgb(' . join( ', ', $components ) . ')';
+ return 'rgb(' . implode( ', ', $components ) . ')';
}
/**
}
/* Python code to extract a header and convert to PHP format:
- * print '"%s"' % ''.join( '\\x%02X' % ord(c) for c in urllib.urlopen(url).read(36) )
+ * print '"%s"' % ''.implode( '\\x%02X' % ord(c) for c in urllib.urlopen(url).read(36) )
*/
$gotWarnings = count( $warnings );
if ( $gotWarnings !== $expectWarnings ) {
$this->fail( "Expected $expectWarnings warning(s), but got $gotWarnings:\n" .
- join( "\n", $warnings )
+ implode( "\n", $warnings )
);
}
}
foreach ( $globals as $k => $v ) {
$g[] = "$k=" . var_export( $v, 1 );
}
- $k = "Module $path with " . join( ', ', $g );
+ $k = "Module $path with " . implode( ', ', $g );
$ret[$k] = [ $path, $globals ];
}
}
$langKey = $languageCode . '_' . $key;
$messages[$langKey] = $template;
$tests[] = [
- 'name' => $languageCode . ' ' . $key . ' ' . join( ',', $args ),
+ 'name' => $languageCode . ' ' . $key . ' ' . implode( ',', $args ),
'key' => $langKey,
'args' => $args,
'result' => $result,