- /**
- * Add all items from $values into the result
- * @param array $result Output
- * @param array $values Values to add
- * @param string $flag The name of the boolean flag to mark this element
- * @param string $name If given, name of the value
- */
- private static function addValues( array &$result, $values, $flag = null, $name = null ) {
- foreach ( $values as $val ) {
- if ( $val instanceof Title ) {
- $v = [];
- ApiQueryBase::addTitleInfo( $v, $val );
- } elseif ( $name !== null ) {
- $v = [ $name => $val ];
- } else {
- $v = $val;
- }
- if ( $flag !== null ) {
- $v[$flag] = true;
- }
- $result[] = $v;
- }
- }
-