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
19 lines
370 B
PHP
19 lines
370 B
PHP
<?php
|
|
|
|
/**
|
|
* Trivial implementation of MediaHandlerState.
|
|
*
|
|
* @since 1.37
|
|
*/
|
|
class TrivialMediaHandlerState implements MediaHandlerState {
|
|
/** @var array */
|
|
private $state = [];
|
|
|
|
public function getHandlerState( string $key ) {
|
|
return $this->state[$key] ?? null;
|
|
}
|
|
|
|
public function setHandlerState( string $key, $value ) {
|
|
$this->state[$key] = $value;
|
|
}
|
|
}
|