summaryrefslogtreecommitdiffstats
path: root/library/Icingadb/Command/Object/CommandAuthor.php
blob: f323b6331fdb1aafb7ba1ac9d9062fb67bf65f07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?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
     */
    public function setAuthor(string $author): self
    {
        $this->author = $author;

        return $this;
    }

    /**
     * Get the author
     *
     * @return string
     */
    public function getAuthor(): string
    {
        if ($this->author === null) {
            throw new \LogicException(
                'You are accessing an unset property. Please make sure to set it beforehand.'
            );
        }

        return $this->author;
    }
}