/** * The Enlight_Plugin_Namespace_Config class constructor expects a storage (Enlight_Config). * The options array must contain an array element named "storage" which contains an additional array * with storage settings or only with a name for the storage. * If the name is passed as array, it is used to instantiate the storage. * * @param string $name * @param null|Enlight_Config $storage */ public function __construct($name, $storage = null) { if ($storage !== null && $storage instanceof Enlight_Config) { $this->storage = $storage; } // if (is_string($options)) { // $options = array('storage' => $options); // } // if (!isset($options['storage'])) { // $options['storage'] = $name; // } // if (is_string($options['storage'])) { // $this->storage = new Enlight_Config( // $options['storage'], // array( // 'allowModifications' => true, // 'adapter' => isset($options['storageAdapter']) ? $options['storageAdapter'] : null, // 'section' => isset($options['section']) ? $options['section'] : 'production' // ) // ); // } elseif ($options['storage'] instanceof Enlight_Config) { // $this->storage = $options['storage']; // } parent::__construct($name); }
/** * The Enlight_Plugin_Namespace_Config class constructor expects a storage (Enlight_Config). * The options array must contain an array element named "storage" which contains an additional array * with storage settings or only with a name for the storage. * If the name is passed as array, it is used to instantiate the storage. * * @param string $name * @param null|Enlight_Config $storage */ public function __construct($name, $storage = null) { if ($storage !== null && $storage instanceof Enlight_Config) { $this->storage = $storage; } parent::__construct($name); }
/** * The Enlight_Plugin_Namespace_Config class constructor expects a storage (Enlight_Config). * The options array must contain an array element named "storage" which contains an additional array * with storage settings or only with a name for the storage. * If the name is passed as array, it is used to instantiate the storage. * * @param string $name * @param null|array $options */ public function __construct($name, $options = null) { if (is_array($name)) { $options = $name; } if (is_string($options)) { $options = array('storage' => $options); } if (!isset($options['storage'])) { $options['storage'] = $name; } if (is_string($options['storage'])) { $this->storage = new Enlight_Config($options['storage'], array('allowModifications' => true, 'adapter' => isset($options['storageAdapter']) ? $options['storageAdapter'] : null, 'section' => isset($options['section']) ? $options['section'] : 'production')); } elseif ($options['storage'] instanceof Enlight_Config) { $this->storage = $options['storage']; } parent::__construct($name); }