/** * @param string $source * @return string */ public function applyVersion($source) { if (!($version = $this->getVersion()) || static::isExternalSource($source)) { return $source; } return UrlUtils::appendParams($source, [$this->getVersionParamName() => $version]); }
/** * @param string $path * @param array $queryParams * @return string */ public function to($path = '', array $queryParams = []) { $prefix = $this->getApplication()->getBaseUrl(); if (!$path) { $path = $prefix; } else { if ('/' != $path[0] && !preg_match('/^https?:\\/\\//', $path)) { $path = rtrim($prefix, '/') . '/' . $path; } } return UrlUtils::appendParams($path, $queryParams); }
/** * @dataProvider dataProviderTestAppendParams */ public function testAppendParams($url, $params, $expected) { $this->assertSame($expected, UrlUtils::appendParams($url, $params)); }
/** * @return string */ public function getUrl() { return UrlUtils::appendParams($this->url, $this->getParamsQuery()->toArray()); }