1 | <?php |
||
14 | trait HasBaseRoutesTrait |
||
15 | { |
||
16 | |||
17 | /** |
||
18 | * @param RouteCollection $collection |
||
19 | * @param $name |
||
20 | * @param $class |
||
21 | * @param string $mapPrefix |
||
22 | * @param array $params |
||
23 | * @return mixed |
||
24 | */ |
||
25 | 10 | public static function generateIndexRoute( |
|
43 | |||
44 | /** |
||
45 | * @param RouteCollection $collection |
||
46 | * @param $name |
||
47 | * @param $class |
||
48 | * @param string $mapPrefix |
||
49 | * @param string $map |
||
50 | * @param array $params |
||
51 | * @return mixed |
||
52 | */ |
||
53 | 16 | public static function generateLiteralRoute( |
|
66 | |||
67 | /** |
||
68 | * @param RouteCollection $collection |
||
69 | * @param $name |
||
70 | * @param $class |
||
71 | * @param string $map |
||
72 | * @param array $params |
||
73 | * @return mixed |
||
74 | */ |
||
75 | 28 | public static function generateGenericRoute( |
|
88 | |||
89 | /** |
||
90 | * @param RouteCollection $collection |
||
91 | * @param $name |
||
92 | * @param $class |
||
93 | * @param string $mapPrefix |
||
94 | * @param string $map |
||
95 | * @param array $params |
||
96 | */ |
||
97 | 21 | public static function generateStandardRoute( |
|
98 | $collection, |
||
99 | $name, |
||
100 | $class = null, |
||
101 | $mapPrefix = '', |
||
102 | $map = null, |
||
103 | $params = [] |
||
104 | ) { |
||
105 | 21 | $class = empty($class) ? StandardRoute::class : $class; |
|
106 | 21 | $map = $map ? $map : '/{controller}/{action?index}'; |
|
107 | |||
108 | 21 | self::generateGenericRoute($collection, $name, $class, $mapPrefix . $map, $params); |
|
109 | |||
110 | 21 | $params['action'] = 'index'; |
|
111 | 21 | self::generateGenericRoute($collection, $name . '.index', $class, $mapPrefix . '/{controller}/', |
|
112 | $params); |
||
113 | 21 | } |
|
114 | |||
115 | /** |
||
116 | * @param null $class |
||
117 | * @return string |
||
118 | */ |
||
119 | 28 | protected static function generateRouteClassName($class = null) |
|
143 | } |
||
144 |