Passed
Pull Request — master (#33)
by Melech
05:51 queued 02:35
created

Asserter::getSuccesses()   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\Type\Support\Enum;
20
21
/**
22
 * Class Asserter.
23
 *
24
 * @author Melech Mizrachi
25
 */
26
abstract class Asserter implements Contract
27
{
28
    /**
29
     * The assertions.
30
     *
31
     * @var string[]
32
     */
33
    protected array $assertions = [];
34
35
    /**
36
     * The errors.
37
     *
38
     * @var AssertFailureException[]
39
     */
40
    protected array $errors = [];
41
42
    /**
43
     * The successes.
44
     *
45
     * @var string[]
46
     */
47
    protected array $successes = [];
48
49
    /**
50
     * The warnings.
51
     *
52
     * @var string[]
53
     */
54
    protected array $warnings = [];
55
56
    /**
57
     * @inheritDoc
58
     */
59
    public function getAssertions(): array
60
    {
61
        return $this->assertions;
62
    }
63
64
    /**
65
     * @inheritDoc
66
     */
67
    public function getErrors(): array
68
    {
69
        return $this->errors;
70
    }
71
72
    /**
73
     * @inheritDoc
74
     */
75
    public function getSuccesses(): array
76
    {
77
        return $this->successes;
78
    }
79
80
    /**
81
     * @inheritDoc
82
     */
83
    public function getWarnings(): array
84
    {
85
        return $this->warnings;
86
    }
87
88
    /**
89
     * @inheritDoc
90
     */
91
    public function __get(string $name): mixed
92
    {
93
        if (Enum::isValidName(ResultType::class, $name)) {
94
            return $this->$name;
95
        }
96
97
        return null;
98
    }
99
}
100