@param \Throwable $t
@param string     $localAddress

@return array
509069
public function convert(\Throwable $t, $localAddress)
    {
        $headers = [
            ErrorLastResortHeaderTypeEnum::TIME_OF_FAILURE => $this->timeConverter->toWireFormattedString(
                $this->clock->now(new \DateTimeZone('UTC'))
            ),
            ErrorLastResortHeaderTypeEnum::FAILED_QUEUE => $localAddress,
            ErrorLastResortHeaderTypeEnum::EXCEPTION_TYPE => get_class($t),
            ErrorLastResortHeaderTypeEnum::EXCEPTION_MESSAGE => $t->getMessage(),
            ErrorLastResortHeaderTypeEnum::EXCEPTION_FILE => $t->getFile() . ':' . $t->getLine(),
            ErrorLastResortHeaderTypeEnum::EXCEPTION_TRACE => $t->getTraceAsString()
        ];

        $pe = $t->getPrevious();
        if ($pe) {
            $headers[ErrorLastResortHeaderTypeEnum::PREV_EXCEPTION_TYPE] = get_class($pe);
            $headers[ErrorLastResortHeaderTypeEnum::PREV_EXCEPTION_MESSAGE] = $pe->getMessage();
            $headers[ErrorLastResortHeaderTypeEnum::PREV_EXCEPTION_FILE] = $pe->getFile() . ':' . $pe->getLine();
            $headers[ErrorLastResortHeaderTypeEnum::PREV_EXCEPTION_TRACE] = $pe->getTraceAsString();
        }

        return $headers;
    }
460683
private function getLocallyStoredImages($imageSrcs, bool $returnAll = false): array {
        return ImageUtils::storeImagesToLocalFile($imageSrcs, $returnAll, $this->config());
    }
692798
function languageNameListFromLocaleList( $localeList )
    {
        $languageList = array();
        foreach( $localeList as $locale )
            $languageList[] = $this->languageNameFromLocale( $locale );

        return $languageList;
    }
809392
public static function splitAddress($strAddress)
    {
        $strAddress = trim($strAddress);

        $a = preg_split(
            '/(\\s+)(\d+)/',
            $strAddress,
            2,
            PREG_SPLIT_DELIM_CAPTURE
        );
        $strStreetName = trim(array_shift($a));
        $strStreetNumber = trim(implode('', $a));

        if (empty($strStreetName) || empty($strStreetNumber)) { // American address notation
            $a = preg_split(
                '/([a-zA-Z]{2,})/',
                $strAddress,
                2,
                PREG_SPLIT_DELIM_CAPTURE
            );

            $strStreetNumber = trim(array_shift($a));
            $strStreetName = implode('', $a);
        }

        return array($strStreetName, substr($strStreetNumber, 0, 45));
    }
895592
private function transformArrayToAddresses($addresses): array
    {
        $transformed = [];
        foreach ($addresses as $email => $name) {
            $address = new Address($email, $name);
            $transformed[] = $address;
        }

        return $transformed;
    }
81490
private List<Member> getNonLocalReplicaAddresses() {
        final Collection<Member> dataMembers = nodeEngine.getClusterService().getMembers(DATA_MEMBER_SELECTOR);
        final ArrayList<Member> nonLocalDataMembers = new ArrayList<Member>(dataMembers);
        nonLocalDataMembers.remove(nodeEngine.getLocalMember());
        return nonLocalDataMembers;
    }
498591
static function joinChains(\Throwable ...$nodes): ?\Throwable
    {
        $lastNodeIndex = count($nodes) - 1;

        if ($lastNodeIndex > 0) {
            // iterate over all but the last node
            for ($i = 0; $i < $lastNodeIndex; ++$i) {
                // find initial node of the next chain
                $initialNode = $nodes[$i + 1];
                $hashMap = [];
                while (($previousNode = $initialNode->getPrevious()) && !isset($hashMap[$hash = spl_object_hash($previousNode)])) {
                    $initialNode = $previousNode;
                }

                // connect end of the current chain (= current node)
                // to the initial node of the next chain
                $previousProperty = new \ReflectionProperty(
                    ($parents = class_parents($initialNode)) ? end($parents) : $initialNode,
                    'previous'
                );

                $previousProperty->setAccessible(true);
                $previousProperty->setValue($initialNode, $nodes[$i]);
            }
        }

        return $nodes[$lastNodeIndex] ?? null;
    }
977800
@SuppressWarnings("deprecation")
    protected Throwable getNestedException(Throwable t) {
        Throwable root = t;
        for (;;) {
            if (root instanceof RemoteException) {
                RemoteException re = (RemoteException) root;
                if (re.detail == null)
                    break;
                root = re.detail;
            } else if (root instanceof NamingException) {
                NamingException ne = (NamingException) root;
                if (ne.getRootCause() == null)
                    break;
                root = ne.getRootCause();
            } else if (root instanceof com.ibm.ws.exception.WsNestedException) { //d121522
                com.ibm.ws.exception.WsNestedException ne = (com.ibm.ws.exception.WsNestedException) root;
                if (ne.getCause() == null)
                    break;
                root = ne.getCause();
            } else {
                break;
            }
        }
        return root;
    }
1124541
static InetAddress[] getGlobalInterfaces() throws SocketException {
        List<InetAddress> list = new ArrayList<InetAddress> ();
        for (NetworkInterface intf : getInterfaces()) {
            if (intf.isUp()) {
                for (InetAddress address : Collections.list(intf.getInetAddresses())) {
                    if (address.isLoopbackAddress() == false &&
                            address.isSiteLocalAddress() == false &&
                            address.isLinkLocalAddress() == false) {
                        list.add(address);
                    }
                }
            }
        }
        return list.toArray(new InetAddress[list.size()]);
    }
39766
protected function getRoutesList($projectRoot, $address)
    {
        /** @var \Platformsh\Cli\Local\LocalProject $localProject */
        $localProject = $this->getService('local.project');
        $routesConfig = (array) $localProject->readProjectConfigFile($projectRoot, 'routes.yaml');

        $routes = [];
        foreach ($routesConfig as $route => $config) {
            // If the route starts with http://{default}, replace it with the
            // $address. This can't accommodate subdomains or HTTPS routes, so
            // those are ignored.
            $url = strpos($route, 'http://{default}') === 0
                ? 'http://' . $address . substr($route, 16)
                : $route;
            if (strpos($url, '{default}') !== false) {
                continue;
            }
            $routes[$url] = $config + ['original_url' => $route];
        }

        return $routes;
    }
365748
public function retrieveAllAsArray($locale)
    {
        $result = [];

        /** @var CustomerType $customerType */
        foreach ($this->retrieveAll($locale) as $customerType) {
            $result[] = [
                'id' => $customerType->getId(),
                'name' => $customerType->getName(),
            ];
        }

        return $result;
    }
204520
public static function tryParse(string $emailAddress): ?EmailAddressInterface
    {
        if (!self::myParse($emailAddress, $username, $host)) {
            return null;
        }

        return new self($username, $host);
    }
487984
private void throwPreferedIPv4StackIPv6AddressError(String location, List<TcpResourceAddress> tcpAddresses) {
        try {
            InetAddress address = InetAddress.getByName(URIUtils.getHost(location));
            boolean preferIPv4Stack = Boolean.parseBoolean(System.getProperty(JAVA_NET_PREFER_IPV4_STACK));
            if (preferIPv4Stack && (address instanceof Inet6Address)) {
                throw new IllegalArgumentException(format(PREFER_IPV4_STACK_IPV6_ADDRESS_EXCEPTION_FORMATTER, location));
            }
        } catch (UnknownHostException e) {
            // InetAddress.getByName(hostAddress) throws an exception (hostAddress may have an
            // unsupported format, e.g. network interface syntax)
        }
    }
202540
private static List<InetAddress> getMulticastAddresses() throws SocketException, UnknownHostException {
        List<InetAddress> addresses = NetworkUtil.getMulticastAddresses();
        if (addresses.size() == 0) {
            throw new UnknownHostException("Cannot find address of local host which can be used for sending discovery request");
        }
        return addresses;
    }
7212
protected function getStacktrace(\Throwable $e): array
    {
        $stacktrace = $e->getTrace();
        if (empty($stacktrace)) {
            return [];
        }

        //Let's let's clarify exception location
        $header = [
                'file' => $e->getFile(),
                'line' => $e->getLine()
            ] + $stacktrace[0];

        if ($stacktrace[0] != $header) {
            array_unshift($stacktrace, $header);
        }

        return $stacktrace;
    }
368145
private function getLocalesExtra($localeSettings)
    {
        $localesExtra = array();
        foreach ($localeSettings as $key => $localeMapping) {
            $localesExtra[$localeMapping['uri_locale']] = array_key_exists('extra', $localeMapping) ? $localeMapping['extra'] : array();
        }

        return $localesExtra;
    }
860594
@Override
    public final void setDefaultLocalAddresses(List<? extends SocketAddress> localAddresses) {
        if (localAddresses == null) {
            throw new NullPointerException("localAddresses");
        }
        setDefaultLocalAddresses((Iterable<? extends SocketAddress>) localAddresses);
    }