protected function sortMessages(&$messages)
    {
        if (is_array($messages)) {
            ksort($messages);

            foreach ($messages as $key => &$value) {
                $this->sortMessages($value);
            }
        }
    }
protected function sortMessages(&$messages)
    {
        if (is_array($messages)) {
            ksort($messages);

            foreach ($messages as $key => &$value) {
                $this->sortMessages($value);
            }
        }
    }
protected function sortMessages ( & $ messages ) { if ( is_array ( $ messages ) ) { ksort ( $ messages ) ; foreach ( $ messages as $ key => & $ value ) { $ this -> sortMessages ( $ value ) ; } } }
Recursively sorts all messages by key.

@param array $messages The messages to sort by key.
Recursively sorts all messages by key .