/** * Save model properties as configurations * @return bool */ public function makeSave() { $toSave = App::$Security->strip_php_tags($this->getAllProperties()); $stringSave = '<?php return ' . Arr::exportVar($toSave, null, true) . ';'; $cfgPath = '/Private/Config/Default.php'; if (File::exist($cfgPath) && File::writable($cfgPath)) { File::write($cfgPath, $stringSave); return true; } return false; }
/** * Write configurations data from array to cfg file * @param string $configFile * @param array $data * @return bool */ public function writeConfig($configFile, array $data) { $path = '/Private/Config/' . ucfirst(Str::lowerCase($configFile)) . '.php'; if (!File::exist($path) || !File::writable($path)) { return false; } $saveData = '<?php return ' . Arr::exportVar($data) . ';'; File::write($path, $saveData); return true; }
/** * Alternative var_export function for php >= 5.4 syntax * @deprecated * @param $var * @param null $indent * @return mixed|string */ public function var_export54($var, $indent = null, $guessTypes = false) { return Arr::exportVar($var, $indent, $guessTypes); }