| 1 | <?php |
||
| 8 | class CanonicalUrlGenerator |
||
| 9 | { |
||
| 10 | /** @var RouterInterface */ |
||
| 11 | protected $router; |
||
| 12 | /** @var string */ |
||
| 13 | protected $siteUrl; |
||
| 14 | /** @var bool */ |
||
| 15 | protected $trailingSlash; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * CanonicalUrlService constructor. |
||
| 19 | * @param RouterInterface $router |
||
| 20 | * @param array $config |
||
| 21 | */ |
||
| 22 | 14 | public function __construct(RouterInterface $router, array $config = []) |
|
| 29 | |||
| 30 | /** |
||
| 31 | * Returns the canonical URL for a route. |
||
| 32 | * |
||
| 33 | * @param string $route Route to generate a URL for. |
||
| 34 | * @param string|array $parameters String in 'key1=val1&key2=val2' format or array of query parameters. |
||
| 35 | * |
||
| 36 | * @return string |
||
| 37 | */ |
||
| 38 | 8 | public function generate($route, $parameters = []) |
|
| 51 | |||
| 52 | /** |
||
| 53 | * @param string|array $parameters |
||
| 54 | * @return array |
||
| 55 | */ |
||
| 56 | 7 | protected function getParameters($parameters = []) |
|
| 68 | } |
||
| 69 |