CirrusSearch
Elasticsearch-powered search for MediaWiki
Loading...
Searching...
No Matches
CirrusSearch\Profile\ArrayPathSetter Class Reference

Transforms arrays based on replacement variable using a syntax to lookup the entry to modify. More...

Public Member Functions

 __construct (array $replacements)
 
 transform (array $profile=null)
 Transform the profile.
 

Detailed Description

Transforms arrays based on replacement variable using a syntax to lookup the entry to modify.

Examples: [ 'elem1.elem2' => 'value' ] will replace the following profile [ 'elem1' => [ 'elem2' => 'placeholder' ]  ] with : [ 'elem1' => [ 'elem2' => 'value' ]  ]

The syntax supports lookaheads on next array value: [ 'elem1.*[type=bar].element' => [ 'custom' => 'data' ] ] will replace the following profile [ 'elem1' => [ [ 'type' => 'foo' 'element' => [] ], [ 'type' => 'bar' 'element' => [] ], ]  ] with : [ 'elem1' => [ [ 'type' => 'foo' 'element' => [] ], [ 'type' => 'bar' 'element' => [ 'custom' => 'data' ] ], ]  ]

A single substition can occur, the first match wins. The full path must always be matched.

Constructor & Destructor Documentation

◆ __construct()

CirrusSearch\Profile\ArrayPathSetter::__construct ( array $replacements)
Parameters
mixed[]$replacementsarray of replacements indexed with a string in the syntax supported by this class

Member Function Documentation

◆ transform()

CirrusSearch\Profile\ArrayPathSetter::transform ( array $profile = null)

Transform the profile.

Parameters
array | null$profile
Returns
array|null

The documentation for this class was generated from the following file: