Result::addError()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML2\Assertion\Validation;
6
7
/**
8
 * Simple Result object
9
 */
10
class Result
11
{
12
    /** @var array */
13
    private array $errors = [];
14
15
16
    /**
17
     * @param string $message
18
     */
19
    public function addError(string $message): void
20
    {
21
        $this->errors[] = $message;
22
    }
23
24
25
    /**
26
     * @return bool
27
     */
28
    public function isValid(): bool
29
    {
30
        return empty($this->errors);
31
    }
32
33
34
    /**
35
     * @return array
36
     */
37
    public function getErrors(): array
38
    {
39
        return $this->errors;
40
    }
41
}
42