src/Email.php
public static function addressesGet($addresses)
    {
        // $this->debug->groupCollapsed(__CLASS__.'->'.__FUNCTION__);
        $return = array();
        if (!is_array($addresses)) {
            $addresses = self::addressParse($addresses);
        }
        foreach ($addresses as $k => $v) {
            if (is_array($v)) {
                // parsed address
                if (!empty($v['name'])) {
                    $return[ $v['email'] ] = $v['name'];
                } else {
                    $return[] = $v['email'];
                }
            } elseif (is_int($k)) {
                $v = self::addressParse($v);
                $v = array_shift($v);
                // $this->debug->log($k, $v);
                if (!empty($v['name'])) {
                    $return[ $v['email'] ] = $v['name'];
                } else {
                    $return[] = $v['email'];
                }
            } else {
                // email => name
                $return[$k] = $v;
            }
        }
        // $this->debug->groupEnd();
        return $return;
    }
public static function addressesGet($addresses)
    {
        // $this->debug->groupCollapsed(__CLASS__.'->'.__FUNCTION__);
        $return = array();
        if (!is_array($addresses)) {
            $addresses = self::addressParse($addresses);
        }
        foreach ($addresses as $k => $v) {
            if (is_array($v)) {
                // parsed address
                if (!empty($v['name'])) {
                    $return[ $v['email'] ] = $v['name'];
                } else {
                    $return[] = $v['email'];
                }
            } elseif (is_int($k)) {
                $v = self::addressParse($v);
                $v = array_shift($v);
                // $this->debug->log($k, $v);
                if (!empty($v['name'])) {
                    $return[ $v['email'] ] = $v['name'];
                } else {
                    $return[] = $v['email'];
                }
            } else {
                // email => name
                $return[$k] = $v;
            }
        }
        // $this->debug->groupEnd();
        return $return;
    }
public static function addressesGet ( $ addresses ) { // $this->debug->groupCollapsed(__CLASS__.'->'.__FUNCTION__); $ return = array ( ) ; if ( ! is_array ( $ addresses ) ) { $ addresses = self :: addressParse ( $ addresses ) ; } foreach ( $ addresses as $ k => $ v ) { if ( is_array ( $ v ) ) { // parsed address if ( ! empty ( $ v [ 'name' ] ) ) { $ return [ $ v [ 'email' ] ] = $ v [ 'name' ] ; } else { $ return [ ] = $ v [ 'email' ] ; } } elseif ( is_int ( $ k ) ) { $ v = self :: addressParse ( $ v ) ; $ v = array_shift ( $ v ) ; // $this->debug->log($k, $v); if ( ! empty ( $ v [ 'name' ] ) ) { $ return [ $ v [ 'email' ] ] = $ v [ 'name' ] ; } else { $ return [ ] = $ v [ 'email' ] ; } } else { // email => name $ return [ $ k ] = $ v ; } } // $this->debug->groupEnd(); return $ return ; }
Get address array from passed address string or addresses

@param mixed $addresses address / addresses

@return array  (email => name, x => email)
Get address array from passed address string or addresses