ValidationResult::everythingIsOk()   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
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace BrenoRoosevelt\Validation;
5
6
class ValidationResult implements Result
7
{
8
    /** @var string[] */
9
    private array $errors = [];
10
11
    public static function everythingIsOk(): self
12
    {
13
        return new self;
14
    }
15
16
    public function error(string ...$errors): self
17
    {
18
        array_push($this->errors, ...$errors);
19
        return $this;
20
    }
21
22
    /**
23
     * @inheritDoc
24
     */
25
    public function isOk(): bool
26
    {
27
        return empty($this->errors);
28
    }
29
30
    /**
31
     * @inheritDoc
32
     */
33
    public function getErrors(): array
34
    {
35
        return $this->errors;
36
    }
37
}
38