openvk/Web/Models/Entities/Ticket.php
Alexander Minkin 6ec54a379d
feat: add linting of code (#1220)
* feat(lint): add php-cs-fixer for linting

Removing previous CODE_STYLE as it was not enforced anyway and using PER-CS 2.0.

This is not the reformatting commit.

* style: format code according to PER-CS 2.0 with php-cs-fixer

* ci(actions): add lint action

Resolves #1132.
2025-01-31 18:20:13 +03:00

71 lines
1.4 KiB
PHP

<?php
declare(strict_types=1);
namespace openvk\Web\Models\Entities;
use openvk\Web\Util\DateTime;
use openvk\Web\Models\RowModel;
use openvk\Web\Models\Repositories\Users;
class Ticket extends RowModel
{
use Traits\TRichText;
protected $tableName = "tickets";
private $overrideContentColumn = "text";
public function getId(): int
{
return $this->getRecord()->id;
}
public function getStatus(): string
{
return tr("support_status_" . $this->getRecord()->type);
}
public function getType(): int
{
return $this->getRecord()->type;
}
public function getName(): string
{
return ovk_proc_strtr($this->getRecord()->name, 100);
}
public function getContext(): string
{
$text = $this->getRecord()->text;
$text = $this->formatLinks($text);
$text = $this->removeZalgo($text);
$text = nl2br($text);
return $text;
}
public function getTime(): DateTime
{
return new DateTime($this->getRecord()->created);
}
public function isDeleted(): bool
{
return (bool) $this->getRecord()->deleted;
}
public function getUser(): user
{
return (new Users())->get($this->getRecord()->user_id);
}
public function getUserId(): int
{
return $this->getRecord()->user_id;
}
public function isAd(): bool /* Эх, костыли... */
{
return false;
}
}