AnotherLadsgroup has uploaded a new change for review. ( 
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(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/46/366846/1

diff --git a/repo/includes/Api/GetEntities.php 
b/repo/includes/Api/GetEntities.php
index 8be6b2c..1b1b603 100644
--- a/repo/includes/Api/GetEntities.php
+++ b/repo/includes/Api/GetEntities.php
@@ -163,14 +163,20 @@
         */
        private function getEntityIdsFromIdParam( array $params ) {
                $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 ] );
-                               }
+               if ( !isset( $params['ids'] ) ) {
+                       return [];
+               }
+
+               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: newchange
Gerrit-Change-Id: I541c2ea96073aa73d6f8adf670d3c426b6f7ec5f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: AnotherLadsgroup <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to