Ejemplo n.º 1
0
 private function prepareSourceEntries()
 {
     if (System::is_dir($this->source)) {
         foreach ($this->getFilesFromFolder() as $file) {
             $this->appendSource($file);
         }
     } else {
         $this->appendSource();
     }
 }
 /**
  * For each extracted database, dump a JSON file with the detected structure.
  *
  * @param $path Output folder in which to dump the output
  * @throws InvalidPathException when file does not exist or is invalid
  * @return bool
  */
 public function output($path, $databases = [])
 {
     $fileExists = System::file_exists($path);
     if (!$fileExists || $fileExists && !System::is_dir($path)) {
         throw new InvalidPathException($path);
     }
     foreach ($databases as $database) {
         $filename = $path . DIRECTORY_SEPARATOR . $database->Name . '-' . date('Y-m-d') . '-' . time() . '.json';
         System::file_put_contents($filename, json_encode($database, JSON_PRETTY_PRINT));
     }
     return true;
 }