Commit 9b6ebfe
Refactor to simplify the public API and make adding features easier (#351)
This commit makes the following changes:
* Split the Constraint class to make Validator independent from it
* Add Validator::validate() as the main entry point
* Turn Validator::coerce() and Validator::check() into aliases
* Add Factory::setConfig(), getConfig(), addConfig() & removeConfig()
* Make type-coercion a checkMode option, don't pass $coerce everywhere
* Add some extra tests1 parent 325a0f8 commit 9b6ebfe
File tree
25 files changed
+348
-272
lines changed- src/JsonSchema
- Constraints
- Exception
- tests
- Constraints
- Uri
25 files changed
+348
-272
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
| 26 | + | |
40 | 27 | | |
41 | 28 | | |
42 | 29 | | |
| |||
61 | 48 | | |
62 | 49 | | |
63 | 50 | | |
64 | | - | |
| 51 | + | |
65 | 52 | | |
66 | 53 | | |
67 | 54 | | |
| |||
72 | 59 | | |
73 | 60 | | |
74 | 61 | | |
75 | | - | |
76 | 62 | | |
77 | | - | |
| 63 | + | |
78 | 64 | | |
79 | 65 | | |
80 | 66 | | |
| |||
90 | 76 | | |
91 | 77 | | |
92 | 78 | | |
93 | | - | |
| 79 | + | |
94 | 80 | | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
102 | 84 | | |
103 | | - | |
| 85 | + | |
104 | 86 | | |
| 87 | + | |
| 88 | + | |
105 | 89 | | |
106 | 90 | | |
107 | 91 | | |
108 | | - | |
| 92 | + | |
109 | 93 | | |
110 | 94 | | |
111 | 95 | | |
112 | | - | |
| 96 | + | |
113 | 97 | | |
114 | 98 | | |
115 | 99 | | |
| |||
124 | 108 | | |
125 | 109 | | |
126 | 110 | | |
| 111 | + | |
| 112 | + | |
127 | 113 | | |
128 | 114 | | |
129 | 115 | | |
130 | | - | |
| 116 | + | |
131 | 117 | | |
132 | | - | |
| 118 | + | |
133 | 119 | | |
134 | 120 | | |
135 | 121 | | |
136 | 122 | | |
137 | | - | |
| 123 | + | |
138 | 124 | | |
139 | 125 | | |
140 | 126 | | |
141 | 127 | | |
142 | 128 | | |
143 | 129 | | |
144 | | - | |
| 130 | + | |
145 | 131 | | |
146 | 132 | | |
147 | 133 | | |
| 134 | + | |
| 135 | + | |
148 | 136 | | |
149 | 137 | | |
150 | 138 | | |
151 | 139 | | |
152 | | - | |
| 140 | + | |
| 141 | + | |
153 | 142 | | |
154 | 143 | | |
155 | 144 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | | - | |
26 | 25 | | |
27 | 26 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
98 | 32 | | |
99 | 33 | | |
100 | 34 | | |
| |||
123 | 57 | | |
124 | 58 | | |
125 | 59 | | |
126 | | - | |
127 | 60 | | |
128 | | - | |
| 61 | + | |
129 | 62 | | |
130 | 63 | | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
| 64 | + | |
136 | 65 | | |
137 | 66 | | |
138 | 67 | | |
| |||
145 | 74 | | |
146 | 75 | | |
147 | 76 | | |
148 | | - | |
149 | 77 | | |
150 | | - | |
| 78 | + | |
151 | 79 | | |
152 | 80 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
| 81 | + | |
158 | 82 | | |
159 | 83 | | |
160 | 84 | | |
| |||
166 | 90 | | |
167 | 91 | | |
168 | 92 | | |
169 | | - | |
170 | 93 | | |
171 | | - | |
| 94 | + | |
172 | 95 | | |
173 | 96 | | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
| 97 | + | |
179 | 98 | | |
180 | 99 | | |
181 | 100 | | |
| |||
187 | 106 | | |
188 | 107 | | |
189 | 108 | | |
190 | | - | |
191 | 109 | | |
192 | | - | |
| 110 | + | |
193 | 111 | | |
194 | 112 | | |
195 | 113 | | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
| 114 | + | |
201 | 115 | | |
202 | 116 | | |
203 | 117 | | |
| |||
0 commit comments