Exemple #1
0
 /**
  * @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]);
 }
Exemple #2
0
 /**
  * @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);
 }
Exemple #3
0
 /**
  * @dataProvider dataProviderTestAppendParams
  */
 public function testAppendParams($url, $params, $expected)
 {
     $this->assertSame($expected, UrlUtils::appendParams($url, $params));
 }
Exemple #4
0
 /**
  * @return string
  */
 public function getUrl()
 {
     return UrlUtils::appendParams($this->url, $this->getParamsQuery()->toArray());
 }