save() public method

save
public save ( ConfigEntity $config ) : ConfigEntity
$config ConfigEntity config object
return ConfigEntity
 /**
  * save
  *
  * @param ConfigEntity $config config object
  * @return ConfigEntity
  */
 public function save(ConfigEntity $config)
 {
     $this->erase($config->siteKey, $config->name);
     return $this->repo->save($config);
 }
 /**
  * convey to descendants
  *
  * @param ConfigEntity $config config instance
  * @param callable     $filter filter function
  * @param array        $items  item key list
  * @return void
  */
 protected function convey(ConfigEntity $config, callable $filter = null, array $items = null)
 {
     $descendants = $this->repo->fetchDescendant($config->siteKey, $config->name);
     /** @var ConfigEntity $descendant */
     foreach ($descendants as $descendant) {
         if ($filter === null || call_user_func($filter, $descendant) === true) {
             if ($items === null) {
                 $descendant->clear();
             } else {
                 foreach ($items as $item) {
                     $val = $config->getPure($item);
                     if ($val instanceof Closure) {
                         continue;
                     }
                     $descendant->set($item, $val);
                 }
             }
             $this->repo->save($descendant);
         }
     }
 }