* so that a lack of error-handling will be explicit.
*/
class Status {
- var $ok = true;
- var $value;
+ public $ok = true;
+ public $value;
/** Counters for batch operations */
- public $successCount = 0, $failCount = 0;
+ public $successCount = 0;
+ public $failCount = 0;
+
/** Array to indicate which items of the batch operations were successful */
public $success = array();
- /*semi-private*/ var $errors = array();
- /*semi-private*/ var $cleanCallback = false;
+ public $errors = array();
+ public $cleanCallback = false;
/**
* Factory function for fatal errors
}
} else {
$msgs = $this->getErrorMessageArray( $this->errors );
- $wrapper = new RawMessage( '* $' . implode( "\n* \$", range( 1, count( $msgs ) + 1 ) ) );
- $wrapper->params( $msgs )->parse();
+ $msgCount = count( $msgs );
+
+ if ( $shortContext ) {
+ $msgCount++;
+ }
+
+ $wrapper = new RawMessage( '* $' . implode( "\n* \$", range( 1, $msgCount ) ) );
+ $s = $wrapper->params( $msgs )->parse();
if ( $longContext ) {
$s = wfMessage( $longContext, $wrapper );
$s = wfMessage( $shortContext, $wrapper );
}
}
+
return $s;
}
/**
* Returns a list of status messages of the given type
* @param $type String
- *
* @return Array
*/
protected function getStatusArray( $type ) {
foreach ( $this->errors as $error ) {
if ( $error['type'] === $type ) {
if ( $error['message'] instanceof Message ) {
- $result[] = array_merge( array( $error['message']->getKey() ), $error['message']->getParams() );
+ $result[] = array_merge(
+ array( $error['message']->getKey() ),
+ $error['message']->getParams()
+ );
} elseif ( $error['params'] ) {
$result[] = array_merge( array( $error['message'] ), $error['params'] );
} else {
}
}
}
+
return $result;
}