Change-Id: I63ff4f52d8459ab19dd774ef1dee8435f1eb5cae
* @ingroup Parser
*/
class MagicWordArray {
* @ingroup Parser
*/
class MagicWordArray {
public $names = [];
/** @var MagicWordFactory */
public $names = [];
/** @var MagicWordFactory */
+ * @param string[] $names
* @param MagicWordFactory|null $factory
*/
public function __construct( $names = [], MagicWordFactory $factory = null ) {
* @param MagicWordFactory|null $factory
*/
public function __construct( $names = [], MagicWordFactory $factory = null ) {
/**
* Add a number of magic words by name
*
/**
* Add a number of magic words by name
*
+ * @param string[] $names
*/
public function addArray( $names ) {
$this->names = array_merge( $this->names, array_values( $names ) );
*/
public function addArray( $names ) {
$this->names = array_merge( $this->names, array_values( $names ) );
*/
public function getBaseRegex() {
if ( is_null( $this->baseRegex ) ) {
*/
public function getBaseRegex() {
if ( is_null( $this->baseRegex ) ) {
/**
* Get an unanchored regex that does not match parameters
/**
* Get an unanchored regex that does not match parameters
*/
public function getRegex() {
if ( is_null( $this->regex ) ) {
*/
public function getRegex() {
if ( is_null( $this->regex ) ) {
/**
* Get a regex for matching variables with parameters
*
/**
* Get a regex for matching variables with parameters
*
*/
public function getVariableRegex() {
return str_replace( "\\$1", "(.*?)", $this->getRegex() );
*/
public function getVariableRegex() {
return str_replace( "\\$1", "(.*?)", $this->getRegex() );
/**
* Get a regex anchored to the start of the string that does not match parameters
*
/**
* Get a regex anchored to the start of the string that does not match parameters
*
*/
public function getRegexStart() {
$base = $this->getBaseRegex();
*/
public function getRegexStart() {
$base = $this->getBaseRegex();
/**
* Get an anchored regex for matching variables with parameters
*
/**
* Get an anchored regex for matching variables with parameters
*
*/
public function getVariableStartToEndRegex() {
$base = $this->getBaseRegex();
*/
public function getVariableStartToEndRegex() {
$base = $this->getBaseRegex();
*/
public function getNames() {
return $this->names;
*/
public function getNames() {
return $this->names;