Issues (83)

src/Workflow/State.php (1 issue)

1
<?php
2
3
namespace ByTIC\Models\SmartProperties\Workflow;
4
5
/**
6
 * Class State
7
 * @package ByTIC\Models\SmartProperties\Workflow
8
 */
9
class State
10
{
11
    protected $name = null;
12
13
    /**
14
     * @return string
15
     */
16
    public function getName(): string
17
    {
18
        if ($this->name == null) {
19
            $this->initName();
20
        }
21
22
        return $this->name;
23
    }
24
25
    /**
26
     * @param null $name
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $name is correct as it would always require null to be passed?
Loading history...
27
     */
28
    public function setName($name): void
29
    {
30
        $this->name = $name;
31
    }
32
33
    protected function initName()
34
    {
35
        $this->setName($this->generateName());
36
    }
37
38
    protected function generateName()
39
    {
40
        throw new \Exception("State has not name set");
41
    }
42
43
    /**
44
     * @return string
45
     */
46
    public function __toString(): string
47
    {
48
        return $this->getName();
49
    }
50
}
51