cleanup and tests added for ci/cd

This commit is contained in:
Dennis Eichhorn 2019-11-20 22:28:04 +01:00
parent 725acd6609
commit 896647e6fe
4 changed files with 302 additions and 1 deletions

View File

@ -105,21 +105,53 @@ class KanbanBoard implements \JsonSerializable
$this->name = $name; $this->name = $name;
} }
/**
* Get the status
*
* @return int
*
* @since 1.0.0
*/
public function getStatus() : int public function getStatus() : int
{ {
return $this->status; return $this->status;
} }
/**
* Set the status
*
* @param int $status Status
*
* @return void
*
* @since 1.0.0
*/
public function setStatus(int $status) : void public function setStatus(int $status) : void
{ {
$this->status = $status; $this->status = $status;
} }
/**
* Get the order
*
* @return int
*
* @since 1.0.0
*/
public function getOrder() : int public function getOrder() : int
{ {
return $this->order; return $this->order;
} }
/**
* Set the order
*
* @param int $order Order
*
* @return void
*
* @since 1.0.0
*/
public function setOrder(int $order) : void public function setOrder(int $order) : void
{ {
$this->order = $order; $this->order = $order;
@ -189,16 +221,41 @@ class KanbanBoard implements \JsonSerializable
return $this->createdAt; return $this->createdAt;
} }
/**
* Get the columns
*
* @return array
*
* @since 1.0.0
*/
public function getColumns() : array public function getColumns() : array
{ {
return $this->columns; return $this->columns;
} }
/**
* Add a column
*
* @param mixed $column Column
*
* @return void
*
* @since 1.0.0
*/
public function addColumn($column) : void public function addColumn($column) : void
{ {
$this->columns[] = $column; $this->columns[] = $column;
} }
/**
* Remove a column
*
* @param int $id Id to remove
*
* @return bool
*
* @since 1.0.0
*/
public function removeColumn(int $id) : bool public function removeColumn(int $id) : bool
{ {
if (isset($this->columns[$id])) { if (isset($this->columns[$id])) {

View File

@ -14,8 +14,10 @@ declare(strict_types=1);
namespace Modules\Kanban\Models; namespace Modules\Kanban\Models;
use Modules\Tasks\Models\Task;
/** /**
* Task class. * Kanban card class.
* *
* @package Modules\Kanban\Models * @package Modules\Kanban\Models
* @license OMS License 1.0 * @license OMS License 1.0
@ -77,11 +79,27 @@ class KanbanCard implements \JsonSerializable
$this->createdAt = new \DateTime('now'); $this->createdAt = new \DateTime('now');
} }
/**
* Get the order
*
* @return int
*
* @since 1.0.0
*/
public function getOrder() : int public function getOrder() : int
{ {
return $this->order; return $this->order;
} }
/**
* Set the order
*
* @param int $order Order
*
* @return void
*
* @since 1.0.0
*/
public function setOrder(int $order) : void public function setOrder(int $order) : void
{ {
$this->order = $order; $this->order = $order;
@ -99,11 +117,27 @@ class KanbanCard implements \JsonSerializable
return $this->id; return $this->id;
} }
/**
* Set the column
*
* @param int $id Id
*
* @return void
*
* @since 1.0.0
*/
public function setColumn(int $id) : void public function setColumn(int $id) : void
{ {
$this->column = $id; $this->column = $id;
} }
/**
* Get the column
*
* @return int
*
* @since 1.0.0
*/
public function getColumn() : int public function getColumn() : int
{ {
return $this->column; return $this->column;
@ -135,31 +169,79 @@ class KanbanCard implements \JsonSerializable
$this->name = $name; $this->name = $name;
} }
/**
* Get the status
*
* @return int
*
* @since 1.0.0
*/
public function getStatus() : int public function getStatus() : int
{ {
return $this->status; return $this->status;
} }
/**
* Set the status
*
* @param int $status Status
*
* @return void
*
* @since 1.0.0
*/
public function setStatus(int $status) : void public function setStatus(int $status) : void
{ {
$this->status = $status; $this->status = $status;
} }
/**
* Get the card type
*
* @return int
*
* @since 1.0.0
*/
public function getType() : int public function getType() : int
{ {
return $this->type; return $this->type;
} }
/**
* Set the card type
*
* @param int $type Card type
*
* @return void
*
* @since 1.0.0
*/
public function setType(int $type) : void public function setType(int $type) : void
{ {
$this->type = $type; $this->type = $type;
} }
/**
* Get the reference if the card references another object (e.g. task, calendar etc.)
*
* @return int
*
* @since 1.0.0
*/
public function getRef() : int public function getRef() : int
{ {
return $this->ref; return $this->ref;
} }
/**
* Set the reference
*
* @param int $ref Reference
*
* @return void
*
* @since 1.0.0
*/
public function setRef(int $ref) : void public function setRef(int $ref) : void
{ {
$this->ref = $ref; $this->ref = $ref;
@ -229,16 +311,41 @@ class KanbanCard implements \JsonSerializable
return $this->createdAt; return $this->createdAt;
} }
/**
* Get the comments
*
* @return array
*
* @since 1.0.0
*/
public function getComments() : array public function getComments() : array
{ {
return $this->comments; return $this->comments;
} }
/**
* Add a comment
*
* @param mixed $comment Comment
*
* @return void
*
* @since 1.0.0
*/
public function addComment($comment) : void public function addComment($comment) : void
{ {
$this->comments[] = $comment; $this->comments[] = $comment;
} }
/**
* Remove a comment
*
* @param int $id Comment id
*
* @return bool
*
* @since 1.0.0
*/
public function removeComment(int $id) : bool public function removeComment(int $id) : bool
{ {
if (isset($this->comments[$id])) { if (isset($this->comments[$id])) {
@ -250,26 +357,65 @@ class KanbanCard implements \JsonSerializable
return false; return false;
} }
/**
* Get the media files
*
* @return array
*
* @since 1.0.0
*/
public function getMedia() : array public function getMedia() : array
{ {
return $this->media; return $this->media;
} }
/**
* Add a media file
*
* @return void
*
* @since 1.0.0
*/
public function addMedia($media) : void public function addMedia($media) : void
{ {
$this->media[] = $media; $this->media[] = $media;
} }
/**
* Set labels of the card
*
* @param array $labels Labels
*
* @return void
*
* @since 1.0.0
*/
public function setLabels(array $labels) : void public function setLabels(array $labels) : void
{ {
$this->labels = $labels; $this->labels = $labels;
} }
/**
* Get the labels
*
* @return array
*
* @since 1.0.0
*/
public function getLabels() : array public function getLabels() : array
{ {
return $this->labels; return $this->labels;
} }
/**
* Add a label/tag
*
* @param mixed $label Label
*
* @return void
*
* @since 1.0.0
*/
public function addLabel($label) : void public function addLabel($label) : void
{ {
$this->labels[] = $label; $this->labels[] = $label;
@ -296,6 +442,15 @@ class KanbanCard implements \JsonSerializable
]; ];
} }
/**
* Create a task from a card
*
* @param Task $task Task to create the card from
*
* @return KanbanCard
*
* @since 1.0.0
*/
public static function createFromTask(Task $task) : self public static function createFromTask(Task $task) : self
{ {
$card = new self(); $card = new self();

View File

@ -69,11 +69,27 @@ class KanbanCardComment implements \JsonSerializable
return $this->id; return $this->id;
} }
/**
* Set the card
*
* @param int $id Card id
*
* @return void
*
* @since 1.0.0
*/
public function setCard(int $id) : void public function setCard(int $id) : void
{ {
$this->card = $id; $this->card = $id;
} }
/**
* Get the card
*
* @return int
*
* @since 1.0.0
*/
public function getCard() : int public function getCard() : int
{ {
return $this->card; return $this->card;
@ -143,11 +159,27 @@ class KanbanCardComment implements \JsonSerializable
return $this->createdAt; return $this->createdAt;
} }
/**
* Get the media files
*
* @return array
*
* @since 1.0.0
*/
public function getMedia() : array public function getMedia() : array
{ {
return $this->media; return $this->media;
} }
/**
* Add a media file
*
* @param mixed $media Media
*
* @return void
*
* @since 1.0.0
*/
public function addMedia($media) : void public function addMedia($media) : void
{ {
$this->media[] = $media; $this->media[] = $media;

View File

@ -58,21 +58,53 @@ class KanbanColumn implements \JsonSerializable
return $this->id; return $this->id;
} }
/**
* Get the order
*
* @return int
*
* @since 1.0.0
*/
public function getOrder() : int public function getOrder() : int
{ {
return $this->order; return $this->order;
} }
/**
* Set the order
*
* @param int $order Order
*
* @return void
*
* @since 1.0.0
*/
public function setOrder(int $order) : void public function setOrder(int $order) : void
{ {
$this->order = $order; $this->order = $order;
} }
/**
* Get the board this column belongs to
*
* @param int $board Board
*
* @return void
*
* @since 1.0.0
*/
public function setBoard(int $board) : void public function setBoard(int $board) : void
{ {
$this->board = $board; $this->board = $board;
} }
/**
* Get the board this column belongs to
*
* @return int
*
* @since 1.0.0
*/
public function getBoard() : int public function getBoard() : int
{ {
return $this->board; return $this->board;
@ -104,16 +136,41 @@ class KanbanColumn implements \JsonSerializable
$this->name = $name; $this->name = $name;
} }
/**
* Get the cards
*
* @return array
*
* @since 1.0.0
*/
public function getCards() : array public function getCards() : array
{ {
return $this->cards; return $this->cards;
} }
/**
* Add a card
*
* @param KanbanCard $card Card
*
* @return void
*
* @since 1.0.0
*/
public function addCard(KanbanCard $card) : void public function addCard(KanbanCard $card) : void
{ {
$this->cards[] = $card; $this->cards[] = $card;
} }
/**
* Remove a card
*
* @param int $id Card to remove
*
* @return bool
*
* @since 1.0.0
*/
public function removeCard(int $id) : bool public function removeCard(int $id) : bool
{ {
if (isset($this->cards[$id])) { if (isset($this->cards[$id])) {