Scalr\Service\OpenStack\Services\AbstractService::getEndpointUrl PHP Method

getEndpointUrl() public method

Gets endpoint url.
public getEndpointUrl ( ) : string
return string Returns Endpoint url without trailing slash
    public function getEndpointUrl()
    {
        $type = $this->getType();
        $cfg = $this->getOpenStack()->getConfig();
        $region = $cfg->getRegion();
        if ($cfg->getAuthToken() === null) {
            $url = $cfg->getIdentityEndpoint();
        } else {
            if (!isset($this->cache['endpoint'])) {
                $version = substr($this->getVersion(), 1);
                $this->cache['endpoint'] = $cfg->getAuthToken()->getEndpointUrl($type, $region, $version);
            }
            $url = $this->cache['endpoint'];
        }
        return $url;
    }

Usage Example

Example #1
0
 /**
  * Parses href
  *
  * @param   string    $href  A
  * @return  object    Returns object
  */
 private function _parseHref($href)
 {
     $endpoint = rtrim($this->service->getEndpointUrl(), '/');
     //some providers gets whrong url schema in href
     $e = parse_url($endpoint);
     $a = parse_url($href);
     $ret = new \stdClass();
     $ret->base = $e['scheme'] . '://' . (isset($e['user']) ? $e['user'] . (isset($e['pass']) ? ':' . urlencode($e['pass']) : '') . '@' : '') . $e['host'] . (isset($e['port']) ? ':' . $e['port'] : '');
     $ret->path = $a['path'] . (isset($a['query']) ? '?' . $a['query'] : '') . (isset($a['fragment']) ? '#' . $a['fragment'] : '');
     $ret->components = $a;
     return $ret;
 }
All Usage Examples Of Scalr\Service\OpenStack\Services\AbstractService::getEndpointUrl