2021-02-04 09:02:19 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/* Icinga DB Web | (c) 2021 Icinga GmbH | GPLv2 */
|
|
|
|
|
|
|
|
|
|
namespace Icinga\Module\Icingadb\Command\Object;
|
|
|
|
|
|
|
|
|
|
trait CommandAuthor
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Author of the command
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
protected $author;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the author
|
|
|
|
|
*
|
|
|
|
|
* @param string $author
|
|
|
|
|
*
|
|
|
|
|
* @return $this
|
|
|
|
|
*/
|
2021-09-22 04:21:15 -04:00
|
|
|
public function setAuthor(string $author): self
|
2021-02-04 09:02:19 -05:00
|
|
|
{
|
2021-09-22 04:21:15 -04:00
|
|
|
$this->author = $author;
|
2021-02-04 09:02:19 -05:00
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the author
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2021-09-22 04:21:15 -04:00
|
|
|
public function getAuthor(): string
|
2021-02-04 09:02:19 -05:00
|
|
|
{
|
2021-09-22 04:21:15 -04:00
|
|
|
if ($this->author === null) {
|
|
|
|
|
throw new \LogicException(
|
|
|
|
|
'You are accessing an unset property. Please make sure to set it beforehand.'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-04 09:02:19 -05:00
|
|
|
return $this->author;
|
|
|
|
|
}
|
|
|
|
|
}
|