Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
401674e9
Commit
401674e9
authored
Aug 03, 2015
by
Fabien Potencier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplified previous merge
parent
091240ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
18 deletions
+5
-18
src/Silex/ControllerCollection.php
src/Silex/ControllerCollection.php
+5
-18
No files found.
src/Silex/ControllerCollection.php
View file @
401674e9
...
...
@@ -42,7 +42,6 @@ class ControllerCollection
protected
$defaultRoute
;
protected
$defaultController
;
protected
$prefix
;
protected
$routes
;
public
function
__construct
(
Route
$defaultRoute
)
{
...
...
@@ -52,16 +51,6 @@ class ControllerCollection
};
}
/**
* Use existing route collection to resolve conflicting autogenerated route names among mounted routes
*
* @param RouteCollection $routes
*/
public
function
shareRoutes
(
RouteCollection
$routes
)
{
$this
->
routes
=
$routes
;
}
/**
* Mounts controllers under the given route prefix.
*
...
...
@@ -70,10 +59,6 @@ class ControllerCollection
*/
public
function
mount
(
$prefix
,
ControllerCollection
$controllers
)
{
if
(
!
(
$this
->
routes
instanceof
RouteCollection
))
{
$this
->
routes
=
new
RouteCollection
();
}
$controllers
->
shareRoutes
(
$this
->
routes
);
$controllers
->
prefix
=
$prefix
;
$this
->
controllers
[]
=
$controllers
;
...
...
@@ -201,13 +186,15 @@ class ControllerCollection
*
* @return RouteCollection A RouteCollection instance
*/
public
function
flush
(
$prefix
=
''
)
public
function
flush
(
$prefix
=
''
,
$routes
=
null
)
{
if
(
$prefix
!==
''
)
{
$prefix
=
'/'
.
trim
(
trim
(
$prefix
),
'/'
);
}
$routes
=
$this
->
routes
?:
new
RouteCollection
();
if
(
null
===
$routes
)
{
$routes
=
new
RouteCollection
();
}
foreach
(
$this
->
controllers
as
$controller
)
{
if
(
$controller
instanceof
Controller
)
{
...
...
@@ -222,7 +209,7 @@ class ControllerCollection
$routes
->
add
(
$name
,
$controller
->
getRoute
());
$controller
->
freeze
();
}
else
{
$routes
->
addCollection
(
$controller
->
flush
(
$prefix
.
$controller
->
prefix
));
$routes
->
addCollection
(
$controller
->
flush
(
$prefix
.
$controller
->
prefix
,
$routes
));
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment