const MAX_ERR_LOG_SIZE = 65535;
/** @var MediaHandler[] Instance cache with array of MediaHandler */
- protected static $handlers = array();
+ protected static $handlers = [];
/**
* Get a MediaHandler for a given MIME type from the instance cache
* Resets all static caches
*/
public static function resetCache() {
- self::$handlers = array();
+ self::$handlers = [];
}
/**
* Get an associative array mapping magic word IDs to parameter names.
* Will be used by the parser to identify parameters.
*/
- abstract function getParamMap();
+ abstract public function getParamMap();
/**
* Validate a thumbnail parameter at parse time.
* @param string $name
* @param mixed $value
*/
- abstract function validateParam( $name, $value );
+ abstract public function validateParam( $name, $value );
/**
* Merge a parameter array into a string appropriate for inclusion in filenames
* @param array $params Array of parameters that have been through normaliseParams.
* @return string
*/
- abstract function makeParamString( $params );
+ abstract public function makeParamString( $params );
/**
* Parse a param string made with makeParamString back into an array
* @param string $str The parameter string without file name (e.g. 122px)
* @return array|bool Array of parameters or false on failure.
*/
- abstract function parseParamString( $str );
+ abstract public function parseParamString( $str );
/**
* Changes the parameter array as necessary, ready for transformation.
* @return string Version string
*/
static function getMetadataVersion() {
- $version = array( '2' ); // core metadata version
- Hooks::run( 'GetMetadataVersion', array( &$version ) );
+ $version = [ '2' ]; // core metadata version
+ Hooks::run( 'GetMetadataVersion', [ &$version ] );
return implode( ';', $version );
}
// recognize the MIME type
$extensions = $magic->getExtensionsForType( $mime );
if ( $extensions ) {
- return array( strtok( $extensions, ' ' ), $mime );
+ return [ strtok( $extensions, ' ' ), $mime ];
}
}
// The extension is correct (true) or the MIME type is unknown to
// MediaWiki (null)
- return array( $ext, $mime );
+ return [ $ext, $mime ];
}
/**
* @return array
*/
public function getStreamHeaders( $metadata ) {
- return array();
+ return [];
}
/**
* @param File $file
* @return bool
*/
- function canRender( $file ) {
+ public function canRender( $file ) {
return true;
}
* @param File $file
* @return bool
*/
- function mustRender( $file ) {
+ public function mustRender( $file ) {
return false;
}
* @param File $file
* @return bool
*/
- function isMultiPage( $file ) {
+ public function isMultiPage( $file ) {
return false;
}
function getPageDimensions( File $image, $page ) {
$gis = $this->getImageSize( $image, $image->getLocalRefPath() );
if ( $gis ) {
- return array(
+ return [
'width' => $gis[0],
'height' => $gis[1]
- );
+ ];
} else {
return false;
}
* @return array Array for use displaying metadata.
*/
function formatMetadataHelper( $metadataArray, $context = false ) {
- $result = array(
- 'visible' => array(),
- 'collapsed' => array()
- );
+ $result = [
+ 'visible' => [],
+ 'collapsed' => []
+ ];
$formatted = FormatMetadata::getFormattedData( $metadataArray, $context );
// Sort fields into visible and collapsed
wfDebug( __METHOD__ . ' Unknown metadata name: ' . $id . "\n" );
$name = wfEscapeWikiText( $id );
}
- $array[$visibility][] = array(
+ $array[$visibility][] = [
'id' => "$type-$id",
'name' => $name,
'value' => $value
- );
+ ];
}
/**
* @since 1.23
*/
public function getAvailableLanguages( File $file ) {
- return array();
+ return [];
}
/**