Page MenuHomeWickedGov Phorge

NumericalParameterInsertablesSuggester.php
No OneTemporary

Size
728 B
Referenced Files
None
Subscribers
None

NumericalParameterInsertablesSuggester.php

<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Translate\TranslatorInterface\Insertable;
/**
* Insertables suggester for numerical parameters such as $1, $2, $3
* @author Geoffrey Mon
* @license GPL-2.0-or-later
* @since 2020.12
*/
class NumericalParameterInsertablesSuggester implements InsertablesSuggester {
public function getInsertables( string $text ): array {
$insertables = [];
// $1, $2, $3 etc.
$matches = [];
preg_match_all(
'/\$\d+/',
$text,
$matches,
PREG_SET_ORDER
);
$new = array_map( static function ( $match ) {
return new Insertable( $match[0], $match[0] );
}, $matches );
$insertables = array_merge( $insertables, $new );
return $insertables;
}
}

File Metadata

Mime Type
text/x-php
Expires
Tue, Aug 18, 20:37 (2 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
2e/ac/7f3681625b5c2859d9713a4379a1
Default Alt Text
NumericalParameterInsertablesSuggester.php (728 B)

Event Timeline