|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Zenstruck\ObjectRoutingBundle; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* @author Kevin Bond <[email protected]> |
|
7
|
|
|
*/ |
|
8
|
|
|
final class RouteContext |
|
9
|
|
|
{ |
|
10
|
|
|
private $name; |
|
11
|
|
|
private $parameters; |
|
12
|
|
|
private $fragment; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* @param string $name The route name |
|
16
|
|
|
* @param array $parameters Parameters for the route |
|
17
|
|
|
* @param string|null $fragment Fragment ("#hash") to add to the generated uri |
|
18
|
|
|
*/ |
|
19
|
20 |
|
public function __construct($name, array $parameters = array(), $fragment = null) |
|
20
|
|
|
{ |
|
21
|
20 |
|
$this->name = $name; |
|
22
|
20 |
|
$this->parameters = $parameters; |
|
23
|
20 |
|
$this->fragment = $fragment; |
|
24
|
20 |
|
} |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @return string |
|
28
|
|
|
*/ |
|
29
|
20 |
|
public function getName() |
|
30
|
|
|
{ |
|
31
|
20 |
|
return $this->name; |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @return array |
|
36
|
|
|
*/ |
|
37
|
20 |
|
public function getParameters() |
|
38
|
|
|
{ |
|
39
|
20 |
|
return $this->parameters; |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @return string|null |
|
44
|
|
|
*/ |
|
45
|
13 |
|
public function getFragment() |
|
46
|
|
|
{ |
|
47
|
13 |
|
return $this->fragment; |
|
48
|
|
|
} |
|
49
|
|
|
} |
|
50
|
|
|
|