/** * @param unknown_type $iceObject * @param MurmurServer $server * @return MurmurTree */ public static function fromIceObject($iceObject, &$server) { // get current channel $channel = MurmurChannel::fromIceObject($iceObject->c, $server); // get child channels $children = array(); foreach ($iceObject->children as $child) { $children[] = self::fromIceObject($child, $server); } // get users in channel $users = array(); foreach ($iceObject->users as $user) { $users[] = MurmurUser::fromIceObject($user); } // return new instance of the tree return new self($channel, $children, $users); }
/** * @param int $serverId * @param MurmurUser $user * @return void */ public function saveServerUser($serverId, MurmurUser $user) { MurmurUser::fromIceObject($this->getServer($serverId)->setState($user->toIceObject())); }