Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
71.43% |
5 / 7 |
|
71.43% |
5 / 7 |
CRAP | |
0.00% |
0 / 1 |
| DatePeriodOptions | |
71.43% |
5 / 7 |
|
71.43% |
5 / 7 |
8.14 | |
0.00% |
0 / 1 |
| getAttributes | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| isRequired | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| isField | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| appliesToContext | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getFieldPriority | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getTypehint | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| allowsNull | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Apie\Core\Metadata\Fields; |
| 3 | |
| 4 | use Apie\Core\Context\ApieContext; |
| 5 | use Apie\TypeConverter\ReflectionTypeFactory; |
| 6 | use ReflectionType; |
| 7 | |
| 8 | /** |
| 9 | * DatePeriod::$options has incorrect reflection metadata, so we need to override it. |
| 10 | */ |
| 11 | class DatePeriodOptions implements FieldInterface |
| 12 | { |
| 13 | public function getAttributes( |
| 14 | string $attributeClass, |
| 15 | bool $classDocBlock = true, |
| 16 | bool $propertyDocblock = true, |
| 17 | bool $argumentDocBlock = true |
| 18 | ): array { |
| 19 | return []; |
| 20 | } |
| 21 | |
| 22 | public function isRequired(): bool |
| 23 | { |
| 24 | return false; |
| 25 | } |
| 26 | |
| 27 | public function isField(): bool |
| 28 | { |
| 29 | return true; |
| 30 | } |
| 31 | |
| 32 | public function appliesToContext(ApieContext $apieContext): bool |
| 33 | { |
| 34 | return true; |
| 35 | } |
| 36 | public function getFieldPriority(): ?int |
| 37 | { |
| 38 | return -1; |
| 39 | } |
| 40 | |
| 41 | public function getTypehint(): ?ReflectionType |
| 42 | { |
| 43 | return ReflectionTypeFactory::createReflectionType('int'); |
| 44 | } |
| 45 | |
| 46 | public function allowsNull(): bool |
| 47 | { |
| 48 | return false; |
| 49 | } |
| 50 | } |