added resolver class file.
This commit is contained in:
parent
cd395c2638
commit
9da2041051
|
@ -1,30 +1,5 @@
|
||||||
<?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 @@
|
||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
// 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;
|
||||||
|
|
|
@ -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].");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue