NotBlankConstraint::validate()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Kuperwood\Eav\Validation\Constraints;
4
5
use Kuperwood\Eav\Interfaces\ConstraintInterface;
6
7
class NotBlankConstraint implements ConstraintInterface
8
{
9 1
    public function validate($value): ?string
10
    {
11 1
        if (trim($value) === '') {
12 1
            return "This value cannot be blank.";
13
        }
14 1
        return null;
15
    }
16
}