mirror of
https://github.com/Karaka-Management/oms-Exchange.git
synced 2026-01-11 16:48:42 +00:00
149 lines
2.5 KiB
PHP
Executable File
149 lines
2.5 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* Karaka
|
|
*
|
|
* PHP Version 8.1
|
|
*
|
|
* @package Modules\Exchange\Interfaces\GSD\Model
|
|
* @copyright Dennis Eichhorn
|
|
* @license OMS License 1.0
|
|
* @version 1.0.0
|
|
* @link https://karaka.app
|
|
*/
|
|
declare(strict_types=1);
|
|
|
|
namespace Modules\Exchange\Interfaces\GSD\Model;
|
|
|
|
/**
|
|
* Cost object class.
|
|
*
|
|
* @package Modules\Exchange\Interfaces\GSD\Model
|
|
* @license OMS License 1.0
|
|
* @link https://karaka.app
|
|
* @since 1.0.0
|
|
*
|
|
* @codeCoverageIgnore
|
|
*/
|
|
class GSDCostObject implements \JsonSerializable
|
|
{
|
|
/**
|
|
* ID.
|
|
*
|
|
* @var int
|
|
* @since 1.0.0
|
|
*/
|
|
protected int $id = 0;
|
|
|
|
/**
|
|
* Creator.
|
|
*
|
|
* @var int
|
|
* @since 1.0.0
|
|
*/
|
|
protected $createdBy = 0;
|
|
|
|
/**
|
|
* Created.
|
|
*
|
|
* @var \DateTimeImmutable
|
|
* @since 1.0.0
|
|
*/
|
|
public \DateTimeImmutable $createdAt;
|
|
|
|
/**
|
|
* Description.
|
|
*
|
|
* @var string
|
|
* @since 1.0.0
|
|
*/
|
|
public string $description = '';
|
|
|
|
/**
|
|
* Cost object.
|
|
*
|
|
* @var string
|
|
* @since 1.0.0
|
|
*/
|
|
protected string $costObject = '';
|
|
|
|
/**
|
|
* Constructor.
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
public function __construct()
|
|
{
|
|
$this->createdAt = new \DateTimeImmutable('now');
|
|
}
|
|
|
|
/**
|
|
* @return \DateTimeImmutable
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
public function getCreatedAt() : \DateTimeImmutable
|
|
{
|
|
return $this->createdAt ?? new \DateTimeImmutable();
|
|
}
|
|
|
|
/**
|
|
* Set cost object
|
|
*
|
|
* @param string $costObject Cost object
|
|
*
|
|
* @return void
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
public function setCostObject(string $costObject) : void
|
|
{
|
|
$this->costObject = $costObject;
|
|
}
|
|
|
|
/**
|
|
* Get cost object
|
|
*
|
|
* @return string
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
public function getCostObject() : string
|
|
{
|
|
return $this->costObject;
|
|
}
|
|
|
|
/**
|
|
* Get id
|
|
*
|
|
* @return int
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
public function getId() : int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function toArray() : array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'createdBy' => $this->createdBy,
|
|
'createdAt' => $this->createdAt,
|
|
'description' => $this->description,
|
|
'costObject' => $this->costObject,
|
|
];
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function jsonSerialize() : mixed
|
|
{
|
|
return $this->toArray();
|
|
}
|
|
}
|