Total Complexity | 4 |
Total Lines | 53 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | abstract class AbstractConstraint extends Constraint implements ConstraintContract |
||
12 | { |
||
13 | /** |
||
14 | * The JsonApi-Structure constraint used to make the tests |
||
15 | * |
||
16 | * @var \VGirol\JsonApiStructure\Constraint\Constraint |
||
17 | */ |
||
18 | private $constraint; |
||
19 | |||
20 | /** |
||
21 | * Returns a string representation of the constraint. |
||
22 | * |
||
23 | * @return string |
||
24 | */ |
||
25 | 30 | public function toString(): string |
|
26 | { |
||
27 | 30 | return $this->constraint->toString(); |
|
28 | } |
||
29 | |||
30 | /** |
||
31 | * Evaluates the constraint for parameter $other. Returns true if the constraint is met, false otherwise. |
||
32 | * |
||
33 | * @param mixed $other value or object to evaluate |
||
34 | * |
||
35 | * @return boolean |
||
36 | */ |
||
37 | 51 | public function check($other): bool |
|
40 | } |
||
41 | |||
42 | /** |
||
43 | * Evaluates the constraint for parameter $other. Returns true if the constraint is met, false otherwise. |
||
44 | * |
||
45 | * @param mixed $other value or object to evaluate |
||
46 | * |
||
47 | * @return bool |
||
48 | */ |
||
49 | 48 | protected function matches($other): bool |
|
52 | } |
||
53 | |||
54 | /** |
||
55 | * Undocumented function |
||
56 | * |
||
57 | * @param \VGirol\JsonApiStructure\Constraint\Constraint $constraint |
||
58 | * |
||
59 | * @return void |
||
60 | */ |
||
61 | 51 | protected function setConstraint($constraint): void |
|
66 |