Commit 9da20410 authored by Taylor Otwell's avatar Taylor Otwell

added resolver class file.

parent cd395c26
<?php namespace Laravel; <?php namespace Laravel;
abstract class Resolver {
/**
* Magic Method for resolving classes out of the IoC container.
*
* This allows the derived class to provide access to all of the Laravel libraries
* registered in the container. Currently, this class is derived by the Application
* and Controller classes.
*/
public function __get($key)
{
if (IoC::container()->registered('laravel.'.$key))
{
return IoC::container()->resolve('laravel.'.$key);
}
elseif (IoC::container()->registered($key))
{
return IoC::container()->resolve($key);
}
throw new \Exception("Attempting to access undefined property [$key].");
}
}
class Application extends Resolver { class Application extends Resolver {
/** /**
......
...@@ -35,6 +35,7 @@ define('VIEW_PATH', APP_PATH.'views/'); ...@@ -35,6 +35,7 @@ define('VIEW_PATH', APP_PATH.'views/');
// -------------------------------------------------------------- // --------------------------------------------------------------
// Bootstrap the application instance. // Bootstrap the application instance.
// -------------------------------------------------------------- // --------------------------------------------------------------
require SYS_PATH.'resolver'.EXT;
require SYS_PATH.'application'.EXT; require SYS_PATH.'application'.EXT;
$application = new Application; $application = new Application;
......
<?php namespace Laravel;
abstract class Resolver {
/**
* Magic Method for resolving classes out of the IoC container.
*
* This allows the derived class to provide access to all of the Laravel libraries
* registered in the container. Currently, this class is derived by the Application
* and Controller classes.
*/
public function __get($key)
{
if (IoC::container()->registered('laravel.'.$key))
{
return IoC::container()->resolve('laravel.'.$key);
}
elseif (IoC::container()->registered($key))
{
return IoC::container()->resolve($key);
}
throw new \Exception("Attempting to access undefined property [$key].");
}
}
\ No newline at end of file
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