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
42926bf5
Commit
42926bf5
authored
Apr 20, 2011
by
Fabien Potencier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated Routing component
parent
8b6f476a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
33 deletions
+3
-33
src/Silex/RedirectableUrlMatcher.php
src/Silex/RedirectableUrlMatcher.php
+2
-32
vendor/Symfony/Component/Routing
vendor/Symfony/Component/Routing
+1
-1
No files found.
src/Silex/RedirectableUrlMatcher.php
View file @
42926bf5
...
@@ -12,44 +12,14 @@
...
@@ -12,44 +12,14 @@
namespace
Silex
;
namespace
Silex
;
use
Symfony\Component\HttpFoundation\RedirectResponse
;
use
Symfony\Component\HttpFoundation\RedirectResponse
;
use
Symfony\Component\Routing\Matcher\UrlMatcher
;
use
Symfony\Component\Routing\Matcher\
RedirectableUrlMatcher
as
BaseRedirectable
UrlMatcher
;
use
Symfony\Component\Routing\Matcher\RedirectableUrlMatcherInterface
;
use
Symfony\Component\Routing\Matcher\RedirectableUrlMatcherInterface
;
use
Symfony\Component\Routing\Matcher\Exception\NotFoundException
;
/**
/**
* @author Fabien Potencier <fabien@symfony.com>
* @author Fabien Potencier <fabien@symfony.com>
*/
*/
class
RedirectableUrlMatcher
extends
UrlMatcher
implements
RedirectableUrlMatcherInterface
class
RedirectableUrlMatcher
extends
BaseRedirectableUrlMatcher
{
{
private
$trailingSlashTest
=
false
;
/**
* @see UrlMatcher::match()
*/
public
function
match
(
$pathinfo
)
{
try
{
$parameters
=
parent
::
match
(
$pathinfo
);
}
catch
(
NotFoundException
$e
)
{
if
(
'/'
===
substr
(
$pathinfo
,
-
1
))
{
throw
$e
;
}
// try with a / at the end
$this
->
trailingSlashTest
=
true
;
return
$this
->
match
(
$pathinfo
.
'/'
);
}
if
(
$this
->
trailingSlashTest
)
{
$this
->
trailingSlashTest
=
false
;
return
$this
->
redirect
(
$pathinfo
,
null
);
}
return
$parameters
;
}
/**
/**
* @see RedirectableUrlMatcherInterface::match()
* @see RedirectableUrlMatcherInterface::match()
*/
*/
...
...
Routing
@
7d6ff08b
Subproject commit
1740f71d38056f317b655bdab09e4a666f5bf65b
Subproject commit
7d6ff08b8b9267923da07202308f3a5606128af9
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