<?php
require_once 'Chatroom.php';

class 
User
{
    private 
$_chatroom;
    private 
$_name;

    public function 
__construct($name)
    {
        
$this->_name $name;
    }

    public function 
getName()
    {
        return 
$this->_name;
    }

    public function 
setChatroom(Chatroom $value)
    {
        
$this->_chatroom $value;
    }

    public function 
getChatroom()
    {
        return 
$this->_chatroom;
    }

    public function 
sendMessage($to$message)
    {
        
$this->_chatroom->sendMessage($this->_name$to$message);
    }

    public function 
receiveMessage($from$message)
    {
        echo 
'<em>' $from '</em>さんから<em>' $this->getName() . '</em>さんへ : ' $message '<hr />';
    }
}