| 1 |
<?php namespace Viocon; |
| 2 |
|
| 3 |
/** |
| 4 |
* This class gives the ability to access non-static methods statically |
| 5 |
* |
| 6 |
* Class AliasFacade |
| 7 |
* |
| 8 |
* @package Viocon |
| 9 |
*/ |
| 10 |
class AliasFacade { |
| 11 |
|
| 12 |
/** |
| 13 |
* @var Container |
| 14 |
*/ |
| 15 |
protected static $vioconInstance; |
| 16 |
|
| 17 |
/** |
| 18 |
* @param $method |
| 19 |
* @param $args |
| 20 |
* |
| 21 |
* @return mixed |
| 22 |
*/ |
| 23 |
public static function __callStatic($method, $args) |
| 24 |
{ |
| 25 |
if(!static::$vioconInstance) { |
| 26 |
static::$vioconInstance = new Container(); |
| 27 |
} |
| 28 |
|
| 29 |
return call_user_func_array(array(static::$vioconInstance, $method), $args); |
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* @param Container $instance |
| 34 |
*/ |
| 35 |
public static function setVioconInstance(Container $instance) |
| 36 |
{ |
| 37 |
static::$vioconInstance = $instance; |
| 38 |
} |
| 39 |
|
| 40 |
/** |
| 41 |
* @return \Viocon\Container $instance |
| 42 |
*/ |
| 43 |
public static function getVioconInstance() |
| 44 |
{ |
| 45 |
return static::$vioconInstance; |
| 46 |
} |
| 47 |
} |