Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
6 / 6
CRAP
100.00% covered (success)
100.00%
1 / 1
ValuesCriterion
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
6 / 6
6
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getField
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getValues
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getCheck
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 shouldApply
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getTargetEntity
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace App\Specification\Criterion;
4
5use App\Entity\GrammaticalRole;
6use App\Entity\Word;
7
8/**
9 * @author Wilhelm Zwertvaegher
10 */
11readonly class ValuesCriterion implements Criterion
12{
13    /**
14     * @param class-string<Word|GrammaticalRole> $targetEntity
15     * @param list<mixed>                        $values
16     */
17    public function __construct(
18        private string $targetEntity,
19        private string $field,
20        private array $values,
21        private ValuesCriterionCheck $check,
22    ) {
23    }
24
25    public function getField(): string
26    {
27        return $this->field;
28    }
29
30    /**
31     * @return list<mixed>
32     */
33    public function getValues(): array
34    {
35        return $this->values;
36    }
37
38    public function getCheck(): ValuesCriterionCheck
39    {
40        return $this->check;
41    }
42
43    public function shouldApply(): bool
44    {
45        return count($this->values) > 0;
46    }
47
48    public function getTargetEntity(): string
49    {
50        return $this->targetEntity;
51    }
52}