/** * @throws LogicException * @throws InvalidArgumentException */ public function main() { $config = new Config(); $properties = $this->filterProperties(); try { foreach ($properties as $name => $value) { $config->set($name, $value); } } catch (\Exception $e) { throw new BuildException(sprintf("Cannot export properties to '%s'. %s", $this->file, $e->getMessage())); } try { $writer = Writer::objectify($this->file); $options = $this->processOptions(); $options->inject($writer); $writer->write($config, $this->file); } catch (\Exception $e) { throw new BuildException(sprintf("Cannot export properties to '%s'. %s", $this->file, $e->getMessage())); } }
/** * Save data to supported target * Writer is determined automatically * * @param mixed $target * * @return $this */ public function save($target) { $writer = Writer::objectify($target); $writer->write($this, $target); return $this; }