'license-name',
);
+ /**
+ * Things that are not 'attributes', but are not in
+ * $globalSettings or $creditsAttributes.
+ *
+ * @var array
+ */
+ protected static $notAttributes = array(
+ 'callback',
+ 'Hooks',
+ 'namespaces',
+ 'ResourceFileModulePaths',
+ 'ResourceModules',
+ 'ResourceModuleSkinStyles',
+ 'ExtensionMessagesFiles',
+ 'MessagesDirs',
+ 'type',
+ 'config',
+ 'ParserTestFiles',
+ 'AutoloadClasses',
+ );
+
/**
* Stuff that is going to be set to $GLOBALS
*
*/
protected $attributes = array();
- /**
- * List of keys that have already been processed
- *
- * @var array
- */
- protected $processed = array();
-
/**
* @param string $path
* @param array $info
$this->extractParserTestFiles( $dir, $info );
if ( isset( $info['callback'] ) ) {
$this->callbacks[] = $info['callback'];
- $this->processed[] = 'callback';
}
$this->extractCredits( $path, $info );
if ( in_array( $key, self::$globalSettings ) ) {
$this->storeToArray( "wg$key", $val, $this->globals );
// Ignore anything that starts with a @
- } elseif ( $key[0] !== '@' && !in_array( $key, $this->processed ) ) {
+ } elseif ( $key[0] !== '@' && !in_array( $key, self::$notAttributes )
+ && !in_array( $key, self::$creditsAttributes )
+ ) {
$this->storeToArray( $key, $val, $this->attributes );
}
}
-
}
public function getExtractedInfo() {
$this->globals['wgHooks'][$name][] = $callback;
}
}
- $this->processed[] = 'Hooks';
}
}
$this->globals['wgNamespaceContentModels'][$id] = $ns['defaultcontentmodel'];
}
}
- $this->processed[] = 'namespaces';
}
}
$this->globals["wgExtensionMessagesFiles"] += array_map( function( $file ) use ( $dir ) {
return "$dir/$file";
}, $info['ExtensionMessagesFiles'] );
- $this->processed[] = 'ExtensionMessagesFiles';
}
}
$this->globals["wgMessagesDirs"][$name][] = "$dir/$file";
}
}
- $this->processed[] = 'MessagesDirs';
}
}
'path' => $path,
'type' => isset( $info['type'] ) ? $info['type'] : 'other',
);
- $this->processed[] = 'type';
foreach ( self::$creditsAttributes as $attr ) {
if ( isset( $info[$attr] ) ) {
$credits[$attr] = $info[$attr];
- $this->processed[] = $attr;
}
}
$this->globals["wg$key"] = $val;
}
}
- $this->processed[] = 'config';
}
}
foreach ( $info['ParserTestFiles'] as $path ) {
$this->globals['wgParserTestFiles'][] = "$dir/$path";
}
- $this->processed[] = 'ParserTestFiles';
}
}
$processor->extractInfo( $this->dir, self::$default + array(
'@metadata' => array( 'foobarbaz' ),
'AnAttribute' => array( 'omg' ),
+ 'AutoloadClasses' => array( 'FooBar' => 'includes/FooBar.php' ),
) );
$extracted = $processor->getExtractedInfo();
$attributes = $extracted['attributes'];
$this->assertArrayHasKey( 'AnAttribute', $attributes );
$this->assertArrayNotHasKey( '@metadata', $attributes );
+ $this->assertArrayNotHasKey( 'AutoloadClasses', $attributes );
}
public static function provideRegisterHooks() {