mediawiki-extensions-Echo/includes/cache/TitleLocalCache.php
Siebrand Mazeland 33126b69aa Update formatting
In preparation of Code Sniffer based updates.

Change-Id: Id5d43332b44a37665d57dc24ef8c432bc65b2f6a
2015-10-03 23:28:54 -04:00

39 lines
684 B
PHP

<?php
/**
* Cache class that maps article id to Title object
*/
class EchoTitleLocalCache extends EchoLocalCache {
/**
* @var EchoTitleLocalCache
*/
private static $instance;
/**
* Create a TitleLocalCache object
* @return EchoTitleLocalCache
*/
public static function create() {
if ( !self::$instance ) {
self::$instance = new EchoTitleLocalCache();
}
return self::$instance;
}
/**
* {@inheritDoc}
*/
protected function resolve() {
if ( $this->lookups ) {
$titles = Title::newFromIDs( $this->lookups );
foreach ( $titles as $title ) {
$this->targets->set( $title->getArticleId(), $title );
}
$this->lookups = array();
}
}
}