19 declare(strict_types=1);
44 $this->timestamp = time();
61 public function getPathname($extension, $additional =
''): string
63 if (!is_string($extension) || !strlen($extension)) {
64 throw new ilException(
'Missing file extension! Please pass a file extension of type string.');
65 } elseif (substr_count($extension,
'.') > 1 || (strpos($extension,
'.') !==
false && strpos($extension,
'.') !== 0)) {
66 throw new ilException(
'Please use at most one dot in your file extension.');
67 } elseif (strpos($extension,
'.') === 0) {
68 $extension = substr($extension, 1);
71 if (!is_string($additional)) {
72 } elseif (strlen($additional)) {
73 if (strpos($additional,
'__') === 0) {
74 throw new ilException(
'The additional file part may not contain __ at the beginning!');
77 $additional =
'__' . $additional .
'_';
82 return $this->test->getExportDirectory() . DIRECTORY_SEPARATOR . $this->
getTimestamp() .
'__' .
IL_INST_ID .
'__' . $this->test->getType() . $additional . $this->test->getId() .
'.' . $extension;
__construct(ilObjTest $test)
getPathname($extension, $additional='')