1
0

practice_test.php 779 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. class PracticeTest extends Test {
  3. private $values = [];
  4. private $template_id = null;
  5. // Constants
  6. /**
  7. * @param bool $as_assoc_array
  8. * @return array
  9. */
  10. public function getValues(bool $as_assoc_array = false): array {
  11. return $this->values;
  12. }
  13. /**
  14. * @param string $key
  15. * @param string $value
  16. * @return bool
  17. */
  18. public function setValue(string $key, string $value): bool {
  19. $this->values[$key] = $value;
  20. return true;
  21. }
  22. /**
  23. * @return string
  24. */
  25. public function getDirectory(): string {
  26. $directory = ROOT_DIR . "/files/users/$this->tester_id/practice_tests/$this->template_id";
  27. if(!file_exists($directory)) mkdir($directory, 0777, true);
  28. return $directory;
  29. }
  30. public function setTemplateId(int $id) {
  31. $this->template_id = $id;
  32. }
  33. }