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

NotEmpty::isValid()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 11
ccs 6
cts 6
cp 1
rs 10
cc 2
nc 2
nop 1
crap 2
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