protected function _splitAddresses($address)
    {
        if (!empty($this->limit) && count($this->addresses) == $this->limit) {
            return '';
        }

        if ($this->_isGroup($address) && !isset($this->error)) {
            $split_char = ';';
            $is_group   = true;
        } elseif (!isset($this->error)) {
            $split_char = ',';
            $is_group   = false;
        } elseif (isset($this->error)) {
            return false;
        }

        // Split the string based on the above ten or so lines.
        $parts  = explode($split_char, $address);
        $string = $this->_splitCheck($parts, $split_char);

        // If a group...
        if ($is_group) {
            // If $string does not contain a colon outside of
            // brackets/quotes etc then something's fubar.

            // First check there's a colon at all:
            if (strpos($string, ':') === false) {
                $this->error = 'Invalid address: ' . $string;
                return false;
            }

            // Now check it's outside of brackets/quotes:
            if (!$this->_splitCheck(explode(':', $string), ':')) {
                return false;
            }

            // We must have a group at this point, so increase the counter:
            $this->num_groups++;
        }

        // $string now contains the first full address/group.
        // Add to the addresses array.
        $this->addresses[] = array(
                                   'address' => trim($string),
                                   'group'   => $is_group
                                   );

        // Remove the now stored address from the initial line, the +1
        // is to account for the explode character.
        $address = trim(substr($address, strlen($string) + 1));

        // If the next char is a comma and this was a group, then
        // there are more addresses, otherwise, if there are any more
        // chars, then there is another address.
        if ($is_group && substr($address, 0, 1) == ','){
            $address = trim(substr($address, 1));
            return $address;

        } elseif (strlen($address) > 0) {
            return $address;

        } else {
            return '';
        }

        // If you got here then something's off
        return false;
    }
protected function _splitAddresses($address)
    {
        if (!empty($this->limit) && count($this->addresses) == $this->limit) {
            return '';
        }

        if ($this->_isGroup($address) && !isset($this->error)) {
            $split_char = ';';
            $is_group   = true;
        } elseif (!isset($this->error)) {
            $split_char = ',';
            $is_group   = false;
        } elseif (isset($this->error)) {
            return false;
        }

        // Split the string based on the above ten or so lines.
        $parts  = explode($split_char, $address);
        $string = $this->_splitCheck($parts, $split_char);

        // If a group...
        if ($is_group) {
            // If $string does not contain a colon outside of
            // brackets/quotes etc then something's fubar.

            // First check there's a colon at all:
            if (strpos($string, ':') === false) {
                $this->error = 'Invalid address: ' . $string;
                return false;
            }

            // Now check it's outside of brackets/quotes:
            if (!$this->_splitCheck(explode(':', $string), ':')) {
                return false;
            }

            // We must have a group at this point, so increase the counter:
            $this->num_groups++;
        }

        // $string now contains the first full address/group.
        // Add to the addresses array.
        $this->addresses[] = array(
                                   'address' => trim($string),
                                   'group'   => $is_group
                                   );

        // Remove the now stored address from the initial line, the +1
        // is to account for the explode character.
        $address = trim(substr($address, strlen($string) + 1));

        // If the next char is a comma and this was a group, then
        // there are more addresses, otherwise, if there are any more
        // chars, then there is another address.
        if ($is_group && substr($address, 0, 1) == ','){
            $address = trim(substr($address, 1));
            return $address;

        } elseif (strlen($address) > 0) {
            return $address;

        } else {
            return '';
        }

        // If you got here then something's off
        return false;
    }
protected function _splitAddresses ( $ address ) { if ( ! empty ( $ this -> limit ) && count ( $ this -> addresses ) == $ this -> limit ) { return '' ; } if ( $ this -> _isGroup ( $ address ) && ! isset ( $ this -> error ) ) { $ split_char = ';' ; $ is_group = true ; } elseif ( ! isset ( $ this -> error ) ) { $ split_char = ',' ; $ is_group = false ; } elseif ( isset ( $ this -> error ) ) { return false ; } // Split the string based on the above ten or so lines. $ parts = explode ( $ split_char , $ address ) ; $ string = $ this -> _splitCheck ( $ parts , $ split_char ) ; // If a group... if ( $ is_group ) { // If $string does not contain a colon outside of // brackets/quotes etc then something's fubar. // First check there's a colon at all: if ( strpos ( $ string , ':' ) === false ) { $ this -> error = 'Invalid address: ' . $ string ; return false ; } // Now check it's outside of brackets/quotes: if ( ! $ this -> _splitCheck ( explode ( ':' , $ string ) , ':' ) ) { return false ; } // We must have a group at this point, so increase the counter: $ this -> num_groups ++ ; } // $string now contains the first full address/group. // Add to the addresses array. $ this -> addresses [ ] = array ( 'address' => trim ( $ string ) , 'group' => $ is_group ) ; // Remove the now stored address from the initial line, the +1 // is to account for the explode character. $ address = trim ( substr ( $ address , strlen ( $ string ) + 1 ) ) ; // If the next char is a comma and this was a group, then // there are more addresses, otherwise, if there are any more // chars, then there is another address. if ( $ is_group && substr ( $ address , 0 , 1 ) == ',' ) { $ address = trim ( substr ( $ address , 1 ) ) ; return $ address ; } elseif ( strlen ( $ address ) > 0 ) { return $ address ; } else { return '' ; } // If you got here then something's off return false ; }
Splits an address into separate addresses.

@param string $address The addresses to split.
@return boolean Success or failure.
Splits an address into separate addresses .