private function createStripHostsPatterns($stripHostsConfig)
    {
        if (!is_array($stripHostsConfig)) {
            return $stripHostsConfig;
        }

        $patterns = [];

        foreach ($stripHostsConfig as $entry) {
            if (!strlen($entry)) {
                continue;
            }

            if ('/private' === $entry || '/local' === $entry) {
                $patterns[] = [$entry];
                continue;
            } elseif (false !== strpos($entry, ':')) {
                $type = 'ipv6';
                if (!defined('AF_INET6')) {
                    $this->output->writeln('<error>Unable to use IPv6.</error>');
                    continue;
                }
            } elseif (0 === preg_match('#[^/.\\d]#', $entry)) {
                $type = 'ipv4';
            } else {
                $type = 'name';
                $host = '#^(?:.+\.)?' . preg_quote($entry, '#') . '$#ui';
                $patterns[] = [$type, $host];
                continue;
            }

            @list($host, $mask) = explode('/', $entry, 2);

            $host = @inet_pton($host);

            if (false === $host || (int) $mask != $mask) {
                $this->output->writeln(sprintf('<error>Invalid subnet "%s"</error>', $entry));
                continue;
            }

            $host = unpack('N*', $host);

            if (null === $mask) {
                $mask = 'ipv4' === $type ? 32 : 128;
            } else {
                $mask = (int) $mask;

                if ($mask < 0 || 'ipv4' === $type && $mask > 32 || 'ipv6' === $type && $mask > 128) {
                    continue;
                }
            }

            $patterns[] = [$type, $host, $mask];
        }

        return $patterns;
    }