public functionmessage_count($msg_type = '', $reverse = false) {
/*
** returns the number of messages in the queue
** if $msg_type is defined, it returns the number of messages of the class $msg_type
*/if (empty($msg_type)) {
returncount($this->messages);
} else {
$msg_count = 0;
foreach($this->messages as$msg) {
if (strtolower($msg_type) ==strtolower(get_class($msg)) &&!$reverse) {
$msg_count++;
}
if (strtolower($msg_type) !=strtolower(get_class($msg)) &&$reverse) {
$msg_count++;
}
}
return$msg_count;
}
}