added resolver class file.
This commit is contained in:
@@ -1,30 +1,5 @@
|
||||
<?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 {
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,6 +35,7 @@ define('VIEW_PATH', APP_PATH.'views/');
|
||||
// --------------------------------------------------------------
|
||||
// Bootstrap the application instance.
|
||||
// --------------------------------------------------------------
|
||||
require SYS_PATH.'resolver'.EXT;
|
||||
require SYS_PATH.'application'.EXT;
|
||||
|
||||
$application = new Application;
|
||||
|
||||
26
laravel/resolver.php
Normal file
26
laravel/resolver.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?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].");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user