Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
ExampleSchema | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | n/a |
0 / 0 |
1 | <?php |
2 | |
3 | declare( strict_types = 1 ); |
4 | |
5 | namespace MediaWiki\Extension\CommunityConfigurationExample\Config\Schemas; |
6 | |
7 | use MediaWiki\Extension\CommunityConfiguration\Schema\JsonSchema; |
8 | use MediaWiki\Extension\CommunityConfiguration\Schemas\MediaWiki\MediaWikiDefinitions; |
9 | |
10 | // phpcs:disable Generic.NamingConventions.UpperCaseConstantName.ClassConstantNotUpperCase |
11 | class ExampleSchema extends JsonSchema { |
12 | public const VERSION = '1.0.0'; |
13 | |
14 | public const CCExample_String = [ |
15 | self::TYPE => self::TYPE_STRING, |
16 | self::DEFAULT => '', |
17 | self::MAX_LENGTH => 50, |
18 | ]; |
19 | |
20 | public const CCExample_Numbers = [ |
21 | self::TYPE => self::TYPE_OBJECT, |
22 | self::PROPERTIES => [ |
23 | 'IntegerNumber' => [ |
24 | self::TYPE => self::TYPE_INTEGER, |
25 | self::DEFAULT => 0, |
26 | self::MINIMUM => 0, |
27 | self::MAXIMUM => 42, |
28 | ], |
29 | 'DecimalNumber' => [ |
30 | self::TYPE => self::TYPE_NUMBER, |
31 | self::DEFAULT => 0.6, |
32 | self::MINIMUM => 0.0, |
33 | self::MAXIMUM => 1.0, |
34 | self::MULTIPLE_OF => 0.01, |
35 | ], |
36 | ], |
37 | ]; |
38 | |
39 | public const CCExample_FavoriteColors = [ |
40 | self::TYPE => self::TYPE_ARRAY, |
41 | self::DEFAULT => [], |
42 | self::ITEMS => [ |
43 | self::ENUM => [ |
44 | 'crimson', |
45 | 'firebrick', |
46 | 'gold', |
47 | 'tomato', |
48 | 'moccasin', |
49 | 'peachpuff', |
50 | 'mediumseagreen', |
51 | 'lime', |
52 | 'teal', |
53 | 'torquoise', |
54 | 'cyan', |
55 | 'midnightblue', |
56 | 'rebeccapurple', |
57 | 'navajowhite', |
58 | ], |
59 | self::TYPE => self::TYPE_STRING, |
60 | ], |
61 | self::MAX_ITEMS => 3, |
62 | ]; |
63 | |
64 | public const CCExample_RelevantPages = [ |
65 | self::TYPE => self::TYPE_ARRAY, |
66 | self::DEFAULT => [], |
67 | self::ITEMS => [ |
68 | self::TYPE => self::TYPE_OBJECT, |
69 | self::PROPERTIES => [ |
70 | 'title' => [ |
71 | self::REF => [ |
72 | 'class' => MediaWikiDefinitions::class, |
73 | 'field' => 'PageTitle', |
74 | ], |
75 | // TODO: this does not work! |
76 | self::MIN_LENGTH => 1, |
77 | ], |
78 | 'text' => [ |
79 | self::TYPE => self::TYPE_STRING, |
80 | self::MIN_LENGTH => 1, |
81 | ], |
82 | ], |
83 | self::REQUIRED => [ 'title', 'text' ], |
84 | ], |
85 | ]; |
86 | } |