Passed
Push — master ( 1f27ac...52075a )
by Alexander
04:53 queued 02:24
created

EqualsEmpty   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A getOperator() 0 3 1
A toCriteriaArray() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Data\Reader\Filter;
6
7
use Yiisoft\Data\Reader\FilterInterface;
8
9
/**
10
 * `EqualsEmpty` filter defines a criteria for ensuring field value is empty.
11
 */
12
final class EqualsEmpty implements FilterInterface
13
{
14
    /**
15
     * @param string $field Name of the field to check.
16
     */
17 1
    public function __construct(private string $field)
18
    {
19 1
    }
20
21 1
    public function toCriteriaArray(): array
22
    {
23 1
        return [self::getOperator(), $this->field];
24
    }
25
26 105
    public static function getOperator(): string
27
    {
28 105
        return 'empty';
29
    }
30
}
31