function getPort($preserve = false)
    {
        $scheme = $this->getScheme();
        if (!$scheme)
            return $this->port;

        if ($this->port === null && $preserve)
            if (array_key_exists($scheme, self::$SCHEME))
                return self::$SCHEME[$scheme];

        return ($this->port)
            ? (
                (
                    array_key_exists($scheme, self::$SCHEME)
                    && $this->port === self::$SCHEME[$scheme]
                    && $preserve === false
                ) ? null : $this->port
            )
            : null;
    }