for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace SlayerBirden\DataFlowServer\Notification;
abstract class AbstractMessage implements MessageInterface
{
/**
* Type of the message
*
* @var string
*/
protected $type;
* Message
protected $message;
* Message identifier (unique id)
protected $id;
* @inheritdoc
public function __construct(string $message)
$this->message = $message;
}
* @return string
public function getType(): string
return $this->type;
public function getMessage(): string
return $this->message;
public function getId(): string
if (!isset($this->id)) {
$this->id = uniqid();
return $this->id;
public function jsonSerialize()
return [
'id' => $this->getId(),
'class' => $this->getType(),
'message' => $this->getMessage(),
];