mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-05-28 04:36:06 -04:00
Add SPDX license headers and mark source files as GPL-3.0-or-later to preserve the option to relicense under later GPL versions.
51 lines
968 B
PHP
51 lines
968 B
PHP
<?php
|
|
|
|
// SPDX-FileCopyrightText: 2021 Icinga GmbH <https://icinga.com>
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
namespace Icinga\Module\Icingadb\Command\Object;
|
|
|
|
/**
|
|
* Base class for commands adding comments
|
|
*/
|
|
abstract class WithCommentCommand extends ObjectsCommand
|
|
{
|
|
use CommandAuthor;
|
|
|
|
/**
|
|
* Comment
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $comment;
|
|
|
|
/**
|
|
* Set the comment
|
|
*
|
|
* @param string $comment
|
|
*
|
|
* @return $this
|
|
*/
|
|
public function setComment(string $comment): self
|
|
{
|
|
$this->comment = $comment;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Get the comment
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getComment(): string
|
|
{
|
|
if ($this->comment === null) {
|
|
throw new \LogicException(
|
|
'You are accessing an unset property. Please make sure to set it beforehand.'
|
|
);
|
|
}
|
|
|
|
return $this->comment;
|
|
}
|
|
}
|