Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
Util | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
escapeSearchTitleList | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace GrowthExperiments\NewcomerTasks\TaskType; |
4 | |
5 | use MediaWiki\Linker\LinkTarget; |
6 | |
7 | class Util { |
8 | |
9 | /** |
10 | * Helper method for escaping CirrusSearch query strings. |
11 | * |
12 | * @param LinkTarget[] $titles |
13 | * @return string |
14 | */ |
15 | public static function escapeSearchTitleList( array $titles ): string { |
16 | return '"' . implode( '|', array_map( static function ( LinkTarget $title ) { |
17 | return str_replace( [ '"', '?' ], [ '\"', '\?' ], $title->getDBkey() ); |
18 | }, $titles ) ) . '"'; |
19 | } |
20 | } |