Total Complexity | 1 |
Total Lines | 91 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
7 | class ApiDataChecker |
||
8 | { |
||
9 | const SCHEMA = [ |
||
10 | 'root' => [ |
||
11 | 'authors' => [ |
||
12 | '_type' => 'nested_array', |
||
13 | 'first_name' => [ |
||
14 | '_type' => 'string' |
||
15 | ], |
||
16 | 'last_name' => [ |
||
17 | '_type' => 'required_string' |
||
18 | ], |
||
19 | 'orcid' => [ |
||
20 | '_type' => 'string' |
||
21 | ], |
||
22 | 'affiliation' => [ |
||
23 | '_type' => 'array' |
||
24 | ], |
||
25 | ], |
||
26 | 'identifiers' => [ |
||
27 | '_type' => 'nested_array', |
||
28 | 'value' => [ |
||
29 | '_type' => 'required_string' |
||
30 | ], |
||
31 | 'type' => [ |
||
32 | '_type' => 'required_string' |
||
33 | ], |
||
34 | ], |
||
35 | 'journal' => [ |
||
36 | '_type' => 'array', |
||
37 | 'title' => [ |
||
38 | '_type' => 'string' |
||
39 | ], |
||
40 | 'issn' => [ |
||
41 | '_type' => 'array' |
||
42 | ], |
||
43 | 'publisher' => [ |
||
44 | '_type' => 'string' |
||
45 | ], |
||
46 | ], |
||
47 | 'publication' => [ |
||
48 | '_type' => 'required_array', |
||
49 | 'title' => [ |
||
50 | '_type' => 'required_string' |
||
51 | ], |
||
52 | 'abstract' => [ |
||
53 | '_type' => 'string' |
||
54 | ], |
||
55 | 'url' => [ |
||
56 | '_type' => 'required_string' |
||
57 | ], |
||
58 | 'published_at' => [ |
||
59 | '_type' => 'string' |
||
60 | ], |
||
61 | ], |
||
62 | 'types' => [ |
||
63 | '_type' => 'nested_array', |
||
64 | 'name' => [ |
||
65 | '_type' => 'string' |
||
66 | ], |
||
67 | ], |
||
68 | 'tags' => [ |
||
69 | '_type' => 'nested_array', |
||
70 | 'name' => [ |
||
71 | '_type' => 'string' |
||
72 | ], |
||
73 | ], |
||
74 | 'updates' => [ |
||
75 | '_type' => 'array', |
||
76 | 'timestamp' => [ |
||
77 | '_type' => 'string' |
||
78 | ], |
||
79 | 'identifier' => [ |
||
80 | '_type' => 'array', |
||
81 | 'doi' => [ |
||
82 | '_type' => 'string' |
||
83 | ] |
||
84 | ], |
||
85 | 'type' => [ |
||
86 | '_type' => 'string' |
||
87 | ] |
||
88 | ] |
||
89 | ] |
||
90 | ]; |
||
91 | |||
92 | public static function check($data) |
||
100 |