fsObject = new Filesystem(); $this->current_dir_path = getcwd(); } /** * Aufbau des Dateinamens: * WU + Datum(TTMM) + Fortlaufendenummer (x2) + “.“ +Filialnummer(x4) * Beispieldateiname : WU220401.0001 */ public function createFileName() :String { $date = date('dm'); $number = '01'; $filial = '0001'; return 'WU'.$date.$number.'.'.$filial; } public function import() { $finder = new Finder(); $finder->files()->in($this->current_dir_path . "/hiltes/h2c/"); foreach ($finder as $file) { $contents = $file->getContents(); var_dump($contents); } } /** * @param string $data * @return void */ public function export(string $data) { try { $new_file_path = $this->current_dir_path . "/hiltes/c2h/".$this->createFileName(); if (!$this->fsObject->exists($new_file_path)) { $this->fsObject->touch($new_file_path); $this->fsObject->chmod($new_file_path, 0777); $this->fsObject->dumpFile($new_file_path, $data); } } catch (IOExceptionInterface $exception) { echo "Error creating file at". $exception->getPath(); } } }