@@ -38,87 +38,87 @@ |
||
38 | 38 | public const RESULTS_SOURCE = 'WBQC_ResultsSource'; |
39 | 39 | public const EXPIRY_LOCK = 'WBQC_ExpiryLock'; |
40 | 40 | |
41 | - private static function getService( ?MediaWikiServices $services, $name ) { |
|
42 | - if ( $services === null ) { |
|
41 | + private static function getService(?MediaWikiServices $services, $name) { |
|
42 | + if ($services === null) { |
|
43 | 43 | $services = MediaWikiServices::getInstance(); |
44 | 44 | } |
45 | - return $services->getService( $name ); |
|
45 | + return $services->getService($name); |
|
46 | 46 | } |
47 | 47 | |
48 | - public static function getLoggingHelper( MediaWikiServices $services = null ): LoggingHelper { |
|
49 | - return self::getService( $services, self::LOGGING_HELPER ); |
|
48 | + public static function getLoggingHelper(MediaWikiServices $services = null): LoggingHelper { |
|
49 | + return self::getService($services, self::LOGGING_HELPER); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | public static function getConstraintStore( |
53 | 53 | MediaWikiServices $services = null |
54 | 54 | ): ConstraintStore { |
55 | - return self::getService( $services, self::CONSTRAINT_STORE ); |
|
55 | + return self::getService($services, self::CONSTRAINT_STORE); |
|
56 | 56 | } |
57 | 57 | |
58 | - public static function getConstraintLookup( MediaWikiServices $services = null ): ConstraintLookup { |
|
59 | - return self::getService( $services, self::CONSTRAINT_LOOKUP ); |
|
58 | + public static function getConstraintLookup(MediaWikiServices $services = null): ConstraintLookup { |
|
59 | + return self::getService($services, self::CONSTRAINT_LOOKUP); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | public static function getCheckResultSerializer( |
63 | 63 | MediaWikiServices $services = null |
64 | 64 | ): CheckResultSerializer { |
65 | - return self::getService( $services, self::CHECK_RESULT_SERIALIZER ); |
|
65 | + return self::getService($services, self::CHECK_RESULT_SERIALIZER); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | public static function getCheckResultDeserializer( |
69 | 69 | MediaWikiServices $services = null |
70 | 70 | ): CheckResultDeserializer { |
71 | - return self::getService( $services, self::CHECK_RESULT_DESERIALIZER ); |
|
71 | + return self::getService($services, self::CHECK_RESULT_DESERIALIZER); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | public static function getViolationMessageSerializer( |
75 | 75 | MediaWikiServices $services = null |
76 | 76 | ): ViolationMessageSerializer { |
77 | - return self::getService( $services, self::VIOLATION_MESSAGE_SERIALIZER ); |
|
77 | + return self::getService($services, self::VIOLATION_MESSAGE_SERIALIZER); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | public static function getViolationMessageDeserializer( |
81 | 81 | MediaWikiServices $services = null |
82 | 82 | ): ViolationMessageDeserializer { |
83 | - return self::getService( $services, self::VIOLATION_MESSAGE_DESERIALIZER ); |
|
83 | + return self::getService($services, self::VIOLATION_MESSAGE_DESERIALIZER); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | public static function getConstraintParameterParser( |
87 | 87 | MediaWikiServices $services = null |
88 | 88 | ): ConstraintParameterParser { |
89 | - return self::getService( $services, self::CONSTRAINT_PARAMETER_PARSER ); |
|
89 | + return self::getService($services, self::CONSTRAINT_PARAMETER_PARSER); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | public static function getConnectionCheckerHelper( |
93 | 93 | MediaWikiServices $services = null |
94 | 94 | ): ConnectionCheckerHelper { |
95 | - return self::getService( $services, self::CONNECTION_CHECKER_HELPER ); |
|
95 | + return self::getService($services, self::CONNECTION_CHECKER_HELPER); |
|
96 | 96 | } |
97 | 97 | |
98 | - public static function getRangeCheckerHelper( MediaWikiServices $services = null ): RangeCheckerHelper { |
|
99 | - return self::getService( $services, self::RANGE_CHECKER_HELPER ); |
|
98 | + public static function getRangeCheckerHelper(MediaWikiServices $services = null): RangeCheckerHelper { |
|
99 | + return self::getService($services, self::RANGE_CHECKER_HELPER); |
|
100 | 100 | } |
101 | 101 | |
102 | - public static function getSparqlHelper( MediaWikiServices $services = null ): SparqlHelper { |
|
103 | - return self::getService( $services, self::SPARQL_HELPER ); |
|
102 | + public static function getSparqlHelper(MediaWikiServices $services = null): SparqlHelper { |
|
103 | + return self::getService($services, self::SPARQL_HELPER); |
|
104 | 104 | } |
105 | 105 | |
106 | - public static function getTypeCheckerHelper( MediaWikiServices $services = null ): TypeCheckerHelper { |
|
107 | - return self::getService( $services, self::TYPE_CHECKER_HELPER ); |
|
106 | + public static function getTypeCheckerHelper(MediaWikiServices $services = null): TypeCheckerHelper { |
|
107 | + return self::getService($services, self::TYPE_CHECKER_HELPER); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | public static function getDelegatingConstraintChecker( |
111 | 111 | MediaWikiServices $services = null |
112 | 112 | ): DelegatingConstraintChecker { |
113 | - return self::getService( $services, self::DELEGATING_CONSTRAINT_CHECKER ); |
|
113 | + return self::getService($services, self::DELEGATING_CONSTRAINT_CHECKER); |
|
114 | 114 | } |
115 | 115 | |
116 | - public static function getResultsSource( MediaWikiServices $services = null ): ResultsSource { |
|
117 | - return self::getService( $services, self::RESULTS_SOURCE ); |
|
116 | + public static function getResultsSource(MediaWikiServices $services = null): ResultsSource { |
|
117 | + return self::getService($services, self::RESULTS_SOURCE); |
|
118 | 118 | } |
119 | 119 | |
120 | - public static function getExpiryLock( MediaWikiServices $services = null ): ExpiryLock { |
|
121 | - return self::getService( $services, self::EXPIRY_LOCK ); |
|
120 | + public static function getExpiryLock(MediaWikiServices $services = null): ExpiryLock { |
|
121 | + return self::getService($services, self::EXPIRY_LOCK); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | } |
@@ -40,243 +40,243 @@ |
||
40 | 40 | public const PROPERTY_SCOPE_CHECKER = 'WBQC_PropertyScopeChecker'; |
41 | 41 | public const CONTEMPORARY_CHECKER = 'WBQC_ContemporaryChecker'; |
42 | 42 | |
43 | - private static function getService( ?MediaWikiServices $services, $name ) { |
|
44 | - if ( $services === null ) { |
|
43 | + private static function getService(?MediaWikiServices $services, $name) { |
|
44 | + if ($services === null) { |
|
45 | 45 | $services = MediaWikiServices::getInstance(); |
46 | 46 | } |
47 | - return $services->getService( $name ); |
|
47 | + return $services->getService($name); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
51 | 51 | * @param MediaWikiServices|null $services |
52 | 52 | * @return ConstraintChecker |
53 | 53 | */ |
54 | - public static function getConflictsWithChecker( MediaWikiServices $services = null ) { |
|
55 | - return self::getService( $services, self::CONFLICTS_WITH_CHECKER ); |
|
54 | + public static function getConflictsWithChecker(MediaWikiServices $services = null) { |
|
55 | + return self::getService($services, self::CONFLICTS_WITH_CHECKER); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
59 | 59 | * @param MediaWikiServices|null $services |
60 | 60 | * @return ConstraintChecker |
61 | 61 | */ |
62 | - public static function getItemChecker( MediaWikiServices $services = null ) { |
|
63 | - return self::getService( $services, self::ITEM_CHECKER ); |
|
62 | + public static function getItemChecker(MediaWikiServices $services = null) { |
|
63 | + return self::getService($services, self::ITEM_CHECKER); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
67 | 67 | * @param MediaWikiServices|null $services |
68 | 68 | * @return ConstraintChecker |
69 | 69 | */ |
70 | - public static function getTargetRequiredClaimChecker( MediaWikiServices $services = null ) { |
|
71 | - return self::getService( $services, self::TARGET_REQUIRED_CLAIM_CHECKER ); |
|
70 | + public static function getTargetRequiredClaimChecker(MediaWikiServices $services = null) { |
|
71 | + return self::getService($services, self::TARGET_REQUIRED_CLAIM_CHECKER); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
75 | 75 | * @param MediaWikiServices|null $services |
76 | 76 | * @return ConstraintChecker |
77 | 77 | */ |
78 | - public static function getSymmetricChecker( MediaWikiServices $services = null ) { |
|
79 | - return self::getService( $services, self::SYMMETRIC_CHECKER ); |
|
78 | + public static function getSymmetricChecker(MediaWikiServices $services = null) { |
|
79 | + return self::getService($services, self::SYMMETRIC_CHECKER); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
83 | 83 | * @param MediaWikiServices|null $services |
84 | 84 | * @return ConstraintChecker |
85 | 85 | */ |
86 | - public static function getInverseChecker( MediaWikiServices $services = null ) { |
|
87 | - return self::getService( $services, self::INVERSE_CHECKER ); |
|
86 | + public static function getInverseChecker(MediaWikiServices $services = null) { |
|
87 | + return self::getService($services, self::INVERSE_CHECKER); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
91 | 91 | * @param MediaWikiServices|null $services |
92 | 92 | * @return ConstraintChecker |
93 | 93 | */ |
94 | - public static function getQualifierChecker( MediaWikiServices $services = null ) { |
|
95 | - return self::getService( $services, self::QUALIFIER_CHECKER ); |
|
94 | + public static function getQualifierChecker(MediaWikiServices $services = null) { |
|
95 | + return self::getService($services, self::QUALIFIER_CHECKER); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
99 | 99 | * @param MediaWikiServices|null $services |
100 | 100 | * @return ConstraintChecker |
101 | 101 | */ |
102 | - public static function getQualifiersChecker( MediaWikiServices $services = null ) { |
|
103 | - return self::getService( $services, self::QUALIFIERS_CHECKER ); |
|
102 | + public static function getQualifiersChecker(MediaWikiServices $services = null) { |
|
103 | + return self::getService($services, self::QUALIFIERS_CHECKER); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
107 | 107 | * @param MediaWikiServices|null $services |
108 | 108 | * @return ConstraintChecker |
109 | 109 | */ |
110 | - public static function getMandatoryQualifiersChecker( MediaWikiServices $services = null ) { |
|
111 | - return self::getService( $services, self::MANDATORY_QUALIFIERS_CHECKER ); |
|
110 | + public static function getMandatoryQualifiersChecker(MediaWikiServices $services = null) { |
|
111 | + return self::getService($services, self::MANDATORY_QUALIFIERS_CHECKER); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
115 | 115 | * @param MediaWikiServices|null $services |
116 | 116 | * @return ConstraintChecker |
117 | 117 | */ |
118 | - public static function getRangeChecker( MediaWikiServices $services = null ) { |
|
119 | - return self::getService( $services, self::RANGE_CHECKER ); |
|
118 | + public static function getRangeChecker(MediaWikiServices $services = null) { |
|
119 | + return self::getService($services, self::RANGE_CHECKER); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
123 | 123 | * @param MediaWikiServices|null $services |
124 | 124 | * @return ConstraintChecker |
125 | 125 | */ |
126 | - public static function getDiffWithinRangeChecker( MediaWikiServices $services = null ) { |
|
127 | - return self::getService( $services, self::DIFF_WITHIN_RANGE_CHECKER ); |
|
126 | + public static function getDiffWithinRangeChecker(MediaWikiServices $services = null) { |
|
127 | + return self::getService($services, self::DIFF_WITHIN_RANGE_CHECKER); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
131 | 131 | * @param MediaWikiServices|null $services |
132 | 132 | * @return ConstraintChecker |
133 | 133 | */ |
134 | - public static function getTypeChecker( MediaWikiServices $services = null ) { |
|
135 | - return self::getService( $services, self::TYPE_CHECKER ); |
|
134 | + public static function getTypeChecker(MediaWikiServices $services = null) { |
|
135 | + return self::getService($services, self::TYPE_CHECKER); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
139 | 139 | * @param MediaWikiServices|null $services |
140 | 140 | * @return ConstraintChecker |
141 | 141 | */ |
142 | - public static function getValueTypeChecker( MediaWikiServices $services = null ) { |
|
143 | - return self::getService( $services, self::VALUE_TYPE_CHECKER ); |
|
142 | + public static function getValueTypeChecker(MediaWikiServices $services = null) { |
|
143 | + return self::getService($services, self::VALUE_TYPE_CHECKER); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
147 | 147 | * @param MediaWikiServices|null $services |
148 | 148 | * @return ConstraintChecker |
149 | 149 | */ |
150 | - public static function getSingleValueChecker( MediaWikiServices $services = null ) { |
|
151 | - return self::getService( $services, self::SINGLE_VALUE_CHECKER ); |
|
150 | + public static function getSingleValueChecker(MediaWikiServices $services = null) { |
|
151 | + return self::getService($services, self::SINGLE_VALUE_CHECKER); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
155 | 155 | * @param MediaWikiServices|null $services |
156 | 156 | * @return ConstraintChecker |
157 | 157 | */ |
158 | - public static function getMultiValueChecker( MediaWikiServices $services = null ) { |
|
159 | - return self::getService( $services, self::MULTI_VALUE_CHECKER ); |
|
158 | + public static function getMultiValueChecker(MediaWikiServices $services = null) { |
|
159 | + return self::getService($services, self::MULTI_VALUE_CHECKER); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
163 | 163 | * @param MediaWikiServices|null $services |
164 | 164 | * @return ConstraintChecker |
165 | 165 | */ |
166 | - public static function getUniqueValueChecker( MediaWikiServices $services = null ) { |
|
167 | - return self::getService( $services, self::UNIQUE_VALUE_CHECKER ); |
|
166 | + public static function getUniqueValueChecker(MediaWikiServices $services = null) { |
|
167 | + return self::getService($services, self::UNIQUE_VALUE_CHECKER); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
171 | 171 | * @param MediaWikiServices|null $services |
172 | 172 | * @return ConstraintChecker |
173 | 173 | */ |
174 | - public static function getFormatChecker( MediaWikiServices $services = null ) { |
|
175 | - return self::getService( $services, self::FORMAT_CHECKER ); |
|
174 | + public static function getFormatChecker(MediaWikiServices $services = null) { |
|
175 | + return self::getService($services, self::FORMAT_CHECKER); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
179 | 179 | * @param MediaWikiServices|null $services |
180 | 180 | * @return ConstraintChecker |
181 | 181 | */ |
182 | - public static function getCommonsLinkChecker( MediaWikiServices $services = null ) { |
|
183 | - return self::getService( $services, self::COMMONS_LINK_CHECKER ); |
|
182 | + public static function getCommonsLinkChecker(MediaWikiServices $services = null) { |
|
183 | + return self::getService($services, self::COMMONS_LINK_CHECKER); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | /** |
187 | 187 | * @param MediaWikiServices|null $services |
188 | 188 | * @return ConstraintChecker |
189 | 189 | */ |
190 | - public static function getOneOfChecker( MediaWikiServices $services = null ) { |
|
191 | - return self::getService( $services, self::ONE_OF_CHECKER ); |
|
190 | + public static function getOneOfChecker(MediaWikiServices $services = null) { |
|
191 | + return self::getService($services, self::ONE_OF_CHECKER); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
195 | 195 | * @param MediaWikiServices|null $services |
196 | 196 | * @return ConstraintChecker |
197 | 197 | */ |
198 | - public static function getValueOnlyChecker( MediaWikiServices $services = null ) { |
|
199 | - return self::getService( $services, self::VALUE_ONLY_CHECKER ); |
|
198 | + public static function getValueOnlyChecker(MediaWikiServices $services = null) { |
|
199 | + return self::getService($services, self::VALUE_ONLY_CHECKER); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
203 | 203 | * @param MediaWikiServices|null $services |
204 | 204 | * @return ConstraintChecker |
205 | 205 | */ |
206 | - public static function getReferenceChecker( MediaWikiServices $services = null ) { |
|
207 | - return self::getService( $services, self::REFERENCE_CHECKER ); |
|
206 | + public static function getReferenceChecker(MediaWikiServices $services = null) { |
|
207 | + return self::getService($services, self::REFERENCE_CHECKER); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
211 | 211 | * @param MediaWikiServices|null $services |
212 | 212 | * @return ConstraintChecker |
213 | 213 | */ |
214 | - public static function getNoBoundsChecker( MediaWikiServices $services = null ) { |
|
215 | - return self::getService( $services, self::NO_BOUNDS_CHECKER ); |
|
214 | + public static function getNoBoundsChecker(MediaWikiServices $services = null) { |
|
215 | + return self::getService($services, self::NO_BOUNDS_CHECKER); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
219 | 219 | * @param MediaWikiServices|null $services |
220 | 220 | * @return ConstraintChecker |
221 | 221 | */ |
222 | - public static function getAllowedUnitsChecker( MediaWikiServices $services = null ) { |
|
223 | - return self::getService( $services, self::ALLOWED_UNITS_CHECKER ); |
|
222 | + public static function getAllowedUnitsChecker(MediaWikiServices $services = null) { |
|
223 | + return self::getService($services, self::ALLOWED_UNITS_CHECKER); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | /** |
227 | 227 | * @param MediaWikiServices|null $services |
228 | 228 | * @return ConstraintChecker |
229 | 229 | */ |
230 | - public static function getSingleBestValueChecker( MediaWikiServices $services = null ) { |
|
231 | - return self::getService( $services, self::SINGLE_BEST_VALUE_CHECKER ); |
|
230 | + public static function getSingleBestValueChecker(MediaWikiServices $services = null) { |
|
231 | + return self::getService($services, self::SINGLE_BEST_VALUE_CHECKER); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | /** |
235 | 235 | * @param MediaWikiServices|null $services |
236 | 236 | * @return ConstraintChecker |
237 | 237 | */ |
238 | - public static function getEntityTypeChecker( MediaWikiServices $services = null ) { |
|
239 | - return self::getService( $services, self::ENTITY_TYPE_CHECKER ); |
|
238 | + public static function getEntityTypeChecker(MediaWikiServices $services = null) { |
|
239 | + return self::getService($services, self::ENTITY_TYPE_CHECKER); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
243 | 243 | * @param MediaWikiServices|null $services |
244 | 244 | * @return ConstraintChecker |
245 | 245 | */ |
246 | - public static function getNoneOfChecker( MediaWikiServices $services = null ) { |
|
247 | - return self::getService( $services, self::NONE_OF_CHECKER ); |
|
246 | + public static function getNoneOfChecker(MediaWikiServices $services = null) { |
|
247 | + return self::getService($services, self::NONE_OF_CHECKER); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | /** |
251 | 251 | * @param MediaWikiServices|null $services |
252 | 252 | * @return ConstraintChecker |
253 | 253 | */ |
254 | - public static function getIntegerChecker( MediaWikiServices $services = null ) { |
|
255 | - return self::getService( $services, self::INTEGER_CHECKER ); |
|
254 | + public static function getIntegerChecker(MediaWikiServices $services = null) { |
|
255 | + return self::getService($services, self::INTEGER_CHECKER); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
259 | 259 | * @param MediaWikiServices|null $services |
260 | 260 | * @return ConstraintChecker |
261 | 261 | */ |
262 | - public static function getCitationNeededChecker( MediaWikiServices $services = null ) { |
|
263 | - return self::getService( $services, self::CITATION_NEEDED_CHECKER ); |
|
262 | + public static function getCitationNeededChecker(MediaWikiServices $services = null) { |
|
263 | + return self::getService($services, self::CITATION_NEEDED_CHECKER); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
267 | 267 | * @param MediaWikiServices|null $services |
268 | 268 | * @return ConstraintChecker |
269 | 269 | */ |
270 | - public static function getPropertyScopeChecker( MediaWikiServices $services = null ) { |
|
271 | - return self::getService( $services, self::PROPERTY_SCOPE_CHECKER ); |
|
270 | + public static function getPropertyScopeChecker(MediaWikiServices $services = null) { |
|
271 | + return self::getService($services, self::PROPERTY_SCOPE_CHECKER); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | /** |
275 | 275 | * @param MediaWikiServices|null $services |
276 | 276 | * @return ConstraintChecker |
277 | 277 | */ |
278 | - public static function getContemporaryChecker( MediaWikiServices $services = null ) { |
|
279 | - return self::getService( $services, self::CONTEMPORARY_CHECKER ); |
|
278 | + public static function getContemporaryChecker(MediaWikiServices $services = null) { |
|
279 | + return self::getService($services, self::CONTEMPORARY_CHECKER); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | } |
@@ -24,22 +24,22 @@ |
||
24 | 24 | */ |
25 | 25 | private const NULL_PROPERTY_ID = 'P2147483647'; |
26 | 26 | |
27 | - public function __construct( ContextCursor $contextCursor ) { |
|
27 | + public function __construct(ContextCursor $contextCursor) { |
|
28 | 28 | $constraint = new Constraint( |
29 | 29 | 'null', |
30 | - new PropertyId( self::NULL_PROPERTY_ID ), |
|
30 | + new PropertyId(self::NULL_PROPERTY_ID), |
|
31 | 31 | 'none', |
32 | 32 | [] |
33 | 33 | ); |
34 | - parent::__construct( $contextCursor, $constraint ); |
|
34 | + parent::__construct($contextCursor, $constraint); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | public function getConstraint() { |
38 | - throw new DomainException( 'NullResult holds no constraint' ); |
|
38 | + throw new DomainException('NullResult holds no constraint'); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | public function getConstraintId() { |
42 | - throw new DomainException( 'NullResult holds no constraint' ); |
|
42 | + throw new DomainException('NullResult holds no constraint'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | } |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | |
33 | 33 | private const BATCH_SIZE = 10; |
34 | 34 | |
35 | - public static function newFromGlobalState( Title $title, array $params ) { |
|
36 | - Assert::parameterType( 'string', $params['propertyId'], '$params["propertyId"]' ); |
|
35 | + public static function newFromGlobalState(Title $title, array $params) { |
|
36 | + Assert::parameterType('string', $params['propertyId'], '$params["propertyId"]'); |
|
37 | 37 | $repo = WikibaseRepo::getDefaultInstance(); |
38 | 38 | return new UpdateConstraintsTableJob( |
39 | 39 | $title, |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $params['revisionId'] ?? null, |
43 | 43 | MediaWikiServices::getInstance()->getMainConfig(), |
44 | 44 | ConstraintsServices::getConstraintStore(), |
45 | - $repo->getEntityRevisionLookup( Store::LOOKUP_CACHING_DISABLED ), |
|
45 | + $repo->getEntityRevisionLookup(Store::LOOKUP_CACHING_DISABLED), |
|
46 | 46 | $repo->getBaseDataModelSerializerFactory()->newSnakSerializer() |
47 | 47 | ); |
48 | 48 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | EntityRevisionLookup $entityRevisionLookup, |
98 | 98 | Serializer $snakSerializer |
99 | 99 | ) { |
100 | - parent::__construct( 'constraintsTableUpdate', $title, $params ); |
|
100 | + parent::__construct('constraintsTableUpdate', $title, $params); |
|
101 | 101 | |
102 | 102 | $this->propertyId = $propertyId; |
103 | 103 | $this->revisionId = $revisionId; |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | $this->snakSerializer = $snakSerializer; |
108 | 108 | } |
109 | 109 | |
110 | - public function extractParametersFromQualifiers( SnakList $qualifiers ) { |
|
110 | + public function extractParametersFromQualifiers(SnakList $qualifiers) { |
|
111 | 111 | $parameters = []; |
112 | - foreach ( $qualifiers as $qualifier ) { |
|
112 | + foreach ($qualifiers as $qualifier) { |
|
113 | 113 | $qualifierId = $qualifier->getPropertyId()->getSerialization(); |
114 | - $paramSerialization = $this->snakSerializer->serialize( $qualifier ); |
|
114 | + $paramSerialization = $this->snakSerializer->serialize($qualifier); |
|
115 | 115 | $parameters[$qualifierId][] = $paramSerialization; |
116 | 116 | } |
117 | 117 | return $parameters; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | '@phan-var \Wikibase\DataModel\Entity\EntityIdValue $dataValue'; |
129 | 129 | $entityId = $dataValue->getEntityId(); |
130 | 130 | $constraintTypeQid = $entityId->getSerialization(); |
131 | - $parameters = $this->extractParametersFromQualifiers( $constraintStatement->getQualifiers() ); |
|
131 | + $parameters = $this->extractParametersFromQualifiers($constraintStatement->getQualifiers()); |
|
132 | 132 | return new Constraint( |
133 | 133 | $constraintId, |
134 | 134 | $propertyId, |
@@ -143,17 +143,17 @@ discard block |
||
143 | 143 | PropertyId $propertyConstraintPropertyId |
144 | 144 | ) { |
145 | 145 | $constraintsStatements = $property->getStatements() |
146 | - ->getByPropertyId( $propertyConstraintPropertyId ) |
|
147 | - ->getByRank( [ Statement::RANK_PREFERRED, Statement::RANK_NORMAL ] ); |
|
146 | + ->getByPropertyId($propertyConstraintPropertyId) |
|
147 | + ->getByRank([Statement::RANK_PREFERRED, Statement::RANK_NORMAL]); |
|
148 | 148 | $constraints = []; |
149 | - foreach ( $constraintsStatements->getIterator() as $constraintStatement ) { |
|
150 | - $constraints[] = $this->extractConstraintFromStatement( $property->getId(), $constraintStatement ); |
|
151 | - if ( count( $constraints ) >= self::BATCH_SIZE ) { |
|
152 | - $constraintStore->insertBatch( $constraints ); |
|
149 | + foreach ($constraintsStatements->getIterator() as $constraintStatement) { |
|
150 | + $constraints[] = $this->extractConstraintFromStatement($property->getId(), $constraintStatement); |
|
151 | + if (count($constraints) >= self::BATCH_SIZE) { |
|
152 | + $constraintStore->insertBatch($constraints); |
|
153 | 153 | $constraints = []; |
154 | 154 | } |
155 | 155 | } |
156 | - $constraintStore->insertBatch( $constraints ); |
|
156 | + $constraintStore->insertBatch($constraints); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -164,19 +164,19 @@ discard block |
||
164 | 164 | public function run() { |
165 | 165 | // TODO in the future: only touch constraints affected by the edit (requires T163465) |
166 | 166 | |
167 | - $propertyId = new PropertyId( $this->propertyId ); |
|
167 | + $propertyId = new PropertyId($this->propertyId); |
|
168 | 168 | $propertyRevision = $this->entityRevisionLookup->getEntityRevision( |
169 | 169 | $propertyId, |
170 | 170 | 0, // latest |
171 | 171 | LookupConstants::LATEST_FROM_REPLICA |
172 | 172 | ); |
173 | 173 | |
174 | - if ( $this->revisionId !== null && $propertyRevision->getRevisionId() < $this->revisionId ) { |
|
175 | - JobQueueGroup::singleton()->push( $this ); |
|
174 | + if ($this->revisionId !== null && $propertyRevision->getRevisionId() < $this->revisionId) { |
|
175 | + JobQueueGroup::singleton()->push($this); |
|
176 | 176 | return true; |
177 | 177 | } |
178 | 178 | |
179 | - $this->constraintStore->deleteForProperty( $propertyId ); |
|
179 | + $this->constraintStore->deleteForProperty($propertyId); |
|
180 | 180 | |
181 | 181 | /** @var Property $property */ |
182 | 182 | $property = $propertyRevision->getEntity(); |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $this->importConstraintsForProperty( |
185 | 185 | $property, |
186 | 186 | $this->constraintStore, |
187 | - new PropertyId( $this->config->get( 'WBQualityConstraintsPropertyConstraintId' ) ) |
|
187 | + new PropertyId($this->config->get('WBQualityConstraintsPropertyConstraintId')) |
|
188 | 188 | ); |
189 | 189 | |
190 | 190 | return true; |
@@ -20,35 +20,35 @@ |
||
20 | 20 | public const PROPERTY_DATA_TYPE_LOOKUP = 'WBQC_PropertyDataTypeLookup'; |
21 | 21 | public const ENTITY_LOOKUP_WITHOUT_CACHE = 'WBQC_EntityLookupWithoutCache'; |
22 | 22 | |
23 | - private static function getService( ?MediaWikiServices $services, $name ) { |
|
24 | - if ( $services === null ) { |
|
23 | + private static function getService(?MediaWikiServices $services, $name) { |
|
24 | + if ($services === null) { |
|
25 | 25 | $services = MediaWikiServices::getInstance(); |
26 | 26 | } |
27 | - return $services->getService( $name ); |
|
27 | + return $services->getService($name); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
31 | 31 | * @param MediaWikiServices|null $services |
32 | 32 | * @return EntityLookup |
33 | 33 | */ |
34 | - public static function getEntityLookup( MediaWikiServices $services = null ) { |
|
35 | - return self::getService( $services, self::ENTITY_LOOKUP ); |
|
34 | + public static function getEntityLookup(MediaWikiServices $services = null) { |
|
35 | + return self::getService($services, self::ENTITY_LOOKUP); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
39 | 39 | * @param MediaWikiServices|null $services |
40 | 40 | * @return PropertyDataTypeLookup |
41 | 41 | */ |
42 | - public static function getPropertyDataTypeLookup( MediaWikiServices $services = null ) { |
|
43 | - return self::getService( $services, self::PROPERTY_DATA_TYPE_LOOKUP ); |
|
42 | + public static function getPropertyDataTypeLookup(MediaWikiServices $services = null) { |
|
43 | + return self::getService($services, self::PROPERTY_DATA_TYPE_LOOKUP); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
47 | 47 | * @param MediaWikiServices|null $services |
48 | 48 | * @return EntityLookup |
49 | 49 | */ |
50 | - public static function getEntityLookupWithoutCache( MediaWikiServices $services = null ) { |
|
51 | - return self::getService( $services, self::ENTITY_LOOKUP_WITHOUT_CACHE ); |
|
50 | + public static function getEntityLookupWithoutCache(MediaWikiServices $services = null) { |
|
51 | + return self::getService($services, self::ENTITY_LOOKUP_WITHOUT_CACHE); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | } |