Exemplo n.º 1
0
 /**
  * @param CoreInterface $core
  */
 protected function register(CoreInterface $core)
 {
     $context = $core->make('Surume\\Core\\CoreInputContextInterface');
     $global = $core->dataPath() . '/config-global/' . $this->getDir($core->unit());
     $local = $core->dataPath() . '/config/' . $context->name();
     $config = new Config();
     $this->addConfigByPath($config, $global);
     $this->addConfigByPath($config, $local);
     $this->addConfig($config, new Config($core->config()));
     $vars = array_merge($config->exists('vars') ? $config->get('vars') : [], $this->getDefaultVariables($core, $context));
     $records = ArraySupport::flatten($config->all());
     foreach ($records as $key => $value) {
         $new = StringSupport::parametrize($value, $vars);
         if (is_string($value) && $new != $value) {
             $config->set($key, $new);
         }
     }
     $core->instance('Surume\\Config\\ConfigInterface', $config);
 }
Exemplo n.º 2
0
 /**
  * @param array $current
  * @param array $new
  * @return callable
  */
 public function getOverwriteHandlerReplacer($current, $new)
 {
     return ArraySupport::replace($current, $new);
 }