You are here

public function TestingAppService::url in Forena Reports 8

Overrides AppService::url

File

tests/src/Unit/Mock/TestingAppService.php, line 176

Class

TestingAppService

Namespace

Drupal\Tests\forena\Unit\Mock

Code

public function url($path, $options) {
  if (strpos($path, '/') !== 0 && strpos($path, 'http' == FALSE)) {
    $path = "/{$path}";
  }
  $url = $path;
  if (isset($options['query'])) {
    $query_string = '?';
    foreach ($options['query'] as $key => $value) {
      $query_string .= "{$key}={$value}&";
    }
    $query_string = rtrim($query_string, '&');
    $url .= $query_string;
  }
  return $url;
}