Code Duplication    Length = 18-27 lines in 5 locations

eZ/Publish/API/Repository/Values/Content/Query/Criterion/IsFieldEmpty.php 1 location

@@ 19-37 (lines=19) @@
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

eZ/Publish/API/Repository/Values/Content/Query/Criterion/IsUserBased.php 1 location

@@ 14-34 (lines=21) @@
11
use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
12
use eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\Specifications;
13
14
class IsUserBased extends Criterion
15
{
16
    public function __construct(bool $value = true)
17
    {
18
        parent::__construct(null, null, $value);
19
    }
20
21
    /**
22
     * @return \eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\Specifications[]
23
     */
24
    public function getSpecifications(): array
25
    {
26
        return [
27
            new Specifications(
28
                Operator::EQ,
29
                Specifications::FORMAT_SINGLE,
30
                Specifications::TYPE_BOOLEAN
31
            ),
32
        ];
33
    }
34
}
35

eZ/Publish/API/Repository/Values/Content/Query/Criterion/IsUserEnabled.php 1 location

@@ 14-31 (lines=18) @@
11
use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
12
use eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\Specifications;
13
14
class IsUserEnabled extends Criterion
15
{
16
    public function __construct(bool $value = true)
17
    {
18
        parent::__construct(null, null, $value);
19
    }
20
21
    public function getSpecifications(): array
22
    {
23
        return [
24
            new Specifications(
25
                Operator::EQ,
26
                Specifications::FORMAT_SINGLE,
27
                Specifications::TYPE_BOOLEAN
28
            ),
29
        ];
30
    }
31
}
32

eZ/Publish/API/Repository/Values/Content/Query/Criterion/SectionIdentifier.php 1 location

@@ 14-40 (lines=27) @@
11
use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
12
use eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\Specifications;
13
14
class SectionIdentifier extends Criterion
15
{
16
    /**
17
     * @param string|string[] $value
18
     */
19
    public function __construct($value)
20
    {
21
        parent::__construct(null, null, $value);
22
    }
23
24
    /**
25
     * @return \eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\Specifications[]
26
     */
27
    public function getSpecifications(): array
28
    {
29
        return [
30
            new Specifications(
31
                Operator::IN,
32
                Specifications::FORMAT_ARRAY
33
            ),
34
            new Specifications(
35
                Operator::EQ,
36
                Specifications::FORMAT_SINGLE
37
            ),
38
        ];
39
    }
40
}
41

eZ/Publish/API/Repository/Values/Content/Query/Criterion/UserId.php 1 location

@@ 14-40 (lines=27) @@
11
use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
12
use eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\Specifications;
13
14
class UserId extends Criterion
15
{
16
    /**
17
     * @param int|int[] $value
18
     */
19
    public function __construct($value)
20
    {
21
        parent::__construct(null, null, $value);
22
    }
23
24
    /**
25
     * @return \eZ\Publish\API\Repository\Values\Content\Query\Criterion\Operator\Specifications[]
26
     */
27
    public function getSpecifications(): array
28
    {
29
        return [
30
            new Specifications(
31
                Operator::EQ,
32
                Specifications::FORMAT_SINGLE
33
            ),
34
            new Specifications(
35
                Operator::IN,
36
                Specifications::FORMAT_ARRAY
37
            ),
38
        ];
39
    }
40
}
41