消息组件初始版本

This commit is contained in:
ykxiao
2024-01-31 09:30:04 +08:00
commit 62cfeb1772
22 changed files with 1019 additions and 0 deletions

View File

@ -0,0 +1,69 @@
<?php
declare(strict_types=1);
namespace MessageNotify\Template;
use MessageNotify\Contracts\MessageNotifyInterface;
abstract class AbstractTemplate
{
protected array $at = [];
protected string $pipeline = MessageNotifyInterface::INFO;
protected string $text = '';
protected string $title = '';
public function getText(): string
{
return $this->text;
}
public function setText(string $text): AbstractTemplate
{
$this->text = $text;
return $this;
}
public function getTitle(): string
{
return $this->title;
}
public function setTitle(string $title): AbstractTemplate
{
$this->title = $title;
return $this;
}
public function getPipeline(): string
{
return $this->pipeline;
}
public function setPipeline(string $pipeline): AbstractTemplate
{
$this->pipeline = $pipeline;
return $this;
}
public function setAt(array $at = []): AbstractTemplate
{
$this->at = $at;
return $this;
}
public function getAt(): array
{
return $this->at;
}
public function isAtAll(): bool
{
return in_array('all', $this->at) || in_array('ALL', $this->at);
}
abstract public function getBody();
}