public function fire(array $args = []) : bool
{
try {
$this->getSession();
$dir = $this->session['dir'] . $this->findRelativeDir();
} catch (\Error $e) {
echo $e->getMessage(), "\n";
return false;
}
if (\count($args) === 0) {
echo 'No file passed.', "\n";
return false;
}
if (!isset($this->session['add'])) {
echo 'Creating session data', "\n";
$this->session['add'] = [];
}
$added = 0;
foreach ($args as $file) {
$l = Binary::safeStrlen($file) - 1;
if ($file[$l] === DIRECTORY_SEPARATOR) {
$file = Binary::safeSubstr($file, 0, -1);
}
$added += $this->addFile($file, $dir);
}
echo $added, ' file', $added === 1 ? '' : 's', ' added.', "\n";
return true;
}