Add SVG versions of enhanced recent changes collapse/show arrows
[lhc/web/wiklou.git] / includes / Status.php
index 928f8eb..dc0bae0 100644 (file)
  * 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
@@ -81,7 +83,7 @@ class Status {
         * @param $ok Boolean: whether the operation completed
         * @param $value Mixed
         */
-       function setResult( $ok, $value = null ) {
+       public function setResult( $ok, $value = null ) {
                $this->ok = $ok;
                $this->value = $value;
        }
@@ -92,7 +94,7 @@ class Status {
         *
         * @return Boolean
         */
-       function isGood() {
+       public function isGood() {
                return $this->ok && !$this->errors;
        }
 
@@ -101,7 +103,7 @@ class Status {
         *
         * @return Boolean
         */
-       function isOK() {
+       public function isOK() {
                return $this->ok;
        }
 
@@ -110,7 +112,7 @@ class Status {
         *
         * @param string|Message $message message name or object
         */
-       function warning( $message /*, parameters... */ ) {
+       public function warning( $message /*, parameters... */ ) {
                $params = array_slice( func_get_args(), 1 );
                $this->errors[] = array(
                        'type' => 'warning',
@@ -124,7 +126,7 @@ class Status {
         *
         * @param string|Message $message message name or object
         */
-       function error( $message /*, parameters... */ ) {
+       public function error( $message /*, parameters... */ ) {
                $params = array_slice( func_get_args(), 1 );
                $this->errors[] = array(
                        'type' => 'error',
@@ -138,7 +140,7 @@ class Status {
         *
         * @param string|Message $message message name or object
         */
-       function fatal( $message /*, parameters... */ ) {
+       public function fatal( $message /*, parameters... */ ) {
                $params = array_slice( func_get_args(), 1 );
                $this->errors[] = array(
                        'type' => 'error',
@@ -150,7 +152,7 @@ class Status {
        /**
         * Sanitize the callback parameter on wakeup, to avoid arbitrary execution.
         */
-       function __wakeup() {
+       public function __wakeup() {
                $this->cleanCallback = false;
        }
 
@@ -177,7 +179,7 @@ class Status {
         * @param string $longContext a long enclosing context message name, for a list
         * @return String
         */
-       function getWikiText( $shortContext = false, $longContext = false ) {
+       public function getWikiText( $shortContext = false, $longContext = false ) {
                if ( count( $this->errors ) == 0 ) {
                        if ( $this->ok ) {
                                $this->fatal( 'internalerror_info',
@@ -217,7 +219,7 @@ class Status {
         * @param string $longContext a long enclosing context message name, for a list
         * @return Message
         */
-       function getMessage( $shortContext = false, $longContext = false ) {
+       public function getMessage( $shortContext = false, $longContext = false ) {
                if ( count( $this->errors ) == 0 ) {
                        if ( $this->ok ) {
                                $this->fatal( 'internalerror_info',
@@ -237,7 +239,7 @@ class Status {
                                $s = wfMessage( $longContext, $wrapper );
                        }
                } else {
-                       $msgs =  $this->getErrorMessageArray( $this->errors );
+                       $msgs = $this->getErrorMessageArray( $this->errors );
                        $msgCount = count( $msgs );
 
                        if ( $shortContext ) {
@@ -314,7 +316,7 @@ class Status {
         * @param $other Status Other Status object
         * @param $overwriteValue Boolean: whether to override the "value" member
         */
-       function merge( $other, $overwriteValue = false ) {
+       public function merge( $other, $overwriteValue = false ) {
                $this->errors = array_merge( $this->errors, $other->errors );
                $this->ok = $this->ok && $other->ok;
                if ( $overwriteValue ) {
@@ -330,7 +332,7 @@ class Status {
         * @return array A list in which each entry is an array with a message key as its first element.
         *         The remaining array elements are the message parameters.
         */
-       function getErrorsArray() {
+       public function getErrorsArray() {
                return $this->getStatusArray( "error" );
        }
 
@@ -340,14 +342,13 @@ class Status {
         * @return array A list in which each entry is an array with a message key as its first element.
         *         The remaining array elements are the message parameters.
         */
-       function getWarningsArray() {
+       public function getWarningsArray() {
                return $this->getStatusArray( "warning" );
        }
 
        /**
         * Returns a list of status messages of the given type
         * @param $type String
-        *
         * @return Array
         */
        protected function getStatusArray( $type ) {
@@ -355,7 +356,10 @@ class Status {
                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 {
@@ -363,6 +367,7 @@ class Status {
                                }
                        }
                }
+
                return $result;
        }
 
@@ -393,7 +398,7 @@ class Status {
         * @param string $msg message name
         * @return Boolean
         */
-       function hasMessage( $msg ) {
+       public function hasMessage( $msg ) {
                foreach ( $this->errors as $error ) {
                        if ( $error['message'] === $msg ) {
                                return true;
@@ -413,7 +418,7 @@ class Status {
         * @param $dest Message|String: Replacement message key or object
         * @return bool Return true if the replacement was done, false otherwise.
         */
-       function replaceMessage( $source, $dest ) {
+       public function replaceMessage( $source, $dest ) {
                $replaced = false;
                foreach ( $this->errors as $index => $error ) {
                        if ( $error['message'] === $source ) {