ErrorMessagesBase   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 26
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A errorMessage() 0 5 1
A pullErrorMessages() 0 5 1
1
<?php
2
declare(strict_types=1);
3
4
namespace InputGuard\Guards;
5
6
trait ErrorMessagesBase
7
{
8
    /**
9
     * @var array
10
     */
11
    private $errorMessages = [];
12
13
    abstract public function success(): bool;
14
15
    /**
16
     * @param string $message
17
     *
18
     * @return $this
19
     */
20 11
    public function errorMessage(string $message): self
21
    {
22 11
        $this->errorMessages[] = $message;
23
24 11
        return $this;
25
    }
26
27 10
    public function pullErrorMessages(): array
28
    {
29 10
        $this->success();
30
31 10
        return $this->errorMessages;
32
    }
33
}
34