Passed
Push — master ( d0729b...a733b3 )
by Derek Stephen
17:57
created

NotEmpty   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 3
eloc 8
c 3
b 0
f 1
dl 0
loc 20
ccs 8
cts 8
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isValid() 0 11 2
A getMessages() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Del\Form\Validator;
6
7
use Laminas\Validator\NotEmpty as ZfNotEmpty;
8
9
class NotEmpty implements ValidatorInterface
10
{
11
    private array $messages = [];
12
13 21
    public function isValid(mixed $value): bool
14
    {
15 21
        $validator = new  ZfNotEmpty();
16
17 21
        if ($validator->isValid($value)) {
18 11
            return true;
19
        }
20
21 15
        $this->messages = $validator->getMessages();
22
23 15
        return false;
24
    }
25
26 15
    public function getMessages(): array
27
    {
28 15
        return $this->messages;
29
    }
30
}
31