You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.0 KiB
56 lines
1.0 KiB
2 years ago
|
<?php
|
||
|
|
||
|
namespace Plugins\Notebook\Enums;
|
||
|
|
||
|
use App\Enums\EnumStatusTrait;
|
||
|
use Sc\Util\HtmlElement\ElementType\AbstractHtmlElement;
|
||
|
|
||
|
/**
|
||
|
* 笔记本 : 模式
|
||
|
*/
|
||
|
enum NotebookEnumMode :int
|
||
|
{
|
||
|
use EnumStatusTrait;
|
||
|
|
||
|
/**
|
||
|
* 读写
|
||
|
*/
|
||
|
case ReadingAndWriting = 1;
|
||
|
|
||
|
/**
|
||
|
* 只读
|
||
|
*/
|
||
|
case ReadOnly = 2;
|
||
|
|
||
|
/**
|
||
|
* 私有写
|
||
|
*/
|
||
|
case PrivateWrite = 3;
|
||
|
|
||
|
/**
|
||
|
* 获取描述
|
||
|
*
|
||
|
* @return string
|
||
|
*/
|
||
|
public function getDes(): string
|
||
|
{
|
||
|
return match ($this) {
|
||
|
self::ReadingAndWriting => '读写',
|
||
|
self::ReadOnly => '只读',
|
||
|
self::PrivateWrite => '私有写',
|
||
|
};
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 转标签
|
||
|
*/
|
||
|
public function toTag():AbstractHtmlElement
|
||
|
{
|
||
|
return match ($this){
|
||
|
self::ReadingAndWriting => $this->getTag('success', 'light'),
|
||
|
self::ReadOnly => $this->getTag('warning', 'light'),
|
||
|
self::PrivateWrite => $this->getTag('danger', 'light'),
|
||
|
};
|
||
|
}
|
||
|
}
|