mirror of
https://github.com/openvk/openvk
synced 2025-02-02 13:05:37 +03:00
Alexander Minkin
6ec54a379d
* 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.
75 lines
1.5 KiB
PHP
75 lines
1.5 KiB
PHP
<?php
|
||
|
||
declare(strict_types=1);
|
||
|
||
namespace openvk\Web\Models\Entities;
|
||
|
||
use openvk\Web\Models\RowModel;
|
||
use openvk\Web\Util\DateTime;
|
||
use openvk\Web\Models\Repositories\{Users};
|
||
use Nette\Database\Table\ActiveRow;
|
||
|
||
class NoSpamLog extends RowModel
|
||
{
|
||
protected $tableName = "noSpam_templates";
|
||
|
||
public function getId(): int
|
||
{
|
||
return $this->getRecord()->id;
|
||
}
|
||
|
||
public function getUser(): ?User
|
||
{
|
||
return (new Users())->get($this->getRecord()->user);
|
||
}
|
||
|
||
public function getModel(): string
|
||
{
|
||
return $this->getRecord()->model;
|
||
}
|
||
|
||
public function getRegex(): ?string
|
||
{
|
||
return $this->getRecord()->regex;
|
||
}
|
||
|
||
public function getRequest(): ?string
|
||
{
|
||
return $this->getRecord()->request;
|
||
}
|
||
|
||
public function getCount(): int
|
||
{
|
||
return $this->getRecord()->count;
|
||
}
|
||
|
||
public function getTime(): DateTime
|
||
{
|
||
return new DateTime($this->getRecord()->time);
|
||
}
|
||
|
||
public function getItems(): ?array
|
||
{
|
||
return explode(",", $this->getRecord()->items);
|
||
}
|
||
|
||
public function getTypeRaw(): int
|
||
{
|
||
return $this->getRecord()->ban_type;
|
||
}
|
||
|
||
public function getType(): string
|
||
{
|
||
switch ($this->getTypeRaw()) {
|
||
case 1: return "О";
|
||
case 2: return "Б";
|
||
case 3: return "ОБ";
|
||
default: return (string) $this->getTypeRaw();
|
||
}
|
||
}
|
||
|
||
public function isRollbacked(): bool
|
||
{
|
||
return !is_null($this->getRecord()->rollback);
|
||
}
|
||
}
|