7 function __construct( $conf ) {
8 if ( !isset( $conf['parsers'] ) ) {
9 throw new MWException( __METHOD__
. ': no parsers specified' );
15 if ( !is_null( $this->parsers
) ) {
18 foreach ( $this->conf
['parsers'] as $i => $parserConf ) {
19 if ( !is_array( $parserConf ) ) {
21 $parserconf = array( 'class' => $parserConf );
23 $class = $parserConf['class'];
25 $this->parsers
[$i] = new $class( $parserConf );
29 function __call( $name, $args ) {
35 foreach ( $this->parsers
as $i => $parser ) {
36 $currentResult = call_user_func_array( array( &$this->parsers
[$i], $name ), $args );
40 if ( $lastResult !== $currentResult ) {
44 $results[$i] = $currentResult;
45 $lastResult = $currentResult;
48 throw new MWException( "Parser_DiffTest: results mismatch on call to $name\n" .
49 'Arguments: ' . var_export( $args, true ) . "\n" .
50 'Results: ' . var_export( $results, true ) . "\n" );
55 function setFunctionHook( $id, $callback, $flags = 0 ) {
57 foreach ( $this->parsers
as $i => $parser ) {
58 $parser->setFunctionHook( $id, $callback, $flags );