refactoring for dependency injection.

This commit is contained in:
Taylor Otwell
2011-08-29 22:02:32 -05:00
parent 8229891d26
commit f113b5c829
11 changed files with 23 additions and 153 deletions

View File

@@ -21,11 +21,6 @@ class IoC {
/**
* Magic Method for calling methods on the active container instance.
*
* <code>
* // Get the request registered in the container
* $request = IoC::resolve('laravel.request');
* </code>
*/
public static function __callStatic($method, $parameters)
{
@@ -69,14 +64,6 @@ class Container {
*
* The resolver function when the registered dependency is requested.
*
* <code>
* // Register a simple dependency
* $container->register('name', function() { return 'Fred'; });
*
* // Register a dependency as a singleton
* $container->register('name', function() { return new Name; }, true);
* </code>
*
* @param string $name
* @param Closure $resolver
* @return void
@@ -89,11 +76,6 @@ class Container {
/**
* Determine if a dependency has been registered in the container.
*
* <code>
* // Determine if the "user" dependency is registered in the container
* $registered = $container->registered('user');
* </code>
*
* @param string $name
* @return bool
*/
@@ -108,11 +90,6 @@ class Container {
* Singletons will only be instantiated the first time they are resolved. On subsequent
* requests for the object, the original instance will be returned.
*
* <code>
* // Register a dependency as a singleton
* $container->singleton('user', function() { return new User; })
* </code>
*
* @param string $name
* @param Closure $resolver
* @return void
@@ -128,11 +105,6 @@ class Container {
* This method allows you to register an already existing object instance with the
* container as a singleton instance.
*
* <code>
* // Register an object instance as a singleton in the container
* $container->instance('user', new User);
* </code>
*
* @param string $name
* @param mixed $instance
* @return void
@@ -147,11 +119,6 @@ class Container {
*
* The dependency's resolver will be called and its result will be returned.
*
* <code>
* // Resolver the "name" dependency
* $name = $container->resolve('name');
* </code>
*
* @param string $name
* @return mixed
*/