/**
  * Generates configuration in NEON format.
  * @param  array
  * @return string
  */
 public function dump(array $data)
 {
     $tmp = array();
     foreach ($data as $name => $secData) {
         if ($parent = Helpers::takeParent($secData)) {
             $name .= ' ' . self::INHERITING_SEPARATOR . ' ' . $parent;
         }
         $tmp[$name] = $secData;
     }
     return "# generated by Nette\n\n" . Neon::encode($tmp, Neon::BLOCK);
 }
Exemple #2
0
	/**
	 * Write NEON file.
	 * @param  mixed
	 * @param  string  file
	 * @return void
	 */
	public static function save($config, $file)
	{
		if (!file_put_contents($file, "# generated by Nette\n\n" . Neon::encode($config, Neon::BLOCK))) {
			throw new Nette\IOException("Cannot write file '$file'.");
		}
	}
Exemple #3
0
Nette\Utils\NeonEntity){$val=(object)array('value'=>$val->value,'attributes'=>$this->process($val->attributes));}$res[$key]=$val;}return$res;}function
dump(array$data){$tmp=array();foreach($data
as$name=>$secData){if($parent=Helpers::takeParent($secData)){$name.=' '.self::INHERITING_SEPARATOR.' '.$parent;}$tmp[$name]=$secData;}return"# generated by Nette\n\n".Neon::encode($tmp,Neon::BLOCK);}}class
 public function __destruct()
 {
     file_put_contents(__DIR__ . '/../' . $this->neonPath, Utils\Neon::encode($this->neon, Utils\Neon::BLOCK));
 }