oms-Exchange/Interfaces/GSD/Model/GSDCostObject.php

173 lines
2.9 KiB
PHP
Executable File

<?php
/**
* Orange Management
*
* PHP Version 7.4
*
* @package Modules\Exchange\Interfaces\GSD\Model
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
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://orange-management.org
* @since 1.0.0
*/
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
*/
protected 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 description
*
* @param string $description Description
*
* @return void
*
* @since 1.0.0
*/
public function setDescription(string $description) : void
{
$this->description = $description;
}
/**
* Get description
*
* @return string
*
* @since 1.0.0
*/
public function getDescription() : string
{
return $this->description;
}
/**
* 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()
{
return $this->toArray();
}
}