@@ -60,7 +60,7 @@ public function setPrefix($prefix)
60
60
*/
61
61
public function getRouteCollectionForRequest (Request $ request )
62
62
{
63
- $ url = $ request ->getPathInfo ();
63
+ $ url = $ request ->getPathInfo ();
64
64
$ candidates = $ this ->getCandidates ($ url );
65
65
66
66
$ collection = new RouteCollection ();
@@ -78,7 +78,7 @@ public function getRouteCollectionForRequest(Request $request)
78
78
}
79
79
}
80
80
}
81
- catch (RepositoryException $ e ) {
81
+ } catch (RepositoryException $ e ) {
82
82
// TODO: how to determine whether this is a relevant exception or not?
83
83
// https://github.com/symfony-cmf/RoutingBundle/issues/143
84
84
// for example, getting /my//test (note the double /) is just an invalid path
@@ -96,17 +96,17 @@ public function getRouteCollectionForRequest(Request $request)
96
96
*/
97
97
protected function getCandidates ($ url )
98
98
{
99
- $ candidates = array ();
99
+ $ candidates = array ();
100
100
if ('/ ' !== $ url ) {
101
101
if (preg_match ('/(.+)\.[a-z]+$/i ' , $ url , $ matches )) {
102
102
$ candidates [] = $ this ->idPrefix . $ url ;
103
- $ url = $ matches [1 ];
103
+ $ url = $ matches [1 ];
104
104
}
105
105
106
106
$ part = $ url ;
107
107
while (false !== ($ pos = strrpos ($ part , '/ ' ))) {
108
108
$ candidates [] = $ this ->idPrefix . $ part ;
109
- $ part = substr ($ url , 0 , $ pos );
109
+ $ part = substr ($ url , 0 , $ pos );
110
110
}
111
111
}
112
112
@@ -118,11 +118,11 @@ protected function getCandidates($url)
118
118
/**
119
119
* {@inheritDoc}
120
120
*/
121
- public function getRouteByName ($ name , $ parameters = array ())
121
+ public function getRouteByName ($ name , $ parameters = array ())
122
122
{
123
123
124
124
// $name is the route document path
125
- if ('' === $ this ->idPrefix || 0 === strpos ($ name , $ this ->idPrefix )) {
125
+ if ( '' === $ this ->idPrefix || 0 === strpos ($ name , $ this ->idPrefix ) ) {
126
126
$ route = $ this ->getObjectManager ()->find ($ this ->className , $ name );
127
127
}
128
128
@@ -140,12 +140,12 @@ public function getRouteByName($name, $parameters = array ())
140
140
/**
141
141
* {@inheritDoc}
142
142
*/
143
- public function getRoutesByNames ($ names , $ parameters = array ())
143
+ public function getRoutesByNames ($ names , $ parameters = array ())
144
144
{
145
- $ routes = array ();
145
+ $ routes = array ();
146
146
if ('' === $ this ->idPrefix ) {
147
147
foreach ($ names as $ name ) {
148
- if (0 === strpos ($ name , $ this ->idPrefix )) {
148
+ if ('' === $ this -> idPrefix || 0 === strpos ($ name , $ this ->idPrefix )) {
149
149
$ routes [] = $ name ;
150
150
}
151
151
}
@@ -164,4 +164,5 @@ public function getRoutesByNames($names, $parameters = array ())
164
164
165
165
return $ collection ;
166
166
}
167
+
167
168
}
0 commit comments