Some MediaHandler subclasses were setting custom properties on the File object in order to cache file-associated state. So: * Add File::getHandlerState() and File::setHandlerState(). * Put them in an interface, which will be used in a subsequent commit in MediaHandler::getSizeAndMetadata(). * Use them in DjvuHandler. * Provide a trivial implementation of the interface, for use in testing and in the subsequent commit. Change-Id: Ic365384ff13f7898c1203da38c4405abf03d7563
26 lines
537 B
PHP
26 lines
537 B
PHP
<?php
|
|
|
|
/**
|
|
* An interface to support process-local caching of handler data associated
|
|
* with a given file. Intended to replace the previous usage of custom
|
|
* properties on the File object.
|
|
*
|
|
* @since 1.37
|
|
*/
|
|
interface MediaHandlerState {
|
|
/**
|
|
* Get a value, or null if it does not exist.
|
|
*
|
|
* @param string $key
|
|
* @return mixed|null
|
|
*/
|
|
public function getHandlerState( string $key );
|
|
|
|
/**
|
|
* Set a value
|
|
*
|
|
* @param string $key
|
|
* @param mixed $value
|
|
*/
|
|
public function setHandlerState( string $key, $value );
|
|
}
|