[ '/qti/data/qtiv2p0/imsqti_v2p0.xsd' ], 'http://www.imsglobal.org/xsd/apip/apipv1p0/qtiitem/imsqti_v2p1' => [ '/qti/data/apipv1p0/Core_Level/Package/apipv1p0_qtiitemv2p1_v1p0.xsd' ], 'http://www.imsglobal.org/xsd/apip/apipv1p0/qtiitem/imsqti_v2p2' => [ '/qti/data/apipv1p0final/Core_Level/Package/apipv1p0_qtiitemv2p2_v1p0.xsd' ], 'http://www.imsglobal.org/xsd/imsqti_v2p2' => [ '/qti/data/qtiv2p2p4/imsqti_v2p2p4.xsd' ], 'default' => [ '/qti/data/qtiv2p1p1/imsqti_v2p1p1.xsd' ] ]; private $manifestValidation = [ 'default' => [ '/qti/data/imscp_v1p1.xsd', '/qti/data/qtiv2p2/qtiv2p2_imscpv1p2_v1p0.xsd', '/qti/data/apipv1p0/Core_Level/Package/apipv1p0_imscpv1p2_v1p0.xsd', '/qti/data/apipv1p0final/Core_Level/Package/apipv1p0_imscpv1p2_v1p0.xsd', ] ]; public function __construct(array $options = []) { parent::__construct($options); foreach ($this->contentValidation as $key => &$array) { foreach ($array as &$value) { $value = __DIR__ . $value; } } foreach ($this->manifestValidation as $key => &$array) { foreach ($array as &$value) { $value = __DIR__ . $value; } } } /** * @param string $key the namespace of content to validate * @return array of schema for content validation */ public function getContentValidationSchema($key) { $validationArray = $this->getContentValidation(); return $this->getSchemas($validationArray, $key); } /** * @param string $key the namespace of manifest to validate * @return array of schema for manifest validation */ public function getManifestValidationSchema($key) { $validationArray = $this->getManifestValidation(); return $this->getSchemas($validationArray, $key); } /** * @param array $validationArray list of xsds for namespaces * @param string $key the namespace * @return array schemas for validation */ protected function getSchemas($validationArray, $key) { if (isset($validationArray[$key])) { return $validationArray[$key]; } return $validationArray['default']; } /** * @return array */ protected function getContentValidation() { return $this->contentValidation; } /** * @return array */ protected function getManifestValidation() { return $this->manifestValidation; } }