Exemplo n.º 1
0
 /**
  * Saves information to a local file
  *
  * @param   string  File filename
  * @param   string  File contents
  * 
  * @access  public
  */
 public function saveText($filename, $contents)
 {
     if (!empty($filename) && !empty($contents)) {
         if (@file_put_contents($filename, $contents) === false) {
             agnosConsole::error("Unable to write file '{$filename}'");
             return false;
         }
         return true;
     }
     return false;
 }
Exemplo n.º 2
0
 /**
  * Saves the information found in --FILE-- section into a temporary file
  * e.g. mytestcase.php
  * 
  * @param  string  filename in full path
  * @param  string  text/source codes found in --FILE-- section
  * @param  string  filename copy (optional)
  * @return boolean true; 
  */
 public function saveTestFile($filename, $text, $filenameCopy = null)
 {
     if (!empty($filename) && $filenameCopy != $filename) {
         if (@file_put_contents($filenameCopy, $text) === false) {
             agnosConsole::error("Cannot open file '{$filenameCopy}'");
             return false;
         }
     } else {
         if (@file_put_contents($filename, $text) === false) {
             agnosConsole::error("Cannot open file '{$filename}'");
             return false;
         }
     }
     # if verbose == true, show detailed info
     return true;
 }