Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
42.86% |
3 / 7 |
|
75.00% |
3 / 4 |
CRAP | |
0.00% |
0 / 1 |
DiscriminatorConfig | |
42.86% |
3 / 7 |
|
75.00% |
3 / 4 |
6.99 | |
0.00% |
0 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getDiscriminator | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getClassName | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
provideSchema | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | namespace Apie\Core\Other; |
3 | |
4 | use Apie\Core\Attributes\SchemaMethod; |
5 | |
6 | #[SchemaMethod('provideSchema')] |
7 | class DiscriminatorConfig |
8 | { |
9 | public function __construct(private string $discriminator, private string $className) |
10 | { |
11 | } |
12 | |
13 | public function getDiscriminator(): string |
14 | { |
15 | return $this->discriminator; |
16 | } |
17 | |
18 | public function getClassName(): string |
19 | { |
20 | return $this->className; |
21 | } |
22 | |
23 | /** |
24 | * @return array<string, mixed> |
25 | */ |
26 | public static function provideSchema(): array |
27 | { |
28 | return [ |
29 | 'type' => 'object', |
30 | 'additionalProperties' => true, |
31 | ]; |
32 | } |
33 | } |