Result::setError()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
namespace BretRZaun\StatusPage;
3
4
class Result
5
{
6
    protected $success = true;
7
    protected $error;
8
    protected $label;
9
    protected $details;
10
11
    public function __construct(string $label)
12
    {
13
        $this->label = $label;
14
    }
15
16
    public function getLabel(): string
17
    {
18
        return $this->label;
19
    }
20
21
    public function setSuccess(bool $success): void
22
    {
23
        $this->success = $success;
24
    }
25
26
    /**
27
     * @deprecated
28
     */
29
    public function getSuccess(): bool
30
    {
31
        return $this->success;
32
    }
33
34
    public function isSuccess(): bool
35
    {
36
        return $this->success;
37
    }
38
39
    public function setError(string $error): void
40
    {
41
        $this->setSuccess(false);
42
        $this->error = $error;
43
    }
44
45
    public function getError(): ?string
46
    {
47
        return $this->error;
48
    }
49
50
    public function setDetails(string $details): void
51
    {
52
        $this->details = $details;
53
    }
54
55
    public function getDetails(): ?string
56
    {
57
        return $this->details;
58
    }
59
}
60