Fragen\GitHub_Updater\API::get_api_url PHP Метод

get_api_url() приватный Метод

Return API url.
private get_api_url ( string $endpoint ) : string
$endpoint string
Результат string $endpoint
    private function get_api_url($endpoint)
    {
        $type = $this->return_repo_type();
        $segments = array('owner' => $this->type->owner, 'repo' => $this->type->repo);
        foreach ($segments as $segment => $value) {
            $endpoint = str_replace('/:' . sanitize_key($segment), '/' . sanitize_text_field($value), $endpoint);
        }
        switch ($type['repo']) {
            case 'github':
                $api = new GitHub_API($type['type']);
                $endpoint = $api->add_endpoints($this, $endpoint);
                if ($this->type->enterprise_api) {
                    return $endpoint;
                }
                break;
            case 'gitlab':
                $api = new GitLab_API($type['type']);
                $endpoint = $api->add_endpoints($this, $endpoint);
                if ($this->type->enterprise_api) {
                    return $endpoint;
                }
                break;
            default:
        }
        return $type['base_uri'] . $endpoint;
    }