practice_test.php 677 B

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