@@ -76,6 +76,7 @@ |
||
76 | 76 | |
77 | 77 | /** |
78 | 78 | * @param string the converted $cacheId |
79 | + * @param string $cacheId |
|
79 | 80 | * |
80 | 81 | * @return boolean representing if the Lock is Locked |
81 | 82 | * |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | /** |
27 | 27 | * @param BagOStuff $cache |
28 | 28 | */ |
29 | - public function __construct( BagOStuff $cache ) { |
|
29 | + public function __construct(BagOStuff $cache) { |
|
30 | 30 | $this->cache = $cache; |
31 | 31 | } |
32 | 32 | |
@@ -37,17 +37,17 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @throws \Wikimedia\Assert\ParameterTypeException |
39 | 39 | */ |
40 | - private function makeKey( $id ) { |
|
41 | - if ( empty( trim( $id ) ) ) { |
|
42 | - throw new ParameterTypeException( '$id', 'non-empty string' ); |
|
40 | + private function makeKey($id) { |
|
41 | + if (empty(trim($id))) { |
|
42 | + throw new ParameterTypeException('$id', 'non-empty string'); |
|
43 | 43 | } |
44 | 44 | |
45 | - Assert::parameterType( 'string', $id, '$id' ); |
|
45 | + Assert::parameterType('string', $id, '$id'); |
|
46 | 46 | |
47 | 47 | return $this->cache->makeKey( |
48 | 48 | 'WikibaseQualityConstraints', |
49 | 49 | 'ExpiryLock', |
50 | - (string)$id |
|
50 | + (string) $id |
|
51 | 51 | ); |
52 | 52 | } |
53 | 53 | |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @throws \Wikimedia\Assert\ParameterTypeException |
61 | 61 | */ |
62 | - public function lock( $id, ConvertibleTimestamp $expiryTimestamp ) { |
|
62 | + public function lock($id, ConvertibleTimestamp $expiryTimestamp) { |
|
63 | 63 | |
64 | - $cacheId = $this->makeKey( $id ); |
|
64 | + $cacheId = $this->makeKey($id); |
|
65 | 65 | |
66 | - if ( !$this->isLockedInternal( $cacheId ) ) { |
|
66 | + if (!$this->isLockedInternal($cacheId)) { |
|
67 | 67 | return $this->cache->set( |
68 | 68 | $cacheId, |
69 | 69 | $expiryTimestamp->getTimestamp(), |
@@ -81,20 +81,20 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @throws \Wikimedia\Assert\ParameterTypeException |
83 | 83 | */ |
84 | - private function isLockedInternal( $cacheId ) { |
|
85 | - $expiryTime = $this->cache->get( $cacheId ); |
|
86 | - if ( !$expiryTime ) { |
|
84 | + private function isLockedInternal($cacheId) { |
|
85 | + $expiryTime = $this->cache->get($cacheId); |
|
86 | + if (!$expiryTime) { |
|
87 | 87 | return false; |
88 | 88 | } |
89 | 89 | |
90 | 90 | try { |
91 | - $lockExpiryTimeStamp = new ConvertibleTimestamp( $expiryTime ); |
|
92 | - } catch ( TimestampException $exception ) { |
|
91 | + $lockExpiryTimeStamp = new ConvertibleTimestamp($expiryTime); |
|
92 | + } catch (TimestampException $exception) { |
|
93 | 93 | return false; |
94 | 94 | } |
95 | 95 | |
96 | 96 | $now = new ConvertibleTimestamp(); |
97 | - if ( $now->timestamp < $lockExpiryTimeStamp->timestamp ) { |
|
97 | + if ($now->timestamp < $lockExpiryTimeStamp->timestamp) { |
|
98 | 98 | return true; |
99 | 99 | } else { |
100 | 100 | return false; |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @throws \Wikimedia\Assert\ParameterTypeException |
110 | 110 | */ |
111 | - public function isLocked( $id ) { |
|
112 | - return $this->isLockedInternal( $this->makeKey( $id ) ); |
|
111 | + public function isLocked($id) { |
|
112 | + return $this->isLockedInternal($this->makeKey($id)); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | } |
@@ -38,130 +38,130 @@ |
||
38 | 38 | const RESULTS_SOURCE = 'WBQC_ResultsSource'; |
39 | 39 | const EXPIRY_LOCK = 'WBQC_ExpiryLock'; |
40 | 40 | |
41 | - private static function getService( MediaWikiServices $services = null, $name ) { |
|
42 | - if ( $services === null ) { |
|
41 | + private static function getService(MediaWikiServices $services = null, $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 | 48 | /** |
49 | 49 | * @param MediaWikiServices|null $services |
50 | 50 | * @return LoggingHelper |
51 | 51 | */ |
52 | - public static function getLoggingHelper( MediaWikiServices $services = null ) { |
|
53 | - return self::getService( $services, self::LOGGING_HELPER ); |
|
52 | + public static function getLoggingHelper(MediaWikiServices $services = null) { |
|
53 | + return self::getService($services, self::LOGGING_HELPER); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
57 | 57 | * @param MediaWikiServices|null $services |
58 | 58 | * @return ConstraintRepository |
59 | 59 | */ |
60 | - public static function getConstraintRepository( MediaWikiServices $services = null ) { |
|
61 | - return self::getService( $services, self::CONSTRAINT_REPOSITORY ); |
|
60 | + public static function getConstraintRepository(MediaWikiServices $services = null) { |
|
61 | + return self::getService($services, self::CONSTRAINT_REPOSITORY); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
65 | 65 | * @param MediaWikiServices|null $services |
66 | 66 | * @return ConstraintLookup |
67 | 67 | */ |
68 | - public static function getConstraintLookup( MediaWikiServices $services = null ) { |
|
69 | - return self::getService( $services, self::CONSTRAINT_LOOKUP ); |
|
68 | + public static function getConstraintLookup(MediaWikiServices $services = null) { |
|
69 | + return self::getService($services, self::CONSTRAINT_LOOKUP); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
73 | 73 | * @param MediaWikiServices|null $services |
74 | 74 | * @return CheckResultSerializer |
75 | 75 | */ |
76 | - public static function getCheckResultSerializer( MediaWikiServices $services = null ) { |
|
77 | - return self::getService( $services, self::CHECK_RESULT_SERIALIZER ); |
|
76 | + public static function getCheckResultSerializer(MediaWikiServices $services = null) { |
|
77 | + return self::getService($services, self::CHECK_RESULT_SERIALIZER); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
81 | 81 | * @param MediaWikiServices|null $services |
82 | 82 | * @return CheckResultDeserializer |
83 | 83 | */ |
84 | - public static function getCheckResultDeserializer( MediaWikiServices $services = null ) { |
|
85 | - return self::getService( $services, self::CHECK_RESULT_DESERIALIZER ); |
|
84 | + public static function getCheckResultDeserializer(MediaWikiServices $services = null) { |
|
85 | + return self::getService($services, self::CHECK_RESULT_DESERIALIZER); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
89 | 89 | * @param MediaWikiServices|null $services |
90 | 90 | * @return ViolationMessageSerializer |
91 | 91 | */ |
92 | - public static function getViolationMessageSerializer( MediaWikiServices $services = null ) { |
|
93 | - return self::getService( $services, self::VIOLATION_MESSAGE_SERIALIZER ); |
|
92 | + public static function getViolationMessageSerializer(MediaWikiServices $services = null) { |
|
93 | + return self::getService($services, self::VIOLATION_MESSAGE_SERIALIZER); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
97 | 97 | * @param MediaWikiServices|null $services |
98 | 98 | * @return ViolationMessageDeserializer |
99 | 99 | */ |
100 | - public static function getViolationMessageDeserializer( MediaWikiServices $services = null ) { |
|
101 | - return self::getService( $services, self::VIOLATION_MESSAGE_DESERIALIZER ); |
|
100 | + public static function getViolationMessageDeserializer(MediaWikiServices $services = null) { |
|
101 | + return self::getService($services, self::VIOLATION_MESSAGE_DESERIALIZER); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
105 | 105 | * @param MediaWikiServices|null $services |
106 | 106 | * @return ConstraintParameterParser |
107 | 107 | */ |
108 | - public static function getConstraintParameterParser( MediaWikiServices $services = null ) { |
|
109 | - return self::getService( $services, self::CONSTRAINT_PARAMETER_PARSER ); |
|
108 | + public static function getConstraintParameterParser(MediaWikiServices $services = null) { |
|
109 | + return self::getService($services, self::CONSTRAINT_PARAMETER_PARSER); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
113 | 113 | * @param MediaWikiServices|null $services |
114 | 114 | * @return ConnectionCheckerHelper |
115 | 115 | */ |
116 | - public static function getConnectionCheckerHelper( MediaWikiServices $services = null ) { |
|
117 | - return self::getService( $services, self::CONNECTION_CHECKER_HELPER ); |
|
116 | + public static function getConnectionCheckerHelper(MediaWikiServices $services = null) { |
|
117 | + return self::getService($services, self::CONNECTION_CHECKER_HELPER); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
121 | 121 | * @param MediaWikiServices|null $services |
122 | 122 | * @return RangeCheckerHelper |
123 | 123 | */ |
124 | - public static function getRangeCheckerHelper( MediaWikiServices $services = null ) { |
|
125 | - return self::getService( $services, self::RANGE_CHECKER_HELPER ); |
|
124 | + public static function getRangeCheckerHelper(MediaWikiServices $services = null) { |
|
125 | + return self::getService($services, self::RANGE_CHECKER_HELPER); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
129 | 129 | * @param MediaWikiServices|null $services |
130 | 130 | * @return SparqlHelper |
131 | 131 | */ |
132 | - public static function getSparqlHelper( MediaWikiServices $services = null ) { |
|
133 | - return self::getService( $services, self::SPARQL_HELPER ); |
|
132 | + public static function getSparqlHelper(MediaWikiServices $services = null) { |
|
133 | + return self::getService($services, self::SPARQL_HELPER); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
137 | 137 | * @param MediaWikiServices|null $services |
138 | 138 | * @return TypeCheckerHelper |
139 | 139 | */ |
140 | - public static function getTypeCheckerHelper( MediaWikiServices $services = null ) { |
|
141 | - return self::getService( $services, self::TYPE_CHECKER_HELPER ); |
|
140 | + public static function getTypeCheckerHelper(MediaWikiServices $services = null) { |
|
141 | + return self::getService($services, self::TYPE_CHECKER_HELPER); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
145 | 145 | * @param MediaWikiServices|null $services |
146 | 146 | * @return DelegatingConstraintChecker |
147 | 147 | */ |
148 | - public static function getDelegatingConstraintChecker( MediaWikiServices $services = null ) { |
|
149 | - return self::getService( $services, self::DELEGATING_CONSTRAINT_CHECKER ); |
|
148 | + public static function getDelegatingConstraintChecker(MediaWikiServices $services = null) { |
|
149 | + return self::getService($services, self::DELEGATING_CONSTRAINT_CHECKER); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
153 | 153 | * @param MediaWikiServices|null $services |
154 | 154 | * @return ResultsSource |
155 | 155 | */ |
156 | - public static function getResultsSource( MediaWikiServices $services = null ) { |
|
157 | - return self::getService( $services, self::RESULTS_SOURCE ); |
|
156 | + public static function getResultsSource(MediaWikiServices $services = null) { |
|
157 | + return self::getService($services, self::RESULTS_SOURCE); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
161 | 161 | * @return ExpiryLock |
162 | 162 | */ |
163 | - public static function getExpiryLock( MediaWikiServices $services = null ) { |
|
164 | - return self::getService( $services, self::EXPIRY_LOCK ); |
|
163 | + public static function getExpiryLock(MediaWikiServices $services = null) { |
|
164 | + return self::getService($services, self::EXPIRY_LOCK); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | } |
@@ -29,28 +29,28 @@ discard block |
||
29 | 29 | use WikibaseQuality\ConstraintReport\ConstraintCheck\Result\CheckResultSerializer; |
30 | 30 | |
31 | 31 | return [ |
32 | - ConstraintsServices::EXPIRY_LOCK => function( MediaWikiServices $services ) { |
|
33 | - return new ExpiryLock( ObjectCache::getInstance( CACHE_ANYTHING ) ); |
|
32 | + ConstraintsServices::EXPIRY_LOCK => function(MediaWikiServices $services) { |
|
33 | + return new ExpiryLock(ObjectCache::getInstance(CACHE_ANYTHING)); |
|
34 | 34 | }, |
35 | 35 | |
36 | - ConstraintsServices::LOGGING_HELPER => function( MediaWikiServices $services ) { |
|
36 | + ConstraintsServices::LOGGING_HELPER => function(MediaWikiServices $services) { |
|
37 | 37 | return new LoggingHelper( |
38 | 38 | $services->getStatsdDataFactory(), |
39 | - LoggerFactory::getInstance( 'WikibaseQualityConstraints' ), |
|
39 | + LoggerFactory::getInstance('WikibaseQualityConstraints'), |
|
40 | 40 | $services->getMainConfig() |
41 | 41 | ); |
42 | 42 | }, |
43 | 43 | |
44 | - ConstraintsServices::CONSTRAINT_REPOSITORY => function( MediaWikiServices $services ) { |
|
44 | + ConstraintsServices::CONSTRAINT_REPOSITORY => function(MediaWikiServices $services) { |
|
45 | 45 | return new ConstraintRepository(); |
46 | 46 | }, |
47 | 47 | |
48 | - ConstraintsServices::CONSTRAINT_LOOKUP => function( MediaWikiServices $services ) { |
|
49 | - $constraintRepository = ConstraintsServices::getConstraintRepository( $services ); |
|
50 | - return new CachingConstraintLookup( $constraintRepository ); |
|
48 | + ConstraintsServices::CONSTRAINT_LOOKUP => function(MediaWikiServices $services) { |
|
49 | + $constraintRepository = ConstraintsServices::getConstraintRepository($services); |
|
50 | + return new CachingConstraintLookup($constraintRepository); |
|
51 | 51 | }, |
52 | 52 | |
53 | - ConstraintsServices::CHECK_RESULT_SERIALIZER => function( MediaWikiServices $services ) { |
|
53 | + ConstraintsServices::CHECK_RESULT_SERIALIZER => function(MediaWikiServices $services) { |
|
54 | 54 | return new CheckResultSerializer( |
55 | 55 | new ConstraintSerializer( |
56 | 56 | false // constraint parameters are not exposed |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | ); |
62 | 62 | }, |
63 | 63 | |
64 | - ConstraintsServices::CHECK_RESULT_DESERIALIZER => function( MediaWikiServices $services ) { |
|
64 | + ConstraintsServices::CHECK_RESULT_DESERIALIZER => function(MediaWikiServices $services) { |
|
65 | 65 | // TODO in the future, get EntityIdParser and DataValueFactory from $services? |
66 | 66 | $repo = WikibaseRepo::getDefaultInstance(); |
67 | 67 | $entityIdParser = $repo->getEntityIdParser(); |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | ); |
79 | 79 | }, |
80 | 80 | |
81 | - ConstraintsServices::VIOLATION_MESSAGE_SERIALIZER => function( MediaWikiServices $services ) { |
|
81 | + ConstraintsServices::VIOLATION_MESSAGE_SERIALIZER => function(MediaWikiServices $services) { |
|
82 | 82 | return new ViolationMessageSerializer(); |
83 | 83 | }, |
84 | 84 | |
85 | - ConstraintsServices::VIOLATION_MESSAGE_DESERIALIZER => function( MediaWikiServices $services ) { |
|
85 | + ConstraintsServices::VIOLATION_MESSAGE_DESERIALIZER => function(MediaWikiServices $services) { |
|
86 | 86 | // TODO in the future, get EntityIdParser and DataValueFactory from $services? |
87 | 87 | $repo = WikibaseRepo::getDefaultInstance(); |
88 | 88 | $entityIdParser = $repo->getEntityIdParser(); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | ); |
95 | 95 | }, |
96 | 96 | |
97 | - ConstraintsServices::CONSTRAINT_PARAMETER_PARSER => function( MediaWikiServices $services ) { |
|
97 | + ConstraintsServices::CONSTRAINT_PARAMETER_PARSER => function(MediaWikiServices $services) { |
|
98 | 98 | // TODO in the future, get DeserializerFactory and concept base URIs from $services? |
99 | 99 | $repo = WikibaseRepo::getDefaultInstance(); |
100 | 100 | $deserializerFactory = $repo->getBaseDataModelDeserializerFactory(); |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | ); |
108 | 108 | }, |
109 | 109 | |
110 | - ConstraintsServices::CONNECTION_CHECKER_HELPER => function( MediaWikiServices $services ) { |
|
110 | + ConstraintsServices::CONNECTION_CHECKER_HELPER => function(MediaWikiServices $services) { |
|
111 | 111 | return new ConnectionCheckerHelper(); |
112 | 112 | }, |
113 | 113 | |
114 | - ConstraintsServices::RANGE_CHECKER_HELPER => function( MediaWikiServices $services ) { |
|
114 | + ConstraintsServices::RANGE_CHECKER_HELPER => function(MediaWikiServices $services) { |
|
115 | 115 | // TODO in the future, get UnitConverter from $services? |
116 | 116 | $repo = WikibaseRepo::getDefaultInstance(); |
117 | 117 | $unitConverter = $repo->getUnitConverter(); |
@@ -122,9 +122,9 @@ discard block |
||
122 | 122 | ); |
123 | 123 | }, |
124 | 124 | |
125 | - ConstraintsServices::SPARQL_HELPER => function( MediaWikiServices $services ) { |
|
126 | - $endpoint = $services->getMainConfig()->get( 'WBQualityConstraintsSparqlEndpoint' ); |
|
127 | - if ( $endpoint === '' ) { |
|
125 | + ConstraintsServices::SPARQL_HELPER => function(MediaWikiServices $services) { |
|
126 | + $endpoint = $services->getMainConfig()->get('WBQualityConstraintsSparqlEndpoint'); |
|
127 | + if ($endpoint === '') { |
|
128 | 128 | return new DummySparqlHelper(); |
129 | 129 | } |
130 | 130 | |
@@ -140,115 +140,115 @@ discard block |
||
140 | 140 | $entityIdParser, |
141 | 141 | $propertyDataTypeLookup, |
142 | 142 | $services->getMainWANObjectCache(), |
143 | - ConstraintsServices::getViolationMessageSerializer( $services ), |
|
144 | - ConstraintsServices::getViolationMessageDeserializer( $services ), |
|
143 | + ConstraintsServices::getViolationMessageSerializer($services), |
|
144 | + ConstraintsServices::getViolationMessageDeserializer($services), |
|
145 | 145 | $services->getStatsdDataFactory(), |
146 | - wfWikiID() . ' WikibaseQualityConstraints ' . Http::userAgent(), |
|
146 | + wfWikiID().' WikibaseQualityConstraints '.Http::userAgent(), |
|
147 | 147 | $services->getHttpRequestFactory() |
148 | 148 | ); |
149 | 149 | }, |
150 | 150 | |
151 | - ConstraintsServices::TYPE_CHECKER_HELPER => function( MediaWikiServices $services ) { |
|
151 | + ConstraintsServices::TYPE_CHECKER_HELPER => function(MediaWikiServices $services) { |
|
152 | 152 | return new TypeCheckerHelper( |
153 | - WikibaseServices::getEntityLookup( $services ), |
|
153 | + WikibaseServices::getEntityLookup($services), |
|
154 | 154 | $services->getMainConfig(), |
155 | - ConstraintsServices::getSparqlHelper( $services ), |
|
155 | + ConstraintsServices::getSparqlHelper($services), |
|
156 | 156 | $services->getStatsdDataFactory() |
157 | 157 | ); |
158 | 158 | }, |
159 | 159 | |
160 | - ConstraintsServices::DELEGATING_CONSTRAINT_CHECKER => function( MediaWikiServices $services ) { |
|
160 | + ConstraintsServices::DELEGATING_CONSTRAINT_CHECKER => function(MediaWikiServices $services) { |
|
161 | 161 | // TODO in the future, get StatementGuidParser from $services? |
162 | 162 | $repo = WikibaseRepo::getDefaultInstance(); |
163 | 163 | $statementGuidParser = $repo->getStatementGuidParser(); |
164 | 164 | |
165 | 165 | $config = $services->getMainConfig(); |
166 | 166 | $checkerMap = [ |
167 | - $config->get( 'WBQualityConstraintsConflictsWithConstraintId' ) |
|
168 | - => ConstraintCheckerServices::getConflictsWithChecker( $services ), |
|
169 | - $config->get( 'WBQualityConstraintsItemRequiresClaimConstraintId' ) |
|
170 | - => ConstraintCheckerServices::getItemChecker( $services ), |
|
171 | - $config->get( 'WBQualityConstraintsValueRequiresClaimConstraintId' ) |
|
172 | - => ConstraintCheckerServices::getTargetRequiredClaimChecker( $services ), |
|
173 | - $config->get( 'WBQualityConstraintsSymmetricConstraintId' ) |
|
174 | - => ConstraintCheckerServices::getSymmetricChecker( $services ), |
|
175 | - $config->get( 'WBQualityConstraintsInverseConstraintId' ) |
|
176 | - => ConstraintCheckerServices::getInverseChecker( $services ), |
|
177 | - $config->get( 'WBQualityConstraintsUsedAsQualifierConstraintId' ) |
|
178 | - => ConstraintCheckerServices::getQualifierChecker( $services ), |
|
179 | - $config->get( 'WBQualityConstraintsAllowedQualifiersConstraintId' ) |
|
180 | - => ConstraintCheckerServices::getQualifiersChecker( $services ), |
|
181 | - $config->get( 'WBQualityConstraintsMandatoryQualifierConstraintId' ) |
|
182 | - => ConstraintCheckerServices::getMandatoryQualifiersChecker( $services ), |
|
183 | - $config->get( 'WBQualityConstraintsRangeConstraintId' ) |
|
184 | - => ConstraintCheckerServices::getRangeChecker( $services ), |
|
185 | - $config->get( 'WBQualityConstraintsDifferenceWithinRangeConstraintId' ) |
|
186 | - => ConstraintCheckerServices::getDiffWithinRangeChecker( $services ), |
|
187 | - $config->get( 'WBQualityConstraintsTypeConstraintId' ) |
|
188 | - => ConstraintCheckerServices::getTypeChecker( $services ), |
|
189 | - $config->get( 'WBQualityConstraintsValueTypeConstraintId' ) |
|
190 | - => ConstraintCheckerServices::getValueTypeChecker( $services ), |
|
191 | - $config->get( 'WBQualityConstraintsSingleValueConstraintId' ) |
|
192 | - => ConstraintCheckerServices::getSingleValueChecker( $services ), |
|
193 | - $config->get( 'WBQualityConstraintsMultiValueConstraintId' ) |
|
194 | - => ConstraintCheckerServices::getMultiValueChecker( $services ), |
|
195 | - $config->get( 'WBQualityConstraintsDistinctValuesConstraintId' ) |
|
196 | - => ConstraintCheckerServices::getUniqueValueChecker( $services ), |
|
197 | - $config->get( 'WBQualityConstraintsFormatConstraintId' ) |
|
198 | - => ConstraintCheckerServices::getFormatChecker( $services ), |
|
199 | - $config->get( 'WBQualityConstraintsCommonsLinkConstraintId' ) |
|
200 | - => ConstraintCheckerServices::getCommonsLinkChecker( $services ), |
|
201 | - $config->get( 'WBQualityConstraintsOneOfConstraintId' ) |
|
202 | - => ConstraintCheckerServices::getOneOfChecker( $services ), |
|
203 | - $config->get( 'WBQualityConstraintsUsedForValuesOnlyConstraintId' ) |
|
204 | - => ConstraintCheckerServices::getValueOnlyChecker( $services ), |
|
205 | - $config->get( 'WBQualityConstraintsUsedAsReferenceConstraintId' ) |
|
206 | - => ConstraintCheckerServices::getReferenceChecker( $services ), |
|
207 | - $config->get( 'WBQualityConstraintsNoBoundsConstraintId' ) |
|
208 | - => ConstraintCheckerServices::getNoBoundsChecker( $services ), |
|
209 | - $config->get( 'WBQualityConstraintsAllowedUnitsConstraintId' ) |
|
210 | - => ConstraintCheckerServices::getAllowedUnitsChecker( $services ), |
|
211 | - $config->get( 'WBQualityConstraintsSingleBestValueConstraintId' ) |
|
212 | - => ConstraintCheckerServices::getSingleBestValueChecker( $services ), |
|
213 | - $config->get( 'WBQualityConstraintsAllowedEntityTypesConstraintId' ) |
|
214 | - => ConstraintCheckerServices::getEntityTypeChecker( $services ), |
|
215 | - $config->get( 'WBQualityConstraintsNoneOfConstraintId' ) |
|
216 | - => ConstraintCheckerServices::getNoneOfChecker( $services ), |
|
217 | - $config->get( 'WBQualityConstraintsIntegerConstraintId' ) |
|
218 | - => ConstraintCheckerServices::getIntegerChecker( $services ), |
|
219 | - $config->get( 'WBQualityConstraintsCitationNeededConstraintId' ) |
|
220 | - => ConstraintCheckerServices::getCitationNeededChecker( $services ), |
|
221 | - $config->get( 'WBQualityConstraintsPropertyScopeConstraintId' ) |
|
222 | - => ConstraintCheckerServices::getPropertyScopeChecker( $services ), |
|
223 | - $config->get( 'WBQualityConstraintsContemporaryConstraintId' ) |
|
224 | - => ConstraintCheckerServices::getContemporaryChecker( $services ), |
|
167 | + $config->get('WBQualityConstraintsConflictsWithConstraintId') |
|
168 | + => ConstraintCheckerServices::getConflictsWithChecker($services), |
|
169 | + $config->get('WBQualityConstraintsItemRequiresClaimConstraintId') |
|
170 | + => ConstraintCheckerServices::getItemChecker($services), |
|
171 | + $config->get('WBQualityConstraintsValueRequiresClaimConstraintId') |
|
172 | + => ConstraintCheckerServices::getTargetRequiredClaimChecker($services), |
|
173 | + $config->get('WBQualityConstraintsSymmetricConstraintId') |
|
174 | + => ConstraintCheckerServices::getSymmetricChecker($services), |
|
175 | + $config->get('WBQualityConstraintsInverseConstraintId') |
|
176 | + => ConstraintCheckerServices::getInverseChecker($services), |
|
177 | + $config->get('WBQualityConstraintsUsedAsQualifierConstraintId') |
|
178 | + => ConstraintCheckerServices::getQualifierChecker($services), |
|
179 | + $config->get('WBQualityConstraintsAllowedQualifiersConstraintId') |
|
180 | + => ConstraintCheckerServices::getQualifiersChecker($services), |
|
181 | + $config->get('WBQualityConstraintsMandatoryQualifierConstraintId') |
|
182 | + => ConstraintCheckerServices::getMandatoryQualifiersChecker($services), |
|
183 | + $config->get('WBQualityConstraintsRangeConstraintId') |
|
184 | + => ConstraintCheckerServices::getRangeChecker($services), |
|
185 | + $config->get('WBQualityConstraintsDifferenceWithinRangeConstraintId') |
|
186 | + => ConstraintCheckerServices::getDiffWithinRangeChecker($services), |
|
187 | + $config->get('WBQualityConstraintsTypeConstraintId') |
|
188 | + => ConstraintCheckerServices::getTypeChecker($services), |
|
189 | + $config->get('WBQualityConstraintsValueTypeConstraintId') |
|
190 | + => ConstraintCheckerServices::getValueTypeChecker($services), |
|
191 | + $config->get('WBQualityConstraintsSingleValueConstraintId') |
|
192 | + => ConstraintCheckerServices::getSingleValueChecker($services), |
|
193 | + $config->get('WBQualityConstraintsMultiValueConstraintId') |
|
194 | + => ConstraintCheckerServices::getMultiValueChecker($services), |
|
195 | + $config->get('WBQualityConstraintsDistinctValuesConstraintId') |
|
196 | + => ConstraintCheckerServices::getUniqueValueChecker($services), |
|
197 | + $config->get('WBQualityConstraintsFormatConstraintId') |
|
198 | + => ConstraintCheckerServices::getFormatChecker($services), |
|
199 | + $config->get('WBQualityConstraintsCommonsLinkConstraintId') |
|
200 | + => ConstraintCheckerServices::getCommonsLinkChecker($services), |
|
201 | + $config->get('WBQualityConstraintsOneOfConstraintId') |
|
202 | + => ConstraintCheckerServices::getOneOfChecker($services), |
|
203 | + $config->get('WBQualityConstraintsUsedForValuesOnlyConstraintId') |
|
204 | + => ConstraintCheckerServices::getValueOnlyChecker($services), |
|
205 | + $config->get('WBQualityConstraintsUsedAsReferenceConstraintId') |
|
206 | + => ConstraintCheckerServices::getReferenceChecker($services), |
|
207 | + $config->get('WBQualityConstraintsNoBoundsConstraintId') |
|
208 | + => ConstraintCheckerServices::getNoBoundsChecker($services), |
|
209 | + $config->get('WBQualityConstraintsAllowedUnitsConstraintId') |
|
210 | + => ConstraintCheckerServices::getAllowedUnitsChecker($services), |
|
211 | + $config->get('WBQualityConstraintsSingleBestValueConstraintId') |
|
212 | + => ConstraintCheckerServices::getSingleBestValueChecker($services), |
|
213 | + $config->get('WBQualityConstraintsAllowedEntityTypesConstraintId') |
|
214 | + => ConstraintCheckerServices::getEntityTypeChecker($services), |
|
215 | + $config->get('WBQualityConstraintsNoneOfConstraintId') |
|
216 | + => ConstraintCheckerServices::getNoneOfChecker($services), |
|
217 | + $config->get('WBQualityConstraintsIntegerConstraintId') |
|
218 | + => ConstraintCheckerServices::getIntegerChecker($services), |
|
219 | + $config->get('WBQualityConstraintsCitationNeededConstraintId') |
|
220 | + => ConstraintCheckerServices::getCitationNeededChecker($services), |
|
221 | + $config->get('WBQualityConstraintsPropertyScopeConstraintId') |
|
222 | + => ConstraintCheckerServices::getPropertyScopeChecker($services), |
|
223 | + $config->get('WBQualityConstraintsContemporaryConstraintId') |
|
224 | + => ConstraintCheckerServices::getContemporaryChecker($services), |
|
225 | 225 | ]; |
226 | 226 | |
227 | 227 | return new DelegatingConstraintChecker( |
228 | - WikibaseServices::getEntityLookup( $services ), |
|
228 | + WikibaseServices::getEntityLookup($services), |
|
229 | 229 | $checkerMap, |
230 | - ConstraintsServices::getConstraintLookup( $services ), |
|
231 | - ConstraintsServices::getConstraintParameterParser( $services ), |
|
230 | + ConstraintsServices::getConstraintLookup($services), |
|
231 | + ConstraintsServices::getConstraintParameterParser($services), |
|
232 | 232 | $statementGuidParser, |
233 | - ConstraintsServices::getLoggingHelper( $services ), |
|
234 | - $config->get( 'WBQualityConstraintsCheckQualifiers' ), |
|
235 | - $config->get( 'WBQualityConstraintsCheckReferences' ), |
|
236 | - $config->get( 'WBQualityConstraintsPropertiesWithViolatingQualifiers' ) |
|
233 | + ConstraintsServices::getLoggingHelper($services), |
|
234 | + $config->get('WBQualityConstraintsCheckQualifiers'), |
|
235 | + $config->get('WBQualityConstraintsCheckReferences'), |
|
236 | + $config->get('WBQualityConstraintsPropertiesWithViolatingQualifiers') |
|
237 | 237 | ); |
238 | 238 | }, |
239 | 239 | |
240 | - ConstraintsServices::RESULTS_SOURCE => function( MediaWikiServices $services ) { |
|
240 | + ConstraintsServices::RESULTS_SOURCE => function(MediaWikiServices $services) { |
|
241 | 241 | $config = $services->getMainConfig(); |
242 | 242 | $resultsSource = new CheckingResultsSource( |
243 | - ConstraintsServices::getDelegatingConstraintChecker( $services ) |
|
243 | + ConstraintsServices::getDelegatingConstraintChecker($services) |
|
244 | 244 | ); |
245 | 245 | |
246 | - if ( $config->get( 'WBQualityConstraintsCacheCheckConstraintsResults' ) ) { |
|
246 | + if ($config->get('WBQualityConstraintsCacheCheckConstraintsResults')) { |
|
247 | 247 | $possiblyStaleConstraintTypes = [ |
248 | - $config->get( 'WBQualityConstraintsCommonsLinkConstraintId' ), |
|
249 | - $config->get( 'WBQualityConstraintsTypeConstraintId' ), |
|
250 | - $config->get( 'WBQualityConstraintsValueTypeConstraintId' ), |
|
251 | - $config->get( 'WBQualityConstraintsDistinctValuesConstraintId' ), |
|
248 | + $config->get('WBQualityConstraintsCommonsLinkConstraintId'), |
|
249 | + $config->get('WBQualityConstraintsTypeConstraintId'), |
|
250 | + $config->get('WBQualityConstraintsValueTypeConstraintId'), |
|
251 | + $config->get('WBQualityConstraintsDistinctValuesConstraintId'), |
|
252 | 252 | ]; |
253 | 253 | // TODO in the future, get EntityIdParser and WikiPageEntityMetaDataAccessor from $services? |
254 | 254 | $repo = WikibaseRepo::getDefaultInstance(); |
@@ -260,21 +260,21 @@ discard block |
||
260 | 260 | $entityNamespaceLookup, |
261 | 261 | $services->getSlotRoleStore() |
262 | 262 | ), |
263 | - $repo->getSettings()->getSetting( 'changesDatabase' ), |
|
263 | + $repo->getSettings()->getSetting('changesDatabase'), |
|
264 | 264 | '' // Empty string here means this only works for the local repo |
265 | 265 | ); |
266 | 266 | |
267 | 267 | $resultsSource = new CachingResultsSource( |
268 | 268 | $resultsSource, |
269 | 269 | ResultsCache::getDefaultInstance(), |
270 | - ConstraintsServices::getCheckResultSerializer( $services ), |
|
271 | - ConstraintsServices::getCheckResultDeserializer( $services ), |
|
270 | + ConstraintsServices::getCheckResultSerializer($services), |
|
271 | + ConstraintsServices::getCheckResultDeserializer($services), |
|
272 | 272 | $wikiPageEntityMetaDataAccessor, |
273 | 273 | $entityIdParser, |
274 | - $config->get( 'WBQualityConstraintsCacheCheckConstraintsTTLSeconds' ), |
|
274 | + $config->get('WBQualityConstraintsCacheCheckConstraintsTTLSeconds'), |
|
275 | 275 | $possiblyStaleConstraintTypes, |
276 | - $config->get( 'WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds' ), |
|
277 | - ConstraintsServices::getLoggingHelper( $services ) |
|
276 | + $config->get('WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds'), |
|
277 | + ConstraintsServices::getLoggingHelper($services) |
|
278 | 278 | ); |
279 | 279 | } |
280 | 280 |