public static function castFrom($value, string $name = 'Uri'): self
    {
        if ($value instanceof self) {
            return $value;
        }

        if (is_string($value)) {
            return self::fromString($value);
        }

        throw new \InvalidArgumentException(
                $name . ' must be a string containing a HTTP URI or an instance of '
                . get_class() . ', but was '
                . (is_object($value) ? get_class($value) : gettype($value))
        );
    }