Enlight_Config example


    protected function readBase($filename)
    {
        if (file_exists($filename)) {
            /** @var class-string<Enlight_Config> $reader */
            $reader = 'Enlight_Config_Format_' . ucfirst($this->_configType);
            $base = new $reader($filename, null, [
                    'skipExtends' => true,
                    'allowModifications' => true, ]
            );
        } else {
            $base = new Enlight_Config([], true);
        }

        return $base;
    }
}
/** * @var Shopware_Components_Plugin_Namespace */
    protected $collection;

    /** * @param string $name * @param Enlight_Config|null $info */
    public function __construct($name$info = null)
    {
        $this->info = new Enlight_Config($this->getInfo(), true);
        if ($info instanceof Enlight_Config) {
            $info->setAllowModifications();
            $updateVersion = null;
            $updateSource = null;

            if ($this->hasInfoNewerVersion($this->info, $info)) {
                $updateVersion = $this->info->get('version');
                $updateSource = $this->info->get('source');
            }

            $this->info->merge($info);
            
continue;
                    }

                    $name = $dir->getFilename();

                    if ($this->validateIonCube($file)) {
                        throw new Exception(sprintf('Plugin "%s" is encrypted but the ionCube Loader extension is not installed', $name));
                    }

                    $plugin = $collection->get($name);
                    if ($plugin === null) {
                        $plugin = $collection->initPlugin($namenew Enlight_Config([
                            'source' => $source,
                            'path' => $dir->getPathname() . DIRECTORY_SEPARATOR,
                        ]));
                    }

                    $collection->registerPlugin($plugin$refreshDate);
                }
            }
        }
    }

    

    public function __construct($options = null)
    {
        if (!\is_array($options)) {
            $options = ['storage' => $options];
        }
        if (isset($options['storage']) && \is_string($options['storage'])) {
            $this->storage = new Enlight_Config($options['storage'][
                'allowModifications' => true,
                'adapter' => $options['storageAdapter'] ?? null,
                'section' => $options['section'] ?? 'production',
            ]);
        } elseif (isset($options['storage']) && $options['storage'] instanceof Enlight_Config) {
            $this->storage = $options['storage'];
        } else {
            throw new Enlight_Event_Exception('No storage provided');
        }
    }

    

    public function getConfig($name, ?Shop $shop = null)
    {
        if (!$shop) {
            $shop = $this->shop;
        }

        $config = $this->configReader->getByPluginName($name$shop ? $shop->getId() : null);

        return new Enlight_Config($config, true);
    }

    /** * Returns plugin source * * @param string $plugin * * @return string */
    public function getSource($plugin)
    {
        
Home | Imprint | This part of the site doesn't use cookies.