public function countByFlag( $flag )
    {
        $flag = $this->normalizeFlag( $flag );
        $messages = $this->searchByFlag( $flag );
        return count( $messages );
    }
public function countByFlag( $flag )
    {
        $flag = $this->normalizeFlag( $flag );
        $messages = $this->searchByFlag( $flag );
        return count( $messages );
    }
public function countByFlag ( $ flag ) { $ flag = $ this -> normalizeFlag ( $ flag ) ; $ messages = $ this -> searchByFlag ( $ flag ) ; return count ( $ messages ) ; }
Wrapper function to fetch count of messages by a certain flag.

$flag can be one of:

Basic flags:
- ANSWERED   - message has been answered
- DELETED    - message is marked to be deleted by later EXPUNGE
- DRAFT      - message is marked as a draft
- FLAGGED    - message is "flagged" for urgent/special attention
- RECENT     - message is recent
- SEEN       - message has been read

Opposites of the above flags:
- UNANSWERED
- UNDELETED
- UNDRAFT
- UNFLAGGED
- OLD
- UNSEEN

Composite flags:
- NEW        - equivalent to RECENT + UNSEEN
- ALL        - all the messages

Before calling this method, a connection to the IMAP server must be
established and a user must be authenticated successfully, and a mailbox
must be selected.

@throws ezcMailTransportException
if a mailbox is not selected
or if the server sent a negative response
or if $flag is not valid
@param string $flag
@return int
Wrapper function to fetch count of messages by a certain flag .