Exemplo n.º 1
0
 public function __construct($container = [])
 {
     if (is_array($container)) {
         $container = new Container($container);
     }
     if (!$container instanceof ContainerContract) {
         throw new InvalidArgumentException('Expected a ContainerInterface');
     }
     $this->container = $container;
     Container::setInstance($this->container);
     /* $this->container['app'] = function() use ($this) {
        return $this;
        }; */
 }
Exemplo n.º 2
0
 public function register(PimpleContainer $container)
 {
     if (!isset($container['db'])) {
         $container['db'] = function ($container) {
             return AppContainer::getInstance()->db;
         };
     }
     if (!isset($container['token'])) {
         $container['token'] = function ($container) {
             return AppContainer::getInstance()->token;
         };
     }
     if (!isset($container['env'])) {
         $container['env'] = function ($container) {
             return AppContainer::getInstance()->env;
         };
     }
     if (!isset($container['hash'])) {
         $container['hash'] = function ($container) {
             return AppContainer::getInstance()->hash;
         };
     }
 }
Exemplo n.º 3
0
 public static function getInstance()
 {
     return Container::getInstance()->hash;
 }