This repository was archived by the owner on Sep 16, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +55
-0
lines changed Expand file tree Collapse file tree 2 files changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Symfony \Cmf \Bundle \RoutingAutoBundle \AutoRoute \Exception ;
4
+
5
+ /**
6
+ * @author Daniel Leech <[email protected] >
7
+ */
8
+ class BadProviderPositionException extends \RuntimeException
9
+ {
10
+ }
11
+
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Symfony \Cmf \Bundle \RoutingAutoBundle \AutoRoute \PathProvider ;
4
+
5
+ use Symfony \Cmf \Bundle \RoutingAutoBundle \AutoRoute \PathProviderInterface ;
6
+ use Symfony \Cmf \Bundle \RoutingAutoBundle \AutoRoute \Exception \BadProviderPositionException ;
7
+ use Symfony \Cmf \Bundle \RoutingAutoBundle \AutoRoute \RouteStack ;
8
+
9
+ /**
10
+ * Provides the routing extra bundles route_basepath.
11
+ *
12
+ * @author Daniel Leech <[email protected] >
13
+ */
14
+ class RouteBasePathObjectProvider implements PathProviderInterface
15
+ {
16
+ protected $ routingBasePath ;
17
+
18
+ public function __construct ($ routeBasePath )
19
+ {
20
+ $ this ->routeBasePath = $ routeBasePath ;
21
+ }
22
+
23
+ public function init (array $ options )
24
+ {
25
+ }
26
+
27
+ public function providePath (RouteStack $ routeStack )
28
+ {
29
+ $ context = $ routeStack ->getContext ();
30
+
31
+ if (count ($ context ->getRouteStacks ()) > 0 ) {
32
+ throw new BadProviderPositionException (
33
+ 'RouteBasePathProvider must belong to the first builder unit - adding ' .
34
+ 'the full routing basepath at an intermediate point would be senseless. '
35
+ );
36
+ }
37
+
38
+ $ id = $ this ->routeBasePath ;
39
+ $ id = substr ($ id , 1 );
40
+ $ pathElements = explode ('/ ' , $ id );
41
+ $ routeStack ->addPathElements ($ pathElements );
42
+ }
43
+ }
44
+
You can’t perform that action at this time.
0 commit comments