mirror of
https://github.com/Karaka-Management/oms-HumanResourceManagement.git
synced 2026-01-28 11:48:41 +00:00
php cs and stan fixes
This commit is contained in:
parent
250c3de9de
commit
dd2731da98
|
|
@ -14,8 +14,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\HumanResourceManagement\Models;
|
||||
|
||||
use Modules\Media\Models\Media;
|
||||
use Modules\Media\Models\NullMedia;
|
||||
use Modules\Profile\Models\Profile;
|
||||
|
||||
use phpOMS\Contract\ArrayableInterface;
|
||||
|
||||
/**
|
||||
|
|
|
|||
185
Models/EmployeeEducationHistory.php
Normal file
185
Models/EmployeeEducationHistory.php
Normal file
|
|
@ -0,0 +1,185 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package Modules\HumanResourceManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\HumanResourceManagement\Models;
|
||||
|
||||
use Modules\Organization\Models\Department;
|
||||
use Modules\Organization\Models\NullDepartment;
|
||||
use Modules\Organization\Models\NullPosition;
|
||||
use Modules\Organization\Models\NullUnit;
|
||||
use Modules\Organization\Models\Position;
|
||||
use Modules\Organization\Models\Unit;
|
||||
|
||||
use phpOMS\Contract\ArrayableInterface;
|
||||
|
||||
/**
|
||||
* Employee class.
|
||||
*
|
||||
* @package Modules\HumanResourceManagement\Models
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class EmployeeEducationHistory implements ArrayableInterface, \JsonSerializable
|
||||
{
|
||||
/**
|
||||
* ID.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected int $id = 0;
|
||||
|
||||
/**
|
||||
* Employee
|
||||
*
|
||||
* @var int|Employee
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $employee = 0;
|
||||
|
||||
/**
|
||||
* Start date
|
||||
*
|
||||
* @var \DateTime
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private \DateTime $start;
|
||||
|
||||
/**
|
||||
* End date
|
||||
*
|
||||
* @var null|\DateTime
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private ?\DateTime $end = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param int|Employee $employee Employee
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct($employee = 0)
|
||||
{
|
||||
$this->employee = $employee;
|
||||
$this->start = new \DateTime('now');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id.
|
||||
*
|
||||
* @return int Model id
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the employee this history belongs to
|
||||
*
|
||||
* @return int|Employee
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getEmployee()
|
||||
{
|
||||
return empty($this->employee) ? new NullEmployee() : $this->employee;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get start date
|
||||
*
|
||||
* @return \DateTime
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getStart() : \DateTime
|
||||
{
|
||||
return $this->start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set start date
|
||||
*
|
||||
* @param \DateTime $start Start date
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setStart(\DateTime $start) : void
|
||||
{
|
||||
$this->start = $start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get end date
|
||||
*
|
||||
* @return null|\DateTime
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getEnd() : ?\DateTime
|
||||
{
|
||||
return $this->end;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set end date
|
||||
*
|
||||
* @param \DateTime $end End date
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setEnd(\DateTime $end) : void
|
||||
{
|
||||
$this->end = $end;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'employee' => !\is_int($this->employee) ? $this->employee->getId() : $this->employee,
|
||||
'start' => $this->start,
|
||||
'end' => $this->end,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return (string) \json_encode($this->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
185
Models/EmployeeWorkHistory.php
Normal file
185
Models/EmployeeWorkHistory.php
Normal file
|
|
@ -0,0 +1,185 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package Modules\HumanResourceManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\HumanResourceManagement\Models;
|
||||
|
||||
use Modules\Organization\Models\Department;
|
||||
use Modules\Organization\Models\NullDepartment;
|
||||
use Modules\Organization\Models\NullPosition;
|
||||
use Modules\Organization\Models\NullUnit;
|
||||
use Modules\Organization\Models\Position;
|
||||
use Modules\Organization\Models\Unit;
|
||||
|
||||
use phpOMS\Contract\ArrayableInterface;
|
||||
|
||||
/**
|
||||
* Employee class.
|
||||
*
|
||||
* @package Modules\HumanResourceManagement\Models
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class EmployeeWorkHistory implements ArrayableInterface, \JsonSerializable
|
||||
{
|
||||
/**
|
||||
* ID.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected int $id = 0;
|
||||
|
||||
/**
|
||||
* Employee
|
||||
*
|
||||
* @var int|Employee
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $employee = 0;
|
||||
|
||||
/**
|
||||
* Start date
|
||||
*
|
||||
* @var \DateTime
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private \DateTime $start;
|
||||
|
||||
/**
|
||||
* End date
|
||||
*
|
||||
* @var null|\DateTime
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private ?\DateTime $end = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param int|Employee $employee Employee
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct($employee = 0)
|
||||
{
|
||||
$this->employee = $employee;
|
||||
$this->start = new \DateTime('now');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id.
|
||||
*
|
||||
* @return int Model id
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the employee this history belongs to
|
||||
*
|
||||
* @return int|Employee
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getEmployee()
|
||||
{
|
||||
return empty($this->employee) ? new NullEmployee() : $this->employee;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get start date
|
||||
*
|
||||
* @return \DateTime
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getStart() : \DateTime
|
||||
{
|
||||
return $this->start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set start date
|
||||
*
|
||||
* @param \DateTime $start Start date
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setStart(\DateTime $start) : void
|
||||
{
|
||||
$this->start = $start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get end date
|
||||
*
|
||||
* @return null|\DateTime
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getEnd() : ?\DateTime
|
||||
{
|
||||
return $this->end;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set end date
|
||||
*
|
||||
* @param \DateTime $end End date
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setEnd(\DateTime $end) : void
|
||||
{
|
||||
$this->end = $end;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'employee' => !\is_int($this->employee) ? $this->employee->getId() : $this->employee,
|
||||
'start' => $this->start,
|
||||
'end' => $this->end,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return (string) \json_encode($this->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
27
Models/NullEmployeeEducationHistory.php
Normal file
27
Models/NullEmployeeEducationHistory.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package Modules\News\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\HumanResourceManagement\Models;
|
||||
|
||||
/**
|
||||
* Null model
|
||||
*
|
||||
* @package Modules\HumanResourceManagement\Models
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class NullEmployeeEducationHistory extends EmployeeEducationHistory
|
||||
{
|
||||
}
|
||||
27
Models/NullEmployeeWorkHistory.php
Normal file
27
Models/NullEmployeeWorkHistory.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package Modules\News\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\HumanResourceManagement\Models;
|
||||
|
||||
/**
|
||||
* Null model
|
||||
*
|
||||
* @package Modules\HumanResourceManagement\Models
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class NullEmployeeWorkHistory extends EmployeeWorkHistory
|
||||
{
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user