Completed
Push — master ( bdc8a9...c23f06 )
by
unknown
01:58
created
includes/ConstraintLookup.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,6 +14,6 @@
 block discarded – undo
14 14
 	 *
15 15
 	 * @return Constraint[]
16 16
 	 */
17
-	public function queryConstraintsForProperty( PropertyId $propertyId );
17
+	public function queryConstraintsForProperty(PropertyId $propertyId);
18 18
 
19 19
 }
Please login to merge, or discard this patch.
WikibaseQualityConstraints.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( function_exists( 'wfLoadExtension' ) ) {
4
-	wfLoadExtension( 'WikibaseQualityConstraints', __DIR__ . '/extension.json' );
3
+if (function_exists('wfLoadExtension')) {
4
+	wfLoadExtension('WikibaseQualityConstraints', __DIR__.'/extension.json');
5 5
 	// Keep i18n globals so mergeMessageFileList.php doesn't break
6
-	$wgMessagesDirs['WikibaseQualityConstraints'] = __DIR__ . '/i18n';
7
-	$wgExtensionMessagesFiles['WikibaseQualityConstraintsAlias'] = __DIR__ . '/WikibaseQualityConstraints.alias.php';
6
+	$wgMessagesDirs['WikibaseQualityConstraints'] = __DIR__.'/i18n';
7
+	$wgExtensionMessagesFiles['WikibaseQualityConstraintsAlias'] = __DIR__.'/WikibaseQualityConstraints.alias.php';
8 8
 	/* wfWarn(
9 9
 		'Deprecated PHP entry point used for WikibaseQualityConstraints extension. ' .
10 10
 		'Please use wfLoadExtension instead, ' .
@@ -12,5 +12,5 @@  discard block
 block discarded – undo
12 12
 	); */
13 13
 	return;
14 14
 } else {
15
-	die( 'This version of the WikibaseQualityConstraints extension requires MediaWiki 1.25+' );
15
+	die('This version of the WikibaseQualityConstraints extension requires MediaWiki 1.25+');
16 16
 }
Please login to merge, or discard this patch.
includes/CachingConstraintLookup.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	/**
27 27
 	 * @var ConstraintLookup $lookup The lookup to which all queries are delegated.
28 28
 	 */
29
-	public function __construct( ConstraintLookup $lookup ) {
29
+	public function __construct(ConstraintLookup $lookup) {
30 30
 		$this->lookup = $lookup;
31 31
 	}
32 32
 
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @return Constraint[]
37 37
 	 */
38
-	public function queryConstraintsForProperty( PropertyId $propertyId ) {
38
+	public function queryConstraintsForProperty(PropertyId $propertyId) {
39 39
 		$id = $propertyId->getSerialization();
40
-		if ( !array_key_exists( $id, $this->cache ) ) {
41
-			$this->cache[$id] = $this->lookup->queryConstraintsForProperty( $propertyId );
40
+		if (!array_key_exists($id, $this->cache)) {
41
+			$this->cache[$id] = $this->lookup->queryConstraintsForProperty($propertyId);
42 42
 		}
43 43
 		return $this->cache[$id];
44 44
 	}
Please login to merge, or discard this patch.
includes/ConstraintCheck/Helper/ValueCountCheckerHelper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@
 block discarded – undo
24 24
 	 *
25 25
 	 * @return int[]
26 26
 	 */
27
-	public function getPropertyCount( StatementList $statements ) {
28
-		if ( !isset( $this->propertyCount ) ) {
27
+	public function getPropertyCount(StatementList $statements) {
28
+		if (!isset($this->propertyCount)) {
29 29
 			$this->propertyCount = [];
30 30
 
31 31
 			/** @var Statement $statement */
32
-			foreach ( $statements as $statement ) {
32
+			foreach ($statements as $statement) {
33 33
 				$counter = $statement->getRank() === Statement::RANK_DEPRECATED ? 0 : 1;
34
-				if ( array_key_exists( $statement->getPropertyId()->getSerialization(), $this->propertyCount ) ) {
34
+				if (array_key_exists($statement->getPropertyId()->getSerialization(), $this->propertyCount)) {
35 35
 					$this->propertyCount[$statement->getPropertyId()->getSerialization()] += $counter;
36 36
 				} else {
37 37
 					$this->propertyCount[$statement->getPropertyId()->getSerialization()] = $counter;
Please login to merge, or discard this patch.
includes/ConstraintCheck/Helper/ConstraintParameterException.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@
 block discarded – undo
16 16
 	/**
17 17
 	 * @param string $message HTML
18 18
 	 */
19
-	public function __construct( $message ) {
20
-		parent::__construct( $message );
19
+	public function __construct($message) {
20
+		parent::__construct($message);
21 21
 	}
22 22
 
23 23
 }
Please login to merge, or discard this patch.
includes/ConstraintCheck/Helper/SparqlHelperException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 class SparqlHelperException extends RuntimeException {
11 11
 
12 12
 	public function __construct() {
13
-		parent::__construct( 'The SPARQL query endpoint returned an error.' );
13
+		parent::__construct('The SPARQL query endpoint returned an error.');
14 14
 	}
15 15
 
16 16
 }
Please login to merge, or discard this patch.
WikibaseQualityConstraints.alias.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,5 +10,5 @@
 block discarded – undo
10 10
 
11 11
 /** English (English) */
12 12
 $specialPageAliases['en'] = [
13
-	'ConstraintReport' => [ 'ConstraintReport', 'Constraint Report' ],
13
+	'ConstraintReport' => ['ConstraintReport', 'Constraint Report'],
14 14
 ];
Please login to merge, or discard this patch.
api/CheckConstraintParameters.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
 	 *
60 60
 	 * @return self
61 61
 	 */
62
-	public static function newFromGlobalState( ApiMain $main, $name, $prefix = '' ) {
62
+	public static function newFromGlobalState(ApiMain $main, $name, $prefix = '') {
63 63
 		$constraintReportFactory = ConstraintReportFactory::getDefaultInstance();
64 64
 		$repo = WikibaseRepo::getDefaultInstance();
65
-		$helperFactory = $repo->getApiHelperFactory( RequestContext::getMain() );
65
+		$helperFactory = $repo->getApiHelperFactory(RequestContext::getMain());
66 66
 		return new self(
67 67
 			$main,
68 68
 			$name,
@@ -89,53 +89,53 @@  discard block
 block discarded – undo
89 89
 		DelegatingConstraintChecker $delegatingConstraintChecker,
90 90
 		StatementGuidParser $statementGuidParser
91 91
 	) {
92
-		parent::__construct( $main, $name, $prefix );
92
+		parent::__construct($main, $name, $prefix);
93 93
 
94
-		$this->apiErrorReporter = $apiHelperFactory->getErrorReporter( $this );
94
+		$this->apiErrorReporter = $apiHelperFactory->getErrorReporter($this);
95 95
 		$this->delegatingConstraintChecker = $delegatingConstraintChecker;
96 96
 		$this->statementGuidParser = $statementGuidParser;
97 97
 	}
98 98
 
99 99
 	public function execute() {
100 100
 		MediaWikiServices::getInstance()->getStatsdDataFactory()
101
-			->increment( 'wikibase.quality.constraints.api.checkConstraintParameters.execute' );
101
+			->increment('wikibase.quality.constraints.api.checkConstraintParameters.execute');
102 102
 
103 103
 		$params = $this->extractRequestParams();
104 104
 		$result = $this->getResult();
105 105
 
106
-		$propertyIds = $this->parsePropertyIds( $params[self::PARAM_PROPERTY_ID] );
107
-		$constraintIds = $this->parseConstraintIds( $params[self::PARAM_CONSTRAINT_ID] );
106
+		$propertyIds = $this->parsePropertyIds($params[self::PARAM_PROPERTY_ID]);
107
+		$constraintIds = $this->parseConstraintIds($params[self::PARAM_CONSTRAINT_ID]);
108 108
 
109
-		$this->checkPropertyIds( $propertyIds, $result );
110
-		$this->checkConstraintIds( $constraintIds, $result );
109
+		$this->checkPropertyIds($propertyIds, $result);
110
+		$this->checkConstraintIds($constraintIds, $result);
111 111
 
112
-		$result->addValue( null, 'success', 1 );
112
+		$result->addValue(null, 'success', 1);
113 113
 	}
114 114
 
115 115
 	/**
116 116
 	 * @param array|null $propertyIdSerializations
117 117
 	 * @return PropertyId[]
118 118
 	 */
119
-	private function parsePropertyIds( $propertyIdSerializations ) {
120
-		if ( $propertyIdSerializations === null ) {
119
+	private function parsePropertyIds($propertyIdSerializations) {
120
+		if ($propertyIdSerializations === null) {
121 121
 			return [];
122
-		} elseif ( empty( $propertyIdSerializations ) ) {
122
+		} elseif (empty($propertyIdSerializations)) {
123 123
 			$this->apiErrorReporter->dieError(
124
-				'If ' . self::PARAM_PROPERTY_ID . ' is specified, it must be nonempty.',
124
+				'If '.self::PARAM_PROPERTY_ID.' is specified, it must be nonempty.',
125 125
 				'no-data'
126 126
 			);
127 127
 		}
128 128
 
129 129
 		return array_map(
130
-			function( $propertyIdSerialization ) {
130
+			function($propertyIdSerialization) {
131 131
 				try {
132
-					return new PropertyId( $propertyIdSerialization );
133
-				} catch ( InvalidArgumentException $e ) {
132
+					return new PropertyId($propertyIdSerialization);
133
+				} catch (InvalidArgumentException $e) {
134 134
 					$this->apiErrorReporter->dieError(
135 135
 						"Invalid id: $propertyIdSerialization",
136 136
 						'invalid-property-id',
137 137
 						0, // default argument
138
-						[ self::PARAM_PROPERTY_ID => $propertyIdSerialization ]
138
+						[self::PARAM_PROPERTY_ID => $propertyIdSerialization]
139 139
 					);
140 140
 				}
141 141
 			},
@@ -147,35 +147,35 @@  discard block
 block discarded – undo
147 147
 	 * @param array|null $constraintIds
148 148
 	 * @return string[]
149 149
 	 */
150
-	private function parseConstraintIds( $constraintIds ) {
151
-		if ( $constraintIds === null ) {
150
+	private function parseConstraintIds($constraintIds) {
151
+		if ($constraintIds === null) {
152 152
 			return [];
153
-		} elseif ( empty( $constraintIds ) ) {
153
+		} elseif (empty($constraintIds)) {
154 154
 			$this->apiErrorReporter->dieError(
155
-				'If ' . self::PARAM_CONSTRAINT_ID . ' is specified, it must be nonempty.',
155
+				'If '.self::PARAM_CONSTRAINT_ID.' is specified, it must be nonempty.',
156 156
 				'no-data'
157 157
 			);
158 158
 		}
159 159
 
160 160
 		return array_map(
161
-			function( $constraintId ) {
161
+			function($constraintId) {
162 162
 				try {
163
-					$propertyId = $this->statementGuidParser->parse( $constraintId )->getEntityId();
164
-					if ( !$propertyId instanceof PropertyId ) {
163
+					$propertyId = $this->statementGuidParser->parse($constraintId)->getEntityId();
164
+					if (!$propertyId instanceof PropertyId) {
165 165
 						$this->apiErrorReporter->dieError(
166 166
 							"Invalid property ID: {$propertyId->getSerialization()}",
167 167
 							'invalid-property-id',
168 168
 							0, // default argument
169
-							[ self::PARAM_CONSTRAINT_ID => $constraintId ]
169
+							[self::PARAM_CONSTRAINT_ID => $constraintId]
170 170
 						);
171 171
 					}
172 172
 					return $constraintId;
173
-				} catch ( StatementGuidParsingException $e ) {
173
+				} catch (StatementGuidParsingException $e) {
174 174
 					$this->apiErrorReporter->dieError(
175 175
 						"Invalid statement GUID: $constraintId",
176 176
 						'invalid-guid',
177 177
 						0, // default argument
178
-						[ self::PARAM_CONSTRAINT_ID => $constraintId ]
178
+						[self::PARAM_CONSTRAINT_ID => $constraintId]
179 179
 					);
180 180
 				}
181 181
 			},
@@ -187,12 +187,12 @@  discard block
 block discarded – undo
187 187
 	 * @param PropertyId[] $propertyIds
188 188
 	 * @param ApiResult $result
189 189
 	 */
190
-	private function checkPropertyIds( array $propertyIds, ApiResult $result ) {
191
-		foreach ( $propertyIds as $propertyId ) {
192
-			$result->addArrayType( $this->getResultPathForPropertyId( $propertyId ), 'assoc' );
193
-			$allConstraintExceptions = $this->delegatingConstraintChecker->checkConstraintParametersOnPropertyId( $propertyId );
194
-			foreach ( $allConstraintExceptions as $constraintId => $constraintParameterExceptions ) {
195
-				$this->addConstraintParameterExceptionsToResult( $constraintId, $constraintParameterExceptions, $result );
190
+	private function checkPropertyIds(array $propertyIds, ApiResult $result) {
191
+		foreach ($propertyIds as $propertyId) {
192
+			$result->addArrayType($this->getResultPathForPropertyId($propertyId), 'assoc');
193
+			$allConstraintExceptions = $this->delegatingConstraintChecker->checkConstraintParametersOnPropertyId($propertyId);
194
+			foreach ($allConstraintExceptions as $constraintId => $constraintParameterExceptions) {
195
+				$this->addConstraintParameterExceptionsToResult($constraintId, $constraintParameterExceptions, $result);
196 196
 			}
197 197
 		}
198 198
 	}
@@ -201,14 +201,14 @@  discard block
 block discarded – undo
201 201
 	 * @param string[] $constraintIds
202 202
 	 * @param ApiResult $result
203 203
 	 */
204
-	private function checkConstraintIds( array $constraintIds, ApiResult $result ) {
205
-		foreach ( $constraintIds as $constraintId ) {
206
-			if ( $result->getResultData( $this->getResultPathForConstraintId( $constraintId ) ) ) {
204
+	private function checkConstraintIds(array $constraintIds, ApiResult $result) {
205
+		foreach ($constraintIds as $constraintId) {
206
+			if ($result->getResultData($this->getResultPathForConstraintId($constraintId))) {
207 207
 				// already checked as part of checkPropertyIds()
208 208
 				continue;
209 209
 			}
210
-			$constraintParameterExceptions = $this->delegatingConstraintChecker->checkConstraintParametersOnConstraintId( $constraintId );
211
-			$this->addConstraintParameterExceptionsToResult( $constraintId, $constraintParameterExceptions, $result );
210
+			$constraintParameterExceptions = $this->delegatingConstraintChecker->checkConstraintParametersOnConstraintId($constraintId);
211
+			$this->addConstraintParameterExceptionsToResult($constraintId, $constraintParameterExceptions, $result);
212 212
 		}
213 213
 	}
214 214
 
@@ -216,17 +216,17 @@  discard block
 block discarded – undo
216 216
 	 * @param PropertyId $propertyId
217 217
 	 * @return string[]
218 218
 	 */
219
-	private function getResultPathForPropertyId( PropertyId $propertyId ) {
220
-		return [ $this->getModuleName(), $propertyId->getSerialization() ];
219
+	private function getResultPathForPropertyId(PropertyId $propertyId) {
220
+		return [$this->getModuleName(), $propertyId->getSerialization()];
221 221
 	}
222 222
 
223 223
 	/**
224 224
 	 * @param string $constraintId
225 225
 	 * @return string[]
226 226
 	 */
227
-	private function getResultPathForConstraintId( $constraintId ) {
228
-		$propertyId = $this->statementGuidParser->parse( $constraintId )->getEntityId();
229
-		return array_merge( $this->getResultPathForPropertyId( $propertyId ), [ $constraintId ] );
227
+	private function getResultPathForConstraintId($constraintId) {
228
+		$propertyId = $this->statementGuidParser->parse($constraintId)->getEntityId();
229
+		return array_merge($this->getResultPathForPropertyId($propertyId), [$constraintId]);
230 230
 	}
231 231
 
232 232
 	/**
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
 	 * @param ConstraintParameterException[]|null $constraintParameterExceptions
237 237
 	 * @param ApiResult $result
238 238
 	 */
239
-	private function addConstraintParameterExceptionsToResult( $constraintId, $constraintParameterExceptions, ApiResult $result ) {
240
-		$path = $this->getResultPathForConstraintId( $constraintId );
241
-		if ( $constraintParameterExceptions === null ) {
239
+	private function addConstraintParameterExceptionsToResult($constraintId, $constraintParameterExceptions, ApiResult $result) {
240
+		$path = $this->getResultPathForConstraintId($constraintId);
241
+		if ($constraintParameterExceptions === null) {
242 242
 			$result->addValue(
243 243
 				$path,
244 244
 				self::KEY_STATUS,
@@ -248,12 +248,12 @@  discard block
 block discarded – undo
248 248
 			$result->addValue(
249 249
 				$path,
250 250
 				self::KEY_STATUS,
251
-				empty( $constraintParameterExceptions ) ? self::STATUS_OKAY : self::STATUS_NOT_OKAY
251
+				empty($constraintParameterExceptions) ? self::STATUS_OKAY : self::STATUS_NOT_OKAY
252 252
 			);
253 253
 			$result->addValue(
254 254
 				$path,
255 255
 				self::KEY_PROBLEMS,
256
-				array_map( [ $this, 'formatConstraintParameterException' ], $constraintParameterExceptions )
256
+				array_map([$this, 'formatConstraintParameterException'], $constraintParameterExceptions)
257 257
 			);
258 258
 		}
259 259
 	}
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	 * @param ConstraintParameterException $e
265 265
 	 * @return array
266 266
 	 */
267
-	private function formatConstraintParameterException( ConstraintParameterException $e ) {
267
+	private function formatConstraintParameterException(ConstraintParameterException $e) {
268 268
 		return [
269 269
 			self::KEY_MESSAGE_HTML => $e->getMessage(),
270 270
 		];
Please login to merge, or discard this patch.
includes/ConstraintParameterRenderer.php 1 patch
Spacing   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -60,20 +60,20 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @return string HTML
62 62
 	 */
63
-	public function formatValue( $value ) {
64
-		if ( is_string( $value ) ) {
63
+	public function formatValue($value) {
64
+		if (is_string($value)) {
65 65
 			// Cases like 'Format' 'pattern' or 'minimum'/'maximum' values, which we have stored as
66 66
 			// strings
67
-			return htmlspecialchars( $value );
68
-		} elseif ( $value instanceof EntityId ) {
67
+			return htmlspecialchars($value);
68
+		} elseif ($value instanceof EntityId) {
69 69
 			// Cases like 'Conflicts with' 'property', to which we can link
70
-			return $this->formatEntityId( $value );
71
-		} elseif ( $value instanceof ItemIdSnakValue ) {
70
+			return $this->formatEntityId($value);
71
+		} elseif ($value instanceof ItemIdSnakValue) {
72 72
 			// Cases like EntityId but can also be somevalue or novalue
73
-			return $this->formatItemIdSnakValue( $value );
73
+			return $this->formatItemIdSnakValue($value);
74 74
 		} else {
75 75
 			// Cases where we format a DataValue
76
-			return $this->formatDataValue( $value );
76
+			return $this->formatDataValue($value);
77 77
 		}
78 78
 	}
79 79
 
@@ -84,23 +84,23 @@  discard block
 block discarded – undo
84 84
 	 *
85 85
 	 * @return string HTML
86 86
 	 */
87
-	public function formatParameters( $parameters ) {
88
-		if ( $parameters === null || count( $parameters ) == 0 ) {
87
+	public function formatParameters($parameters) {
88
+		if ($parameters === null || count($parameters) == 0) {
89 89
 			return null;
90 90
 		}
91 91
 
92
-		$valueFormatter = function ( $value ) {
93
-			return $this->formatValue( $value );
92
+		$valueFormatter = function($value) {
93
+			return $this->formatValue($value);
94 94
 		};
95 95
 
96 96
 		$formattedParameters = [];
97
-		foreach ( $parameters as $parameterName => $parameterValue ) {
98
-			$formattedParameterValues = implode( ', ',
99
-				$this->limitArrayLength( array_map( $valueFormatter, $parameterValue ) ) );
100
-			$formattedParameters[] = sprintf( '%s: %s', $parameterName, $formattedParameterValues );
97
+		foreach ($parameters as $parameterName => $parameterValue) {
98
+			$formattedParameterValues = implode(', ',
99
+				$this->limitArrayLength(array_map($valueFormatter, $parameterValue)));
100
+			$formattedParameters[] = sprintf('%s: %s', $parameterName, $formattedParameterValues);
101 101
 		}
102 102
 
103
-		return implode( '; ', $formattedParameters );
103
+		return implode('; ', $formattedParameters);
104 104
 	}
105 105
 
106 106
 	/**
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 	 *
111 111
 	 * @return array
112 112
 	 */
113
-	private function limitArrayLength( array $array ) {
114
-		if ( count( $array ) > self::MAX_PARAMETER_ARRAY_LENGTH ) {
115
-			$array = array_slice( $array, 0, self::MAX_PARAMETER_ARRAY_LENGTH );
116
-			array_push( $array, '...' );
113
+	private function limitArrayLength(array $array) {
114
+		if (count($array) > self::MAX_PARAMETER_ARRAY_LENGTH) {
115
+			$array = array_slice($array, 0, self::MAX_PARAMETER_ARRAY_LENGTH);
116
+			array_push($array, '...');
117 117
 		}
118 118
 
119 119
 		return $array;
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
 	 * @param string $value HTML
127 127
 	 * @return string HTML
128 128
 	 */
129
-	public static function formatByRole( $role, $value ) {
130
-		if ( $role === null ) {
129
+	public static function formatByRole($role, $value) {
130
+		if ($role === null) {
131 131
 			return $value;
132 132
 		}
133 133
 
134
-		return '<span class="wbqc-role wbqc-role-' . htmlspecialchars( $role ) . '">'
134
+		return '<span class="wbqc-role wbqc-role-'.htmlspecialchars($role).'">'
135 135
 			. $value
136 136
 			. '</span>';
137 137
 	}
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
 	 * @param string|null $role one of the Role constants or null
142 142
 	 * @return string HTML
143 143
 	 */
144
-	public function formatDataValue( DataValue $value, $role = null ) {
145
-		return self::formatByRole( $role,
146
-			$this->dataValueFormatter->format( $value ) );
144
+	public function formatDataValue(DataValue $value, $role = null) {
145
+		return self::formatByRole($role,
146
+			$this->dataValueFormatter->format($value));
147 147
 	}
148 148
 
149 149
 	/**
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
 	 * @param string|null $role one of the Role constants or null
152 152
 	 * @return string HTML
153 153
 	 */
154
-	public function formatEntityId( EntityId $entityId, $role = null ) {
155
-		return self::formatByRole( $role,
156
-			$this->entityIdLabelFormatter->formatEntityId( $entityId ) );
154
+	public function formatEntityId(EntityId $entityId, $role = null) {
155
+		return self::formatByRole($role,
156
+			$this->entityIdLabelFormatter->formatEntityId($entityId));
157 157
 	}
158 158
 
159 159
 	/**
@@ -165,18 +165,18 @@  discard block
 block discarded – undo
165 165
 	 * @param string|null $role one of the Role constants or null
166 166
 	 * @return string HTML
167 167
 	 */
168
-	public function formatPropertyId( $propertyId, $role = null ) {
169
-		if ( $propertyId instanceof PropertyId ) {
170
-			return $this->formatEntityId( $propertyId, $role );
171
-		} elseif ( is_string( $propertyId ) ) {
168
+	public function formatPropertyId($propertyId, $role = null) {
169
+		if ($propertyId instanceof PropertyId) {
170
+			return $this->formatEntityId($propertyId, $role);
171
+		} elseif (is_string($propertyId)) {
172 172
 			try {
173
-				return $this->formatEntityId( new PropertyId( $propertyId ), $role );
174
-			} catch ( InvalidArgumentException $e ) {
175
-				return self::formatByRole( $role,
176
-					htmlspecialchars( $propertyId ) );
173
+				return $this->formatEntityId(new PropertyId($propertyId), $role);
174
+			} catch (InvalidArgumentException $e) {
175
+				return self::formatByRole($role,
176
+					htmlspecialchars($propertyId));
177 177
 			}
178 178
 		} else {
179
-			throw new InvalidArgumentException( '$propertyId must be either PropertyId or string' );
179
+			throw new InvalidArgumentException('$propertyId must be either PropertyId or string');
180 180
 		}
181 181
 	}
182 182
 
@@ -189,18 +189,18 @@  discard block
 block discarded – undo
189 189
 	 * @param string|null $role one of the Role constants or null
190 190
 	 * @return string HTML
191 191
 	 */
192
-	public function formatItemId( $itemId, $role = null ) {
193
-		if ( $itemId instanceof ItemId ) {
194
-			return $this->formatEntityId( $itemId, $role );
195
-		} elseif ( is_string( $itemId ) ) {
192
+	public function formatItemId($itemId, $role = null) {
193
+		if ($itemId instanceof ItemId) {
194
+			return $this->formatEntityId($itemId, $role);
195
+		} elseif (is_string($itemId)) {
196 196
 			try {
197
-				return $this->formatEntityId( new ItemId( $itemId ), $role );
198
-			} catch ( InvalidArgumentException $e ) {
199
-				return self::formatByRole( $role,
200
-					htmlspecialchars( $itemId ) );
197
+				return $this->formatEntityId(new ItemId($itemId), $role);
198
+			} catch (InvalidArgumentException $e) {
199
+				return self::formatByRole($role,
200
+					htmlspecialchars($itemId));
201 201
 			}
202 202
 		} else {
203
-			throw new InvalidArgumentException( '$itemId must be either ItemId or string' );
203
+			throw new InvalidArgumentException('$itemId must be either ItemId or string');
204 204
 		}
205 205
 	}
206 206
 
@@ -211,20 +211,20 @@  discard block
 block discarded – undo
211 211
 	 * @param string|null $role one of the Role constants or null
212 212
 	 * @return string HTML
213 213
 	 */
214
-	public function formatItemIdSnakValue( ItemIdSnakValue $value, $role = null ) {
215
-		switch ( true ) {
214
+	public function formatItemIdSnakValue(ItemIdSnakValue $value, $role = null) {
215
+		switch (true) {
216 216
 			case $value->isValue():
217
-				return $this->formatEntityId( $value->getItemId(), $role );
217
+				return $this->formatEntityId($value->getItemId(), $role);
218 218
 			case $value->isSomeValue():
219
-				return self::formatByRole( $role,
219
+				return self::formatByRole($role,
220 220
 					'<span class="wikibase-snakview-variation-somevaluesnak">'
221
-						. wfMessage( 'wikibase-snakview-snaktypeselector-somevalue' )->escaped()
222
-						. '</span>' );
221
+						. wfMessage('wikibase-snakview-snaktypeselector-somevalue')->escaped()
222
+						. '</span>');
223 223
 			case $value->isNoValue():
224
-				return self::formatByRole( $role,
224
+				return self::formatByRole($role,
225 225
 					'<span class="wikibase-snakview-variation-novaluesnak">'
226
-						. wfMessage( 'wikibase-snakview-snaktypeselector-novalue' )->escaped()
227
-						. '</span>' );
226
+						. wfMessage('wikibase-snakview-snaktypeselector-novalue')->escaped()
227
+						. '</span>');
228 228
 		}
229 229
 	}
230 230
 
@@ -238,15 +238,15 @@  discard block
 block discarded – undo
238 238
 	 * @param string|null $role one of the Role constants or null
239 239
 	 * @return string[] HTML
240 240
 	 */
241
-	public function formatPropertyIdList( array $propertyIds, $role = null ) {
242
-		if ( empty( $propertyIds ) ) {
243
-			return [ '<ul></ul>' ];
241
+	public function formatPropertyIdList(array $propertyIds, $role = null) {
242
+		if (empty($propertyIds)) {
243
+			return ['<ul></ul>'];
244 244
 		}
245
-		$propertyIds = $this->limitArrayLength( $propertyIds );
246
-		$formattedPropertyIds = array_map( [ $this, "formatPropertyId" ], $propertyIds, array_fill( 0, count( $propertyIds ), $role ) );
245
+		$propertyIds = $this->limitArrayLength($propertyIds);
246
+		$formattedPropertyIds = array_map([$this, "formatPropertyId"], $propertyIds, array_fill(0, count($propertyIds), $role));
247 247
 		array_unshift(
248 248
 			$formattedPropertyIds,
249
-			'<ul><li>' . implode( '</li><li>', $formattedPropertyIds ) . '</li></ul>'
249
+			'<ul><li>'.implode('</li><li>', $formattedPropertyIds).'</li></ul>'
250 250
 		);
251 251
 		return $formattedPropertyIds;
252 252
 	}
@@ -261,15 +261,15 @@  discard block
 block discarded – undo
261 261
 	 * @param string|null $role one of the Role constants or null
262 262
 	 * @return string[] HTML
263 263
 	 */
264
-	public function formatItemIdList( array $itemIds, $role = null ) {
265
-		if ( empty( $itemIds ) ) {
266
-			return [ '<ul></ul>' ];
264
+	public function formatItemIdList(array $itemIds, $role = null) {
265
+		if (empty($itemIds)) {
266
+			return ['<ul></ul>'];
267 267
 		}
268
-		$itemIds = $this->limitArrayLength( $itemIds );
269
-		$formattedItemIds = array_map( [ $this, "formatItemId" ], $itemIds, array_fill( 0, count( $itemIds ), $role ) );
268
+		$itemIds = $this->limitArrayLength($itemIds);
269
+		$formattedItemIds = array_map([$this, "formatItemId"], $itemIds, array_fill(0, count($itemIds), $role));
270 270
 		array_unshift(
271 271
 			$formattedItemIds,
272
-			'<ul><li>' . implode( '</li><li>', $formattedItemIds ) . '</li></ul>'
272
+			'<ul><li>'.implode('</li><li>', $formattedItemIds).'</li></ul>'
273 273
 		);
274 274
 		return $formattedItemIds;
275 275
 	}
@@ -284,23 +284,23 @@  discard block
 block discarded – undo
284 284
 	 * @param string|null $role one of the Role constants or null
285 285
 	 * @return string[] HTML
286 286
 	 */
287
-	public function formatEntityIdList( array $entityIds, $role = null ) {
288
-		if ( empty( $entityIds ) ) {
289
-			return [ '<ul></ul>' ];
287
+	public function formatEntityIdList(array $entityIds, $role = null) {
288
+		if (empty($entityIds)) {
289
+			return ['<ul></ul>'];
290 290
 		}
291 291
 		$formattedEntityIds = [];
292
-		foreach ( $entityIds as $entityId ) {
293
-			if ( count( $formattedEntityIds ) >= self::MAX_PARAMETER_ARRAY_LENGTH ) {
292
+		foreach ($entityIds as $entityId) {
293
+			if (count($formattedEntityIds) >= self::MAX_PARAMETER_ARRAY_LENGTH) {
294 294
 				$formattedEntityIds[] = '...';
295 295
 				break;
296 296
 			}
297
-			if ( $entityId !== null ) {
298
-				$formattedEntityIds[] = $this->formatEntityId( $entityId, $role );
297
+			if ($entityId !== null) {
298
+				$formattedEntityIds[] = $this->formatEntityId($entityId, $role);
299 299
 			}
300 300
 		}
301 301
 		array_unshift(
302 302
 			$formattedEntityIds,
303
-			'<ul><li>' . implode( '</li><li>', $formattedEntityIds ) . '</li></ul>'
303
+			'<ul><li>'.implode('</li><li>', $formattedEntityIds).'</li></ul>'
304 304
 		);
305 305
 		return $formattedEntityIds;
306 306
 	}
@@ -315,24 +315,24 @@  discard block
 block discarded – undo
315 315
 	 * @param string|null $role one of the Role constants or null
316 316
 	 * @return string[] HTML
317 317
 	 */
318
-	public function formatItemIdSnakValueList( array $values, $role = null ) {
319
-		if ( empty( $values ) ) {
320
-			return [ '<ul></ul>' ];
318
+	public function formatItemIdSnakValueList(array $values, $role = null) {
319
+		if (empty($values)) {
320
+			return ['<ul></ul>'];
321 321
 		}
322
-		$values = $this->limitArrayLength( $values );
322
+		$values = $this->limitArrayLength($values);
323 323
 		$formattedValues = array_map(
324
-			function( $value ) use ( $role ) {
325
-				if ( $value === '...' ) {
324
+			function($value) use ($role) {
325
+				if ($value === '...') {
326 326
 					return '...';
327 327
 				} else {
328
-					return $this->formatItemIdSnakValue( $value, $role );
328
+					return $this->formatItemIdSnakValue($value, $role);
329 329
 				}
330 330
 			},
331 331
 			$values
332 332
 		);
333 333
 		array_unshift(
334 334
 			$formattedValues,
335
-			'<ul><li>' . implode( '</li><li>', $formattedValues ) . '</li></ul>'
335
+			'<ul><li>'.implode('</li><li>', $formattedValues).'</li></ul>'
336 336
 		);
337 337
 		return $formattedValues;
338 338
 	}
Please login to merge, or discard this patch.