Bart\Curl::buildFullPath PHP Method

buildFullPath() private method

private buildFullPath ( $subUri )
    private function buildFullPath($subUri)
    {
        if (!$subUri) {
            return $this->hostUri;
        }
        $hostHasSlash = substr($this->hostUri, -1) == "/";
        $subHasSlash = substr($subUri, 0, 1) == "/";
        if ($hostHasSlash && $subHasSlash) {
            // leave the trailing slash, remove the leading
            return sprintf("%s%s", $this->hostUri, substr($subUri, 1));
        }
        if (!$hostHasSlash && !$subHasSlash) {
            return sprintf("%s/%s", $this->hostUri, $subUri);
        }
        // one has the slash and the other doesn't
        return sprintf("%s%s", $this->hostUri, $subUri);
    }