Completed
Push — apply-code-style ( 1a43bf...37cc85 )
by
unknown
45:48
created

IsFieldEmpty   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 20
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
     *
25
     * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
26
     */
27
    public function __construct(string $fieldDefinitionIdentifier, bool $value = true)
28
    {
29
        parent::__construct($fieldDefinitionIdentifier, null, $value);
30
    }
31
32
    public function getSpecifications()
33
    {
34
        return [
35
            new Specifications(Operator::EQ, Specifications::FORMAT_SINGLE, Specifications::TYPE_BOOLEAN),
36
        ];
37
    }
38
}
39