-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from PHP-DI/refactoring
Big simplification, less overhead
- Loading branch information
Showing
5 changed files
with
112 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace DI\Bridge\Silex\Container; | ||
|
||
use DI\Bridge\Silex\Application; | ||
use Interop\Container\ContainerInterface; | ||
|
||
/** | ||
* Proxies container-interop methods to the application. | ||
* | ||
* ContainerInterface cannot be implemented directly by Application because it defines | ||
* a `get()` method already (to add a controller for a GET HTTP method). So we use this | ||
* proxy to have a ContainerInterop container but still use the application. | ||
* | ||
* @author Matthieu Napoli <matthieu@mnapoli.fr> | ||
*/ | ||
class ContainerInteropProxy implements ContainerInterface | ||
{ | ||
/** | ||
* @var Application | ||
*/ | ||
private $application; | ||
|
||
public function __construct(Application $application) | ||
{ | ||
$this->application = $application; | ||
} | ||
|
||
public function get($id) | ||
{ | ||
return $this->application->offsetGet($id); | ||
} | ||
|
||
public function has($id) | ||
{ | ||
return $this->application->offsetExists($id); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters