mirror of
https://github.com/Karaka-Management/oms-EventManagement.git
synced 2026-01-26 07:48:42 +00:00
cleanup and tests added for ci/cd
This commit is contained in:
parent
84327ab221
commit
b3c20972b6
221
Models/Event.php
221
Models/Event.php
|
|
@ -91,6 +91,13 @@ class Event
|
|||
*/
|
||||
private $createdBy = 0;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $name Event name/title
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(string $name = '')
|
||||
{
|
||||
$this->start = new \DateTime('now');
|
||||
|
|
@ -104,56 +111,155 @@ class Event
|
|||
$this->setName($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id.
|
||||
*
|
||||
* @return int Model id
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get media files.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getMedia() : array
|
||||
{
|
||||
return $this->media;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add media file.
|
||||
*
|
||||
* @param mixed $media Media
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function addMedia($media) : void
|
||||
{
|
||||
$this->media[] = $media;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set end.
|
||||
*
|
||||
* @param \DateTime $end End date
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setEnd(\DateTime $end) : void
|
||||
{
|
||||
$this->end = $end;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get end.
|
||||
*
|
||||
* @return \DateTime
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getEnd() : \DateTime
|
||||
{
|
||||
return $this->end;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get progress.
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getProgress() : int
|
||||
{
|
||||
return $this->progress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set progress.
|
||||
*
|
||||
* @param int $progress Progress
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setProgress(int $progress) : void
|
||||
{
|
||||
$this->progress = $progress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get progress type.
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getProgressType() : int
|
||||
{
|
||||
return $this->progressType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set progress type.
|
||||
*
|
||||
* @param int $type Progress type
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setProgressType(int $type) : void
|
||||
{
|
||||
$this->progressType = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get calendar.
|
||||
*
|
||||
* @return Calendar
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getCalendar() : Calendar
|
||||
{
|
||||
return $this->calendar;
|
||||
|
|
@ -211,6 +317,15 @@ class Event
|
|||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add task.
|
||||
*
|
||||
* @param Task $task Task
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function addTask(Task $task) : void
|
||||
{
|
||||
if ($task->getId() !== 0) {
|
||||
|
|
@ -220,6 +335,15 @@ class Event
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove task
|
||||
*
|
||||
* @param int $id Id to remove.
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function removeTask(int $id) : bool
|
||||
{
|
||||
if (isset($this->tasks[$id])) {
|
||||
|
|
@ -231,33 +355,53 @@ class Event
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get task by id.
|
||||
*
|
||||
* @param int $id Task id
|
||||
*
|
||||
* @return Task
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getTask(int $id) : Task
|
||||
{
|
||||
return $this->tasks[$id] ?? new Task();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tasks.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getTasks() : array
|
||||
{
|
||||
return $this->tasks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count tasks.
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function countTasks() : int
|
||||
{
|
||||
return \count($this->tasks);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id.
|
||||
* Set type
|
||||
*
|
||||
* @return int Model id
|
||||
* @param int $type Type
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setType(int $type) : void
|
||||
{
|
||||
if (!EventType::isValidValue($type)) {
|
||||
|
|
@ -267,42 +411,99 @@ class Event
|
|||
$this->type = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get type
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getType() : int
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get costs.
|
||||
*
|
||||
* @return Money
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getCosts() : Money
|
||||
{
|
||||
return $this->costs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get budget.
|
||||
*
|
||||
* @return Money
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getBudget() : Money
|
||||
{
|
||||
return $this->budget;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get earnings.
|
||||
*
|
||||
* @return Money
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getEarnings() : Money
|
||||
{
|
||||
return $this->earnings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set costs.
|
||||
*
|
||||
* @param Money $costs Costs
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setCosts(Money $costs) : void
|
||||
{
|
||||
$this->costs = $costs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set budget.
|
||||
*
|
||||
* @param Money $budget Budget
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setBudget(Money $budget) : void
|
||||
{
|
||||
$this->budget = $budget;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set earnings.
|
||||
*
|
||||
* @param Money $earnings Earnings
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setEarnings(Money $earnings) : void
|
||||
{
|
||||
$this->earnings = $earnings;
|
||||
}
|
||||
|
||||
/**
|
||||
* get created at
|
||||
*
|
||||
* @return \DateTime
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -313,6 +514,8 @@ class Event
|
|||
}
|
||||
|
||||
/**
|
||||
* Get creator
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -323,7 +526,9 @@ class Event
|
|||
}
|
||||
|
||||
/**
|
||||
* @param $createdBy Creator
|
||||
* Set creator
|
||||
*
|
||||
* @param int $createdBy Creator
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user