add Hiltes
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Marko
2022-08-10 16:59:07 +02:00
parent b0f7f04ba6
commit b992fd42ba
12 changed files with 21077 additions and 246 deletions

62
src/Helper/Hiltes.php Normal file
View File

@@ -0,0 +1,62 @@
<?php
namespace App\Helper;
use Symfony\Component\Filesystem\Exception\IOExceptionInterface;
use Symfony\Component\Filesystem\Filesystem;
class Hiltes
{
// init file system
protected $fsObject;
protected $current_dir_path;
public function __construct()
{
$this->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()
{
}
/**
* @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();
}
}
}