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.
*
* @var null|\DateTime
* @var \DateTime
* @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.
@ -64,77 +74,93 @@ class Issue
*/
private ?int $creator = null;
private static $instances = [];
public function getInstance($id)
{
if (!isset(self::$instances[$id])) {
self::$instances[$id] = new self($id);
}
return self::$instances[$id];
}
public function init($id) : void
{
}
public function __clone()
{
}
public function getId()
/**
* Get id.
*
* @return int
*
* @since 1.0.0
*/
public function getId() : int
{
return $this->id;
}
public function getName()
/**
* Get name/title
*
* @return string
*
* @since 1.0.0
*/
public function getName() : string
{
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;
}
public function getCreated()
/**
* Get created.
*
* @return \DateTime
*
* @since 1.0.0
*/
public function getCreated() : \DateTime
{
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
{
$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;
}
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.
*
* @var null|\DateTime
* @var \DateTime
* @since 1.0.0
*/
private ?\DateTime $created = null;
private \DateTime $created;
/**
* Creator.
@ -57,95 +57,101 @@ class Message
*/
private ?int $creator = null;
private static $instances = [];
public function getInstance($id)
/**
* Constructor.
*
* @since 1.0.0
*/
public function __construct()
{
if (!isset(self::$instances[$id])) {
self::$instances[$id] = new self($id);
}
return self::$instances[$id];
$this->created = new \DateTime('now');
}
public function getId()
/**
* Get id.
*
* @return int
*
* @since 1.0.0
*/
public function getId() : int
{
return $this->id;
}
public function getName()
/**
* Get name/title.
*
* @return string
*
* @since 1.0.0
*/
public function getName() : string
{
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 int $id Object ID
* @param string $name Name/title
*
* @return void
*
* @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
*/
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;
}
/**
* Get task.
*
* @return Task
*
* @since 1.0.0
*/
public function getTask() : Task
{
return $this->task;
}
/**
* Set task.
*
* @param Task $task Task
*
* @return void
*
* @since 1.0.0
*/
public function setTask(Task $task) : void
{
$this->task = $task;