icingadb-web/library/Icingadb/Command/Object/WithCommentCommand.php
Eric Lippmann 272e791390 License source files as GPL-3.0-or-later
Add SPDX license headers and mark source files as GPL-3.0-or-later to
preserve the option to relicense under later GPL versions.
2026-03-11 14:03:05 +01:00

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;
}
}