code: private function doSetCfg($cfg)
      {
          $return = array();
          foreach ($cfg as $k => $v) {
              if ($k == 'debug') {
                  $return[$k] = \array_intersect_key($this->cfg, $v);
                  $this->setDebugCfg($v);
              } elseif (isset($this->debug->{$k}) && \is_object($this->debug->{$k})) {
                  $return[$k] = \array_intersect_key($this->getCfg($k.'/*'), $v);
                  $this->debug->{$k}->setCfg($v);
              } elseif (isset($this->cfgLazy[$k])) {
                  $return[$k] = \array_intersect_key($this->cfgLazy[$k], $v);
                  $this->cfgLazy[$k] = \array_merge($this->cfgLazy[$k], $v);
              } else {
                  $return[$k] = array();
                  $this->cfgLazy[$k] = $v;
              }
          }
          return $return;
      }
docs: Set cfg values for Debug and child classes
  
  @param array $cfg config values grouped by class
  
  @return array previous values