Commit 85ff2522 authored by Fabien Potencier's avatar Fabien Potencier

added some missing phpdoc, fixed doc

parent 17fc85c3
...@@ -407,7 +407,7 @@ one:: ...@@ -407,7 +407,7 @@ one::
$blog = require __DIR__.'/blog.php'; $blog = require __DIR__.'/blog.php';
$app = new Application(); $app = new Silex\Application();
$app->mount('/blog', $blog); $app->mount('/blog', $blog);
// define your main app // define your main app
......
...@@ -264,7 +264,11 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe ...@@ -264,7 +264,11 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
public function mount($prefix, $app) public function mount($prefix, $app)
{ {
$prefix = rtrim($prefix, '/'); $prefix = rtrim($prefix, '/');
$this->match($prefix.'/{path}', $app)->assert('path', '.*')->value('prefix', $prefix);
$this
->match($prefix.'/{path}', $app)
->assert('path', '.*')
->value('prefix', $prefix);
} }
/** /**
......
...@@ -22,11 +22,25 @@ class LazyApplication ...@@ -22,11 +22,25 @@ class LazyApplication
{ {
protected $app; protected $app;
/**
* Constructor.
*
* The $app argument is the path to a Silex app file.
* This file must return a Silex application.
*
* @param string $app The absolute path to a Silex app file
*/
public function __construct($app) public function __construct($app)
{ {
$this->app = $app; $this->app = $app;
} }
/**
* Handles a Request when this application has been mounted under a prefix.
*
* @param Request $request A Request instance
* @param string $path The path info (without the prefix)
*/
public function __invoke(Request $request, $prefix) public function __invoke(Request $request, $prefix)
{ {
if (!$this->app instanceof Application) { if (!$this->app instanceof Application) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment