tapi/app/entity/gateway/el/ElNotification.php

45 lines
1.1 KiB
PHP

<?php
namespace app\entity\gateway\el;
class ElNotification
{
public string $title = '';
public string $message = '';
public bool $dangerouslyUseHTMLString = false;
public string $type;
public ?string $icon;
public int $duration;
public string $position;
public function __construct(
array $_attr = [],
string $title = '',
string $message = '',
bool $dangerouslyUseHTMLString = false,
string $type = '',
string $icon = null,
int $duration = 4500,
string $position = 'top-right',
)
{
$this->title = $title;
$this->message = $message;
$this->dangerouslyUseHTMLString = $dangerouslyUseHTMLString;
$this->type = $type;
$this->icon = $icon;
$this->duration = $duration;
$this->position = $position;
if (!empty($_attr)) {
foreach ($_attr as $key => $value) {
$this->$key = $value;
}
}
}
public function toArray(): array
{
return get_object_vars($this);
}
}