No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DOMLearningModel.php 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. namespace Logipro\Bundle\SCORMBundle\LearningModels;
  3. class DOMLearningModel
  4. {
  5. private static $DOMs;
  6. final private function __construct()
  7. {
  8. // void
  9. }
  10. final private function __clone()
  11. {
  12. // void
  13. }
  14. final private function __wakeup()
  15. {
  16. // void
  17. }
  18. /**
  19. * récupère le DOM représentant un package
  20. *
  21. * @param string $XMLManifest
  22. * @return DOMSCORM
  23. */
  24. final public static function getInstance(string $key, string $manifest = null) : DOMSCORM
  25. {
  26. if (isset($DOMs[$key])) {
  27. return self::$DOMs[$key];
  28. }
  29. if (isset($manifest)) {
  30. return self::setDOM($key, $manifest);
  31. }
  32. return null;
  33. }
  34. public static function setDOM(string $key, string $XMLManifest) : DOMSCORM
  35. {
  36. $dom = null;
  37. // On définit le standard
  38. $standard = DOMSCORM::getStandard($XMLManifest);
  39. switch ($standard) {
  40. case DOMSCORM::SCORM2004:
  41. $dom = new DOMSCORM2004($XMLManifest);
  42. break;
  43. case DOMSCORM::SCORM12:
  44. $dom = null;
  45. break;
  46. default:
  47. $dom = null;
  48. }
  49. self::$DOMs[$key] = $dom;
  50. return $dom;
  51. }
  52. /**
  53. * extrait le modele XML (pour SCORM ce sont des manifest)
  54. *
  55. * @param string $filename nom du paquet zip contenant le modele
  56. * @return string modele XML du cours
  57. */
  58. public static function getManifest(string $filename) : string
  59. {
  60. return DOMSCORM::getManifest($filename);
  61. }
  62. }