public function __construct(array $injectors = array()) { parent::__construct($injectors + $this->injectors); if (!isset($this->injectors['lifetime'])) { $this->injectors['lifetime'] = ini_get('session.gc_maxlifetime'); } }
/** * Init * * @param array $injectors */ public function __construct(array $injectors = array()) { // Auto global if (!isset($injectors['global'])) { $injectors['global'] = PHP_SAPI === 'CLI' ? false : true; } parent::__construct($injectors + $this->injectors); // Use default store is not set if (self::$defaultStore && $this->injectors['store'] === null) { $this->injectors['store'] = self::$defaultStore; } // If store is config, create store if ($this->injectors['store'] && !$this->injectors['store'] instanceof Store) { $this->injectors['store'] = Store::create($this->injectors['store']); // Set default store if not exists if (!self::$defaultStore) { self::$defaultStore = $this->injectors['store']; } } // If not app inject, use default if (!$this->injectors['app']) { $this->injectors['app'] = App::self(); } }
public function testAppend() { $this->di->append(array('b' => 'b')); $this->assertEquals(array('b', 'a'), $this->di->keys()); }