You are here

public function WsConfigType::getEndpoint in Web Service Data 7

File

modules/wsconfig/wsconfig.entity.inc, line 419
Entity classes

Class

WsConfigType
The class used for wsconfig type entities

Code

public function getEndpoint() {
  $endpoint = $this->data['endpoint'];
  $matches = array();
  preg_match_all('/\\$\\{(.+?)(:.+){0,1}\\}/', $endpoint, $matches);
  if (!empty($matches[0])) {
    for ($n = 0; $n < count($matches[0]); $n++) {
      $default = '';
      if (isset($matches[2][$n])) {
        $default = drupal_substr($matches[2][$n], 1);
      }
      $replacements[] = (string) variable_get($matches[1][$n], $default);
    }
    $endpoint = str_replace($matches[0], $replacements, $endpoint);
  }
  return $endpoint;
}