Skip to content

Commit

Permalink
Added room edit
Browse files Browse the repository at this point in the history
  • Loading branch information
PeeHaa committed Jan 12, 2016
1 parent e2782ee commit cd870ef
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Chat/Message/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ private function buildEventMessage(array $message): Message
case 4:
return new UserLeave($message);

case 5:
return new RoomEdit($message);

case 6:
return new StarMessage($message);

Expand Down
58 changes: 58 additions & 0 deletions src/Chat/Message/RoomEdit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php declare(strict_types=1);

namespace Room11\Jeeves\Chat\Message;

class RoomEdit implements Message
{
private $actionId;

private $userId;

private $username;

private $roomId;

private $content;

private $timestamp;

public function __construct(array $data)
{
$this->actionId = $data['id'];
$this->userId = $data['user_id'];
$this->username = $data['user_name'];
$this->roomId = $data['room_id'];
$this->content = $data['content'];
$this->timestamp = new \DateTime('@' . $data['time_stamp']);
}

public function getActionId(): int
{
return $this->actionId;
}

public function getUserId(): int
{
return $this->userId;
}

public function getUsername(): string
{
return $this->username;
}

public function getRoomId(): int
{
return $this->roomId;
}

public function getContent(): string
{
return $this->content;
}

public function getTimestamp(): \DateTime
{
return $this->timestamp;
}
}

0 comments on commit cd870ef

Please sign in to comment.