-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #141 from ker0x/feature/ice-breakers-reaction
[n/a] add IceBreakers and Reaction
- Loading branch information
Showing
27 changed files
with
456 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Kerox\Messenger\Event; | ||
|
||
use Kerox\Messenger\Model\Callback\Reaction; | ||
|
||
class ReactionEvent extends AbstractEvent | ||
{ | ||
public const NAME = 'reaction'; | ||
|
||
protected $timestamp; | ||
protected $reaction; | ||
|
||
public function __construct(string $senderId, string $recipientId, int $timestamp, Reaction $reaction) | ||
{ | ||
parent::__construct($senderId, $recipientId); | ||
|
||
$this->timestamp = $timestamp; | ||
$this->reaction = $reaction; | ||
} | ||
|
||
public function getTimestamp(): int | ||
{ | ||
return $this->timestamp; | ||
} | ||
|
||
public function getReaction(): Reaction | ||
{ | ||
return $this->reaction; | ||
} | ||
|
||
public function getName(): string | ||
{ | ||
return self::NAME; | ||
} | ||
|
||
/** | ||
* @return \Kerox\Messenger\Event\ReactionEvent | ||
*/ | ||
public static function create(array $payload): self | ||
{ | ||
$senderId = $payload['sender']['id']; | ||
$recipientId = $payload['recipient']['id']; | ||
$timestamp = $payload['timestamp']; | ||
$reaction = Reaction::create($payload['reaction']); | ||
|
||
return new static($senderId, $recipientId, $timestamp, $reaction); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Kerox\Messenger\Model\Callback; | ||
|
||
class Reaction | ||
{ | ||
public const REACTION_SMILE = 'smile'; | ||
public const REACTION_ANGRY = 'angry'; | ||
public const REACTION_SAD = 'sad'; | ||
public const REACTION_WOW = 'wow'; | ||
public const REACTION_LOVE = 'love'; | ||
public const REACTION_LIKE = 'like'; | ||
public const REACTION_DISLIKE = 'dislike'; | ||
public const REACTION_OTHER = 'other'; | ||
|
||
public const ACTION_REACT = 'react'; | ||
public const ACTION_UNREACT = 'unreact'; | ||
|
||
protected $reaction; | ||
protected $emoji; | ||
protected $action; | ||
protected $mid; | ||
|
||
/** | ||
* Reaction constructor. | ||
*/ | ||
public function __construct(string $reaction, string $emoji, string $action, string $mid) | ||
{ | ||
$this->reaction = $reaction; | ||
$this->emoji = $emoji; | ||
$this->action = $action; | ||
$this->mid = $mid; | ||
} | ||
|
||
public function getReaction(): string | ||
{ | ||
return $this->reaction; | ||
} | ||
|
||
public function getEmoji(): string | ||
{ | ||
return $this->emoji; | ||
} | ||
|
||
public function getAction(): string | ||
{ | ||
return $this->action; | ||
} | ||
|
||
public function getMid(): string | ||
{ | ||
return $this->mid; | ||
} | ||
|
||
/** | ||
* @return \Kerox\Messenger\Model\Callback\Reaction | ||
*/ | ||
public static function create(array $callbackData): self | ||
{ | ||
return new self( | ||
$callbackData['reaction'], | ||
$callbackData['emoji'], | ||
$callbackData['action'], | ||
$callbackData['mid'] | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.