Merge "Ticking 'Search in all namespaces' in prefs should disable other checkboxes"
[lhc/web/wiklou.git] / includes / api / ApiResult.php
index 39c114b..e922020 100644 (file)
@@ -26,9 +26,9 @@
 
 /**
  * This class represents the result of the API operations.
- * It simply wraps a nested array() structure, adding some functions to simplify array's modifications.
- * As various modules execute, they add different pieces of information to this result,
- * structuring it as it will be given to the client.
+ * It simply wraps a nested array() structure, adding some functions to simplify
+ * array's modifications. As various modules execute, they add different pieces
+ * of information to this result, structuring it as it will be given to the client.
  *
  * Each subarray may either be a dictionary - key-value pairs with unique keys,
  * or lists, where the items are added using $data[] = $value notation.
@@ -117,6 +117,7 @@ class ApiResult extends ApiBase {
                        // Objects can't always be cast to string
                        $s = strlen( $value );
                }
+
                return $s;
        }
 
@@ -150,14 +151,17 @@ class ApiResult extends ApiBase {
         * @param array $arr to add $value to
         * @param string $name Index of $arr to add $value at
         * @param $value mixed
-        * @param int $flags Zero or more OR-ed flags like OVERRIDE | ADD_ON_TOP. This parameter used to be
-        *        boolean, and the value of OVERRIDE=1 was specifically chosen so that it would be backwards
-        *        compatible with the new method signature.
+        * @param int $flags Zero or more OR-ed flags like OVERRIDE | ADD_ON_TOP.
+        *    This parameter used to be boolean, and the value of OVERRIDE=1 was
+        *    specifically chosen so that it would be backwards compatible with the
+        *    new method signature.
         *
         * @since 1.21 int $flags replaced boolean $override
         */
        public static function setElement( &$arr, $name, $value, $flags = 0 ) {
-               if ( $arr === null || $name === null || $value === null || !is_array( $arr ) || is_array( $name ) ) {
+               if ( $arr === null || $name === null || $value === null
+                       || !is_array( $arr ) || is_array( $name )
+               ) {
                        ApiBase::dieDebug( __METHOD__, 'Bad parameter' );
                }
 
@@ -176,7 +180,10 @@ class ApiResult extends ApiBase {
                                ApiBase::dieDebug( __METHOD__, "Attempting to merge element $name" );
                        }
                } else {
-                       ApiBase::dieDebug( __METHOD__, "Attempting to add element $name=$value, existing value is {$arr[$name]}" );
+                       ApiBase::dieDebug(
+                               __METHOD__,
+                               "Attempting to add element $name=$value, existing value is {$arr[$name]}"
+                       );
                }
        }
 
@@ -271,9 +278,10 @@ class ApiResult extends ApiBase {
         * @param $path array|string|null
         * @param $name string
         * @param $value mixed
-        * @param int $flags Zero or more OR-ed flags like OVERRIDE | ADD_ON_TOP. This parameter used to be
-        *        boolean, and the value of OVERRIDE=1 was specifically chosen so that it would be backwards
-        *        compatible with the new method signature.
+        * @param int $flags Zero or more OR-ed flags like OVERRIDE | ADD_ON_TOP. This
+        *    parameter used to be boolean, and the value of OVERRIDE=1 was specifically
+        *    chosen so that it would be backwards compatible with the new method
+        *    signature.
         * @return bool True if $value fits in the result, false if not
         *
         * @since 1.21 int $flags replaced boolean $override
@@ -287,7 +295,8 @@ class ApiResult extends ApiBase {
                        if ( $newsize > $wgAPIMaxResultSize ) {
                                $this->setWarning(
                                        "This result was truncated because it would otherwise be larger than the " .
-                                                       "limit of {$wgAPIMaxResultSize} bytes" );
+                                               "limit of {$wgAPIMaxResultSize} bytes" );
+
                                return false;
                        }
                        $this->mSize = $newsize;
@@ -322,6 +331,7 @@ class ApiResult extends ApiBase {
                        // Add named element
                        self::setElement( $data, $name, $value, $flags );
                }
+
                return true;
        }
 
@@ -394,6 +404,7 @@ class ApiResult extends ApiBase {
                        $result[] = $error;
                }
                $this->setIndexedTagName( $result, $errorType );
+
                return $result;
        }