Skip to content

Commit

Permalink
Added ping message
Browse files Browse the repository at this point in the history
  • Loading branch information
PeeHaa committed Jan 12, 2016
1 parent cd870ef commit 7f87f24
Show file tree
Hide file tree
Showing 2 changed files with 77 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 @@ -36,6 +36,9 @@ private function buildEventMessage(array $message): Message
case 6:
return new StarMessage($message);

case 8:
return new MentionMessage($message);

case 10:
return new DeleteMessage($message);

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

namespace Room11\Jeeves\Chat\Message;

class MentionMessage implements Message
{
private $id;

private $parentId;

private $actionId;

private $userId;

private $username;

private $roomId;

private $content;

private $timestamp;

public function __construct(array $data)
{
$this->id = $data['message_id'];
$this->parentId = $data['parent_id'];
$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 getId(): int
{
return $this->id;
}

public function getParentId(): int
{
return $this->parentId;
}

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 7f87f24

Please sign in to comment.