Passed
Pull Request — master (#33)
by Melech
03:18
created

Asserter::getWarnings()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Valkyrja Framework package.
7
 *
8
 * (c) Melech Mizrachi <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Valkyrja\Test\Assert\Asserters;
15
16
use Valkyrja\Test\Assert\Asserter as Contract;
17
use Valkyrja\Test\Assert\Enums\ResultType;
18
use Valkyrja\Test\Exceptions\AssertFailureException;
19
use Valkyrja\Test\Exceptions\AssertWarningException;
20
use Valkyrja\Type\Support\Enum;
21
22
/**
23
 * Class Asserter.
24
 *
25
 * @author Melech Mizrachi
26
 */
27
abstract class Asserter implements Contract
28
{
29
    /**
30
     * The assertions.
31
     *
32
     * @var string[]
33
     */
34
    protected array $assertions = [];
35
36
    /**
37
     * The errors.
38
     *
39
     * @var AssertFailureException[]
40
     */
41
    protected array $errors = [];
42
43
    /**
44
     * The successes.
45
     *
46
     * @var string[]
47
     */
48
    protected array $successes = [];
49
50
    /**
51
     * The warnings.
52
     *
53
     * @var AssertWarningException[]
54
     */
55
    protected array $warnings = [];
56
57
    /**
58
     * @inheritDoc
59
     */
60
    public function getAssertions(): array
61
    {
62
        return $this->assertions;
63
    }
64
65
    /**
66
     * @inheritDoc
67
     */
68
    public function getErrors(): array
69
    {
70
        return $this->errors;
71
    }
72
73
    /**
74
     * @inheritDoc
75
     */
76
    public function getSuccesses(): array
77
    {
78
        return $this->successes;
79
    }
80
81
    /**
82
     * @inheritDoc
83
     */
84
    public function getWarnings(): array
85
    {
86
        return $this->warnings;
87
    }
88
89
    /**
90
     * @inheritDoc
91
     */
92
    public function __get(string $name): mixed
93
    {
94
        if (Enum::isValidName(ResultType::class, $name)) {
95
            return $this->$name;
96
        }
97
98
        return null;
99
    }
100
}
101