jenkins-bot has submitted this change and it was merged.

Change subject: Minor clean up in CNChoiceDataResourceLoaderModule
......................................................................


Minor clean up in CNChoiceDataResourceLoaderModule

* Remove a few spurious line breaks.
* Use ! operator instead of count().
* Return inline empty array and move $dependencies lower down.

Change-Id: Ia398d275502d91bc221d6dbd80f7d7af58225e56
---
M includes/CNChoiceDataResourceLoaderModule.php
1 file changed, 5 insertions(+), 12 deletions(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/CNChoiceDataResourceLoaderModule.php 
b/includes/CNChoiceDataResourceLoaderModule.php
index 440bdda..422fd7d 100644
--- a/includes/CNChoiceDataResourceLoaderModule.php
+++ b/includes/CNChoiceDataResourceLoaderModule.php
@@ -47,9 +47,7 @@
         * @param string $language
         */
        protected function getFromDb( $project, $language ) {
-
                $choicesProvider = new ChoiceDataProvider( $project, $language 
);
-
                return $choicesProvider->getChoices();
        }
 
@@ -109,9 +107,7 @@
        public function getScript( ResourceLoaderContext $context ) {
 
                $choices = $this->getChoices( $context );
-
-               if ( count( $choices ) === 0 ) {
-
+               if ( !$choices ) {
                        // If there are no choices, this module will have no 
dependencies,
                        // but other modules that create mw.centralNotice may 
be brought
                        // in elsewhere. Let's the check for its existence 
here, too, for
@@ -146,18 +142,15 @@
                         return array();
                }
 
-
-               $dependencies = array();
-
                // Get the choices (possible campaigns and banners) for this 
user
                $choices = $this->getChoices( $context );
-
-               // If there are no choices, no dependencies
-               if ( count( $choices ) === 0 ) {
-                       return $dependencies;
+               if ( !$choices ) {
+                       // If there are no choices, no dependencies
+                       return array();
                }
 
                // Run through the choices to get all needed mixin RL modules
+               $dependencies = array();
                foreach ( $choices as $choice ) {
                        foreach ( $choice['mixins'] as $mixinName => 
$mixinParams ) {
 

-- 
To view, visit https://gerrit.wikimedia.org/r/290824
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia398d275502d91bc221d6dbd80f7d7af58225e56
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralNotice
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: AndyRussG <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Cdentinger <[email protected]>
Gerrit-Reviewer: Ejegg <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Ssmith <[email protected]>
Gerrit-Reviewer: XenoRyet <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to