for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace kalanis\kw_afterload\Manage;
/**
* Class FileInput
* @package kalanis\kw_afterload\Manage
*/
class FileInput
{
public string $fileName = '';
public int $filePosition = 0;
public string $targetDir = '';
public bool $enabled = false;
public function setData(string $targetDir, string $fileName, bool $enabled): self
$this->parseName($fileName);
$this->targetDir = $targetDir;
$this->enabled = $enabled;
return $this;
}
protected function parseName(string $name): void
if (preg_match('#^(\d+)_(.*)$#', $name, $match)) {
$this->filePosition = intval($match[1]);
$this->fileName = $match[2];
} else {
$this->fileName = $name;
public function getName(): string
return $this->filePosition ? sprintf('%03d_%s', intval($this->filePosition), $this->fileName) : $this->fileName ;
public function getFullName(): string
return $this->targetDir . DIRECTORY_SEPARATOR . $this->getName() ;