1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-24 22:00:09 +00:00
Tims-Chat/file/lib/data/room/RoomCache.class.php
2013-05-24 02:27:55 +02:00

50 lines
1.0 KiB
PHP

<?php
namespace chat\data\room;
/**
* Manages the room cache.
*
* @author Tim Düsterhus
* @copyright 2010-2013 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package be.bastelstu.chat
* @subpackage data.room
*/
class RoomCache extends \wcf\system\SingletonFactory {
/**
* list of cached rooms
* @var array<\chat\data\room\Room>
*/
protected $rooms = array();
/**
* @see wcf\system\SingletonFactory::init()
*/
protected function init() {
$this->rooms = \chat\system\cache\builder\RoomCacheBuilder::getInstance()->getData();
}
/**
* Returns a specific room.
*
* @param integer $roomID
* @return \chat\data\room\Room
*/
public function getRoom($roomID) {
if (isset($this->rooms[$roomID])) {
return $this->rooms[$roomID];
}
return null;
}
/**
* Returns all rooms.
*
* @return array<\chat\data\room\Room>
*/
public function getRooms() {
return $this->rooms;
}
}