90 lines
1.6 KiB
PHP
Executable File
90 lines
1.6 KiB
PHP
Executable File
<?php
|
|
|
|
|
|
namespace Venom\Models;
|
|
|
|
|
|
class DataModel
|
|
{
|
|
public const TYPE_CONTENT = 'content';
|
|
public const TYPE_FORM = 'form';
|
|
|
|
public string $id;
|
|
public string $raw;
|
|
public string $generated;
|
|
public string $type;
|
|
public int $active = 1;
|
|
|
|
public function __construct(
|
|
string $id,
|
|
string $type = self::TYPE_CONTENT,
|
|
string $raw = '',
|
|
string $generated = ''
|
|
)
|
|
{
|
|
$this->id = $id;
|
|
$this->type = $type;
|
|
$this->raw = $raw;
|
|
$this->generated = $generated;
|
|
}
|
|
|
|
public function getId(): string
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function setId(string $id): void
|
|
{
|
|
$this->id = $id;
|
|
}
|
|
|
|
public function getRaw(): string
|
|
{
|
|
return $this->raw;
|
|
}
|
|
|
|
public function setRaw(string $raw): void
|
|
{
|
|
$this->raw = $raw;
|
|
}
|
|
|
|
public function getGenerated(): string
|
|
{
|
|
return $this->generated;
|
|
}
|
|
|
|
public function setGenerated(string $generated): void
|
|
{
|
|
$this->generated = $generated;
|
|
}
|
|
|
|
public function getType(): string
|
|
{
|
|
return $this->type;
|
|
}
|
|
|
|
public function setType(string $type): void
|
|
{
|
|
$this->type = $type;
|
|
}
|
|
|
|
public function validate(): bool
|
|
{
|
|
return $this->type !== '' && $this->id !== '' && $this->generated !== '' && $this->raw !== '';
|
|
}
|
|
|
|
public function isActive(): bool
|
|
{
|
|
return $this->active === 1;
|
|
}
|
|
|
|
public function getActive(): int
|
|
{
|
|
return $this->active;
|
|
}
|
|
|
|
public function setActive(bool $value): void
|
|
{
|
|
$this->active = $value ? 1 : 0;
|
|
}
|
|
} |