public function prepareMailbox($remote_system_name = null, $port = null, $flags = null, $mailbox_name = null)
    {
        /*
         * If first parameter method is array
         */
        if(isset($remote_system_name) && is_array($remote_system_name)){
            $config = $remote_system_name;
            if(isset($config['remote_system_name'])){
                $remote_system_name = $config['remote_system_name'];
            }else{
                $remote_system_name = null;
            };
            if(isset($config['port'])){
                $port = $config['port'];
            }else{
                $port = null;
            };
            if(isset($config['flags'])){
                $flags = $config['flags'];
            }else{
                $flags = null;
            };
            if(isset($config['mailbox_name'])){
                $mailbox_name = $config['mailbox_name'];
            }else{
                $mailbox_name = null;
            };
        };

        if(!isset($remote_system_name) && isset($this->mailbox)){
            $remote_system_name = $this->mailbox;
        };
        if(empty($remote_system_name)){
            throw new ImapClientException('Mailbox is not installed');
        };
        /*
        if(is_null($port) && is_null($flags) && is_null($mailbox_name)){
            $this->mailbox = $remote_system_name;
            return;
        };
        */
        if(isset($port)){
            $port = ':'.$port;
        };
        if(!isset($flags) && isset($this->flags)){
            $flags = $this->flags;
        };
        $this->mailbox = '{'.$remote_system_name.$port.$flags.'}'.$mailbox_name;
    }
public function prepareMailbox($remote_system_name = null, $port = null, $flags = null, $mailbox_name = null)
    {
        /*
         * If first parameter method is array
         */
        if(isset($remote_system_name) && is_array($remote_system_name)){
            $config = $remote_system_name;
            if(isset($config['remote_system_name'])){
                $remote_system_name = $config['remote_system_name'];
            }else{
                $remote_system_name = null;
            };
            if(isset($config['port'])){
                $port = $config['port'];
            }else{
                $port = null;
            };
            if(isset($config['flags'])){
                $flags = $config['flags'];
            }else{
                $flags = null;
            };
            if(isset($config['mailbox_name'])){
                $mailbox_name = $config['mailbox_name'];
            }else{
                $mailbox_name = null;
            };
        };

        if(!isset($remote_system_name) && isset($this->mailbox)){
            $remote_system_name = $this->mailbox;
        };
        if(empty($remote_system_name)){
            throw new ImapClientException('Mailbox is not installed');
        };
        /*
        if(is_null($port) && is_null($flags) && is_null($mailbox_name)){
            $this->mailbox = $remote_system_name;
            return;
        };
        */
        if(isset($port)){
            $port = ':'.$port;
        };
        if(!isset($flags) && isset($this->flags)){
            $flags = $this->flags;
        };
        $this->mailbox = '{'.$remote_system_name.$port.$flags.'}'.$mailbox_name;
    }
public function prepareMailbox ( $ remote_system_name = null , $ port = null , $ flags = null , $ mailbox_name = null ) { /*
         * If first parameter method is array
         */ if ( isset ( $ remote_system_name ) && is_array ( $ remote_system_name ) ) { $ config = $ remote_system_name ; if ( isset ( $ config [ 'remote_system_name' ] ) ) { $ remote_system_name = $ config [ 'remote_system_name' ] ; } else { $ remote_system_name = null ; } ; if ( isset ( $ config [ 'port' ] ) ) { $ port = $ config [ 'port' ] ; } else { $ port = null ; } ; if ( isset ( $ config [ 'flags' ] ) ) { $ flags = $ config [ 'flags' ] ; } else { $ flags = null ; } ; if ( isset ( $ config [ 'mailbox_name' ] ) ) { $ mailbox_name = $ config [ 'mailbox_name' ] ; } else { $ mailbox_name = null ; } ; } ; if ( ! isset ( $ remote_system_name ) && isset ( $ this -> mailbox ) ) { $ remote_system_name = $ this -> mailbox ; } ; if ( empty ( $ remote_system_name ) ) { throw new ImapClientException ( 'Mailbox is not installed' ) ; } ; /*
        if(is_null($port) && is_null($flags) && is_null($mailbox_name)){
            $this->mailbox = $remote_system_name;
            return;
        };
        */ if ( isset ( $ port ) ) { $ port = ':' . $ port ; } ; if ( ! isset ( $ flags ) && isset ( $ this -> flags ) ) { $ flags = $ this -> flags ; } ; $ this -> mailbox = '{' . $ remote_system_name . $ port . $ flags . '}' . $ mailbox_name ; }
Prepare Mailbox string

Sets $this->mailbox to this type of
{server.imap:431/imap/ssl/novalidate-cert}INBOX

Use as follows:

prepareMailbox( null, $port = 431, null)
or
prepareMailbox([
'port' => 431
])

@param string|array $remote_system_name
@param string $port
@param string $flags can use prepareFlags() method but not necessarily
@param string $mailbox_name
@return void
@throws ImapClientException
Prepare Mailbox string