cleanup and tests added for ci/cd

This commit is contained in:
Dennis Eichhorn 2019-11-20 22:28:04 +01:00
parent 2348e6b72d
commit 6536aec349
3 changed files with 159 additions and 111 deletions

View File

@ -51,10 +51,20 @@ class Issue
/** /**
* Created. * Created.
* *
* @var null|\DateTime * @var \DateTime
* @since 1.0.0 * @since 1.0.0
*/ */
private ?\DateTime $created = null; private \DateTime $created;
/**
* Constructor.
*
* @since 1.0.0
*/
public function __construct()
{
$this->created = new \DateTime('now');
}
/** /**
* Creator. * Creator.
@ -64,77 +74,93 @@ class Issue
*/ */
private ?int $creator = null; private ?int $creator = null;
private static $instances = []; /**
* Get id.
public function getInstance($id) *
{ * @return int
if (!isset(self::$instances[$id])) { *
self::$instances[$id] = new self($id); * @since 1.0.0
} */
public function getId() : int
return self::$instances[$id];
}
public function init($id) : void
{
}
public function __clone()
{
}
public function getId()
{ {
return $this->id; return $this->id;
} }
public function getName() /**
* Get name/title
*
* @return string
*
* @since 1.0.0
*/
public function getName() : string
{ {
return $this->name; return $this->name;
} }
public function setName($name) : void /**
* Set name/title
*
* @param string $name Name/title
*
* @return void
*
* @since 1.0.0
*/
public function setName(string $name) : void
{ {
$this->name = $name; $this->name = $name;
} }
public function getCreated() /**
* Get created.
*
* @return \DateTime
*
* @since 1.0.0
*/
public function getCreated() : \DateTime
{ {
return $this->created; return $this->created;
} }
/**
* Set created.
*
* @param \DateTime $created Date of when the article got created
*
* @return void
*
* @since 1.0.0
*/
public function setCreated($created) : void public function setCreated($created) : void
{ {
$this->created = $created; $this->created = $created;
} }
/**
* Get creator.
*
* @return mixed
*
* @since 1.0.0
*/
public function getCreator() public function getCreator()
{ {
return $this->creator; return $this->creator;
} }
/**
* Set creator.
*
* @param mixed $creator Creator
*
* @return void
*
* @since 1.0.0
*/
public function setCreator($creator) : void public function setCreator($creator) : void
{ {
$this->creator = $creator; $this->creator = $creator;
} }
public function delete() : void
{
}
public function create() : void
{
}
public function update() : void
{
}
public function serialize() : void
{
}
public function unserialize($data) : void
{
}
} }

View File

@ -44,10 +44,10 @@ class Message
/** /**
* Created. * Created.
* *
* @var null|\DateTime * @var \DateTime
* @since 1.0.0 * @since 1.0.0
*/ */
private ?\DateTime $created = null; private \DateTime $created;
/** /**
* Creator. * Creator.
@ -57,95 +57,101 @@ class Message
*/ */
private ?int $creator = null; private ?int $creator = null;
private static $instances = []; /**
* Constructor.
public function getInstance($id) *
* @since 1.0.0
*/
public function __construct()
{ {
if (!isset(self::$instances[$id])) { $this->created = new \DateTime('now');
self::$instances[$id] = new self($id);
}
return self::$instances[$id];
} }
public function getId() /**
* Get id.
*
* @return int
*
* @since 1.0.0
*/
public function getId() : int
{ {
return $this->id; return $this->id;
} }
public function getName() /**
* Get name/title.
*
* @return string
*
* @since 1.0.0
*/
public function getName() : string
{ {
return $this->name; return $this->name;
} }
public function setName($name) : void
{
$this->name = $name;
}
public function getCreated()
{
return $this->created;
}
public function setCreated($created) : void
{
$this->created = $created;
}
public function getCreator()
{
return $this->creator;
}
public function setCreator($creator) : void
{
$this->creator = $creator;
}
public function delete() : void
{
}
public function create() : void
{
}
public function update() : void
{
}
public function serialize() : void
{
}
public function unserialize($data) : void
{
}
/** /**
* Init object by ID. * Set name.
* *
* This usually happens from DB or cache * @param string $name Name/title
*
* @param int $id Object ID
* *
* @return void * @return void
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function init($id) : void public function setName(string $name) : void
{ {
// TODO: Implement init() method. $this->name = $name;
} }
/** /**
* Overwriting clone in order to maintain singleton pattern. * Get created.
*
* @return \DateTime
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function __clone() public function getCreated() : \DateTime
{ {
// TODO: Implement __clone() method. return $this->created;
}
/**
* Set created.
*
* @return void
*
* @since 1.0.0
*/
public function setCreated($created) : void
{
$this->created = $created;
}
/**
* Get creator.
*
* @return mixed
*
* @since 1.0.0
*/
public function getCreator()
{
return $this->creator;
}
/**
* Set creator.
*
* @param mixed $creator Creator
*
* @return void
*
* @since 1.0.0
*/
public function setCreator($creator) : void
{
$this->creator = $creator;
} }
} }

View File

@ -60,11 +60,27 @@ class Ticket
return $this->id; return $this->id;
} }
/**
* Get task.
*
* @return Task
*
* @since 1.0.0
*/
public function getTask() : Task public function getTask() : Task
{ {
return $this->task; return $this->task;
} }
/**
* Set task.
*
* @param Task $task Task
*
* @return void
*
* @since 1.0.0
*/
public function setTask(Task $task) : void public function setTask(Task $task) : void
{ {
$this->task = $task; $this->task = $task;