jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/366846 )
Change subject: Lower level of nesting in GetEntities::getEntityIdsFromIdParam
......................................................................
Lower level of nesting in GetEntities::getEntityIdsFromIdParam
Cleaner code
Change-Id: I541c2ea96073aa73d6f8adf670d3c426b6f7ec5f
---
M repo/includes/Api/GetEntities.php
1 file changed, 14 insertions(+), 8 deletions(-)
Approvals:
jenkins-bot: Verified
Thiemo Mättig (WMDE): Looks good to me, approved
diff --git a/repo/includes/Api/GetEntities.php
b/repo/includes/Api/GetEntities.php
index 8be6b2c..a6e5805 100644
--- a/repo/includes/Api/GetEntities.php
+++ b/repo/includes/Api/GetEntities.php
@@ -162,15 +162,21 @@
* @return EntityId[]
*/
private function getEntityIdsFromIdParam( array $params ) {
+ if ( !isset( $params['ids'] ) ) {
+ return [];
+ }
+
$ids = [];
- if ( isset( $params['ids'] ) ) {
- foreach ( $params['ids'] as $id ) {
- try {
- $ids[] = $this->idParser->parse( $id );
- } catch ( EntityIdParsingException $e ) {
- $this->errorReporter->dieWithError( [
'no-such-entity', $id ], 'no-such-entity',
- 0, [ 'id' => $id ] );
- }
+ foreach ( $params['ids'] as $id ) {
+ try {
+ $ids[] = $this->idParser->parse( $id );
+ } catch ( EntityIdParsingException $e ) {
+ $this->errorReporter->dieWithError(
+ [ 'no-such-entity', $id ],
+ 'no-such-entity',
+ 0,
+ [ 'id' => $id ]
+ );
}
}
return $ids;
--
To view, visit https://gerrit.wikimedia.org/r/366846
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I541c2ea96073aa73d6f8adf670d3c426b6f7ec5f
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: AnotherLadsgroup <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits