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
a4a5ad03
Commit
a4a5ad03
authored
May 19, 2012
by
Fabien Potencier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed CS
parent
24244da6
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
21 additions
and
33 deletions
+21
-33
src/Silex/Application.php
src/Silex/Application.php
+8
-13
src/Silex/Controller.php
src/Silex/Controller.php
+1
-1
src/Silex/ControllerCollection.php
src/Silex/ControllerCollection.php
+5
-5
src/Silex/ExceptionHandler.php
src/Silex/ExceptionHandler.php
+0
-2
src/Silex/GetResponseForErrorEvent.php
src/Silex/GetResponseForErrorEvent.php
+0
-2
src/Silex/LazyUrlMatcher.php
src/Silex/LazyUrlMatcher.php
+1
-0
src/Silex/Provider/MonologServiceProvider.php
src/Silex/Provider/MonologServiceProvider.php
+0
-1
src/Silex/WebTestCase.php
src/Silex/WebTestCase.php
+2
-3
tests/Silex/Tests/ApplicationTest.php
tests/Silex/Tests/ApplicationTest.php
+1
-0
tests/Silex/Tests/BeforeAfterFilterTest.php
tests/Silex/Tests/BeforeAfterFilterTest.php
+1
-1
tests/Silex/Tests/ControllerCollectionTest.php
tests/Silex/Tests/ControllerCollectionTest.php
+0
-3
tests/Silex/Tests/ErrorHandlerTest.php
tests/Silex/Tests/ErrorHandlerTest.php
+1
-0
tests/Silex/Tests/JsonTest.php
tests/Silex/Tests/JsonTest.php
+0
-2
tests/Silex/Tests/Provider/SessionServiceProviderTest.php
tests/Silex/Tests/Provider/SessionServiceProviderTest.php
+1
-0
No files found.
src/Silex/Application.php
View file @
a4a5ad03
...
...
@@ -23,8 +23,6 @@ use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use
Symfony\Component\HttpKernel\Event\PostResponseEvent
;
use
Symfony\Component\HttpKernel\EventListener\ResponseListener
;
use
Symfony\Component\HttpKernel\EventListener\RouterListener
;
use
Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
;
use
Symfony\Component\HttpKernel\Exception\NotFoundHttpException
;
use
Symfony\Component\HttpKernel\Exception\HttpExceptionInterface
;
use
Symfony\Component\HttpKernel\Exception\HttpException
;
use
Symfony\Component\HttpKernel\KernelEvents
;
...
...
@@ -36,12 +34,8 @@ use Symfony\Component\HttpFoundation\JsonResponse;
use
Symfony\Component\EventDispatcher\Event
;
use
Symfony\Component\EventDispatcher\EventDispatcher
;
use
Symfony\Component\EventDispatcher\EventSubscriberInterface
;
use
Symfony\Component\Routing\Route
;
use
Symfony\Component\Routing\RouteCollection
;
use
Symfony\Component\Routing\RequestContext
;
use
Symfony\Component\Routing\Exception\ExceptionInterface
as
RoutingException
;
use
Symfony\Component\Routing\Exception\MethodNotAllowedException
;
use
Symfony\Component\Routing\Exception\ResourceNotFoundException
;
use
Symfony\Component\ClassLoader\UniversalClassLoader
;
use
Silex\RedirectableUrlMatcher
;
use
Silex\ControllerResolver
;
...
...
@@ -119,6 +113,7 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
$ret
=
call_user_func
(
$callback
,
$event
->
getRequest
());
if
(
$ret
instanceof
Response
)
{
$event
->
setResponse
(
$ret
);
return
;
}
elseif
(
null
!==
$ret
)
{
throw
new
\RuntimeException
(
'Middleware for route "'
.
$event
->
getRequest
()
->
attributes
->
get
(
'_route'
)
.
'" returned an invalid response value. Must return null or an instance of Response.'
);
...
...
@@ -159,7 +154,7 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
* You can optionally specify HTTP methods that should be matched.
*
* @param string $pattern Matched route pattern
* @param mixed
$to
Callback that returns the response when matched
* @param mixed
$to
Callback that returns the response when matched
*
* @return Silex\Controller
*/
...
...
@@ -172,7 +167,7 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
* Maps a GET request to a callable.
*
* @param string $pattern Matched route pattern
* @param mixed
$to
Callback that returns the response when matched
* @param mixed
$to
Callback that returns the response when matched
*
* @return Silex\Controller
*/
...
...
@@ -185,7 +180,7 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
* Maps a POST request to a callable.
*
* @param string $pattern Matched route pattern
* @param mixed
$to
Callback that returns the response when matched
* @param mixed
$to
Callback that returns the response when matched
*
* @return Silex\Controller
*/
...
...
@@ -198,7 +193,7 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
* Maps a PUT request to a callable.
*
* @param string $pattern Matched route pattern
* @param mixed
$to
Callback that returns the response when matched
* @param mixed
$to
Callback that returns the response when matched
*
* @return Silex\Controller
*/
...
...
@@ -211,7 +206,7 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
* Maps a DELETE request to a callable.
*
* @param string $pattern Matched route pattern
* @param mixed
$to
Callback that returns the response when matched
* @param mixed
$to
Callback that returns the response when matched
*
* @return Silex\Controller
*/
...
...
@@ -384,8 +379,8 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
/**
* Mounts an application under the given route prefix.
*
* @param string $prefix The route prefix
* @param ControllerCollection|ControllerProviderInterface $app A ControllerCollection or a ControllerProviderInterface instance
* @param string
$prefix The route prefix
* @param ControllerCollection|ControllerProviderInterface $app
A ControllerCollection or a ControllerProviderInterface instance
*/
public
function
mount
(
$prefix
,
$app
)
{
...
...
src/Silex/Controller.php
View file @
a4a5ad03
...
...
@@ -158,7 +158,7 @@ class Controller
* Sets a callback to handle before triggering the route callback.
* (a.k.a. "Route Middleware")
*
* @param mixed
$callback A PHP callback to be triggered when the Route is matched, just before the route callback
* @param mixed $callback A PHP callback to be triggered when the Route is matched, just before the route callback
* @return Controller $this The current Controller instance
*/
public
function
middleware
(
$callback
)
...
...
src/Silex/ControllerCollection.php
View file @
a4a5ad03
...
...
@@ -35,7 +35,7 @@ class ControllerCollection
* You can optionally specify HTTP methods that should be matched.
*
* @param string $pattern Matched route pattern
* @param mixed
$to
Callback that returns the response when matched
* @param mixed
$to
Callback that returns the response when matched
*
* @return Silex\Controller
*/
...
...
@@ -52,7 +52,7 @@ class ControllerCollection
* Maps a GET request to a callable.
*
* @param string $pattern Matched route pattern
* @param mixed
$to
Callback that returns the response when matched
* @param mixed
$to
Callback that returns the response when matched
*
* @return Silex\Controller
*/
...
...
@@ -65,7 +65,7 @@ class ControllerCollection
* Maps a POST request to a callable.
*
* @param string $pattern Matched route pattern
* @param mixed
$to
Callback that returns the response when matched
* @param mixed
$to
Callback that returns the response when matched
*
* @return Silex\Controller
*/
...
...
@@ -78,7 +78,7 @@ class ControllerCollection
* Maps a PUT request to a callable.
*
* @param string $pattern Matched route pattern
* @param mixed
$to
Callback that returns the response when matched
* @param mixed
$to
Callback that returns the response when matched
*
* @return Silex\Controller
*/
...
...
@@ -91,7 +91,7 @@ class ControllerCollection
* Maps a DELETE request to a callable.
*
* @param string $pattern Matched route pattern
* @param mixed
$to
Callback that returns the response when matched
* @param mixed
$to
Callback that returns the response when matched
*
* @return Silex\Controller
*/
...
...
src/Silex/ExceptionHandler.php
View file @
a4a5ad03
...
...
@@ -11,8 +11,6 @@
namespace
Silex
;
use
Silex\Application
;
use
Symfony\Component\HttpFoundation\Response
;
use
Symfony\Component\HttpKernel\Debug\ExceptionHandler
as
DebugExceptionHandler
;
use
Symfony\Component\EventDispatcher\EventSubscriberInterface
;
...
...
src/Silex/GetResponseForErrorEvent.php
View file @
a4a5ad03
...
...
@@ -11,9 +11,7 @@
namespace
Silex
;
use
Symfony\Component\HttpKernel\HttpKernelInterface
;
use
Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent
;
use
Symfony\Component\HttpFoundation\Request
;
/**
* GetResponseForExceptionEvent with additional setStringResponse method
...
...
src/Silex/LazyUrlMatcher.php
View file @
a4a5ad03
...
...
@@ -40,6 +40,7 @@ class LazyUrlMatcher implements UrlMatcherInterface
if
(
!
$urlMatcher
instanceof
UrlMatcherInterface
)
{
throw
new
\LogicException
(
"Factory supplied to LazyUrlMatcher must return implementation of UrlMatcherInterface."
);
}
return
$urlMatcher
;
}
...
...
src/Silex/Provider/MonologServiceProvider.php
View file @
a4a5ad03
...
...
@@ -19,7 +19,6 @@ use Silex\ServiceProviderInterface;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpFoundation\Response
;
use
Symfony\Component\HttpKernel\Exception\HttpException
;
/**
* Monolog Provider.
...
...
src/Silex/WebTestCase.php
View file @
a4a5ad03
...
...
@@ -12,7 +12,6 @@
namespace
Silex
;
use
Symfony\Component\HttpKernel\Client
;
use
Symfony\Component\HttpKernel\Test\WebTestCase
as
BaseWebTestCase
;
/**
* WebTestCase is the base class for functional tests.
...
...
@@ -44,8 +43,8 @@ abstract class WebTestCase extends \PHPUnit_Framework_TestCase
/**
* Creates a Client.
*
* @param array
$options An array of options to pass to the createKernel class
* @param array
$server An array of server parameters
* @param array $options An array of options to pass to the createKernel class
* @param array $server An array of server parameters
*
* @return Client A Client instance
*/
...
...
tests/Silex/Tests/ApplicationTest.php
View file @
a4a5ad03
...
...
@@ -191,6 +191,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
$app
->
get
(
'/reached'
,
function
()
use
(
&
$middlewareTarget
)
{
$middlewareTarget
[]
=
'route_triggered'
;
return
'hello'
;
})
->
middleware
(
$middleware1
)
...
...
tests/Silex/Tests/BeforeAfterFilterTest.php
View file @
a4a5ad03
...
...
@@ -15,7 +15,6 @@ use Silex\Application;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpFoundation\Response
;
use
Symfony\Component\HttpKernel\Exception\NotFoundHttpException
;
/**
* Error handler test cases.
...
...
@@ -60,6 +59,7 @@ class BeforeAfterFilterTest extends \PHPUnit_Framework_TestCase
$app
->
match
(
'/foo'
,
function
()
use
(
&
$i
)
{
$i
++
;
return
new
Response
(
'foo'
);
});
...
...
tests/Silex/Tests/ControllerCollectionTest.php
View file @
a4a5ad03
...
...
@@ -11,14 +11,11 @@
namespace
Silex\Tests
;
use
Silex\Application
;
use
Silex\Controller
;
use
Silex\ControllerCollection
;
use
Silex\Exception\ControllerFrozenException
;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\Routing\Route
;
use
Symfony\Component\Routing\RouteCollection
;
/**
* ControllerCollection test cases.
...
...
tests/Silex/Tests/ErrorHandlerTest.php
View file @
a4a5ad03
...
...
@@ -139,6 +139,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
$app
->
error
(
function
(
$e
)
use
(
&
$errors
)
{
$errors
++
;
return
new
Response
(
'foo exception handler'
);
});
...
...
tests/Silex/Tests/JsonTest.php
View file @
a4a5ad03
...
...
@@ -13,8 +13,6 @@ namespace Silex\Tests;
use
Silex\Application
;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpFoundation\StreamedResponse
;
/**
* JSON test cases.
...
...
tests/Silex/Tests/Provider/SessionServiceProviderTest.php
View file @
a4a5ad03
...
...
@@ -36,6 +36,7 @@ class SessionServiceProviderTest extends \PHPUnit_Framework_TestCase
$app
->
get
(
'/login'
,
function
()
use
(
$app
)
{
$app
[
'session'
]
->
set
(
'logged_in'
,
true
);
return
'Logged in successfully.'
;
});
...
...
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