oms-OnlineResourceWatcher/Models/Resource.php
2022-11-25 19:25:23 +01:00

101 lines
1.7 KiB
PHP

<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\OnlineResourceWatcher\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://karaka.app
*/
declare(strict_types=1);
namespace Modules\OnlineResourceWatcher\Models;
use Modules\Admin\Models\Account;
use Modules\Admin\Models\NullAccount;
/**
* Resource class.
*
* @package Modules\OnlineResourceWatcher\Models
* @license OMS License 1.0
* @link https://karaka.app
* @since 1.0.0
*/
class Resource implements \JsonSerializable
{
/**
* Article ID.
*
* @var int
* @since 1.0.0
*/
protected int $id = 0;
/**
* Owner.
*
* @var Account
* @since 1.0.0
*/
public Account $owner;
/**
* Created.
*
* @var \DateTimeImmutable
* @since 1.0.0
*/
public \DateTimeImmutable $createdAt;
/**
* Title.
*
* @var string
* @since 1.0.0
*/
public string $title = '';
/**
* Path.
*
* @var string
* @since 1.0.0
*/
public string $path = '';
/**
* Constructor.
*
* @since 1.0.0
*/
public function __construct()
{
$this->owner = new NullAccount();
$this->createdAt = new \DateTimeImmutable('now');
}
/**
* {@inheritdoc}
*/
public function toArray() : array
{
return [
'id' => $this->id,
'createdAt' => $this->createdAt,
'owner' => $this->owner,
];
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return $this->toArray();
}
}