Passed
Push — main ( e90e1a...b72a0a )
by Breno
01:52
created

EmptyString   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 6
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 6
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A evaluate() 0 3 2
1
<?php
2
declare(strict_types=1);
3
4
namespace BrenoRoosevelt\Validation\Rules;
5
6
use Attribute;
7
use BrenoRoosevelt\Validation\AbstractRule;
8
9
#[Attribute(Attribute::TARGET_PROPERTY|Attribute::TARGET_METHOD)]
10
class EmptyString extends AbstractRule
11
{
12
    protected function evaluate($input, array $context = []): bool
13
    {
14
        return (is_string($input) && mb_strlen(trim($input)) === 0);
15
    }
16
}
17