Completed
Push — ezp-30936-edit-content-new-req... ( 953d44...df9d75 )
by
unknown
19:03
created

IsFieldEmpty   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getSpecifications() 0 6 1
1
<?php
2
3
/**
4
 * File containing the eZ\Publish\API\Repository\Values\Content\Query\Criterion\IsFieldEmpty class.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 */
9
declare(strict_types=1);
10
11
namespace eZ\Publish\API\Repository\Values\Content\Query\Criterion;
12
13
use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
14
use eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\Specifications;
15
16
/**
17
 * A criterion that matches content based on if Field is empty.
18
 */
19
class IsFieldEmpty extends Criterion
20
{
21
    /**
22
     * @param string $fieldDefinitionIdentifier
23
     * @param bool $value
24
     * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
25
     */
26
    public function __construct(string $fieldDefinitionIdentifier, bool $value = true)
27
    {
28
        parent::__construct($fieldDefinitionIdentifier, null, $value);
29
    }
30
31
    public function getSpecifications()
32
    {
33
        return [
34
            new Specifications(Operator::EQ, Specifications::FORMAT_SINGLE, Specifications::TYPE_BOOLEAN),
35
        ];
36
    }
37
}
38