/** * Create a new LocalFileResolver object. * * @param string $basePath The base path from were the URLs will be resolved. * @throws \InvalidArgumentException If $basePath is not a valid string value. */ public function __construct($basePath = '') { parent::__construct($basePath); }
/** * Dereference the file referenced by an assessmentSectionRef. * * @param AssessmentSectionRef $assessmentSectionRef An AssessmentSectionRef object to dereference. * @param FileResolver $resolver The Resolver object to be used to resolve AssessmentSectionRef's href attribute. * @throws XmlStorageException If an error occurs while dereferencing the referenced file. * @return XmlAssessmentSection The AssessmentSection referenced by $assessmentSectionRef. */ protected static function resolveAssessmentSectionRef(AssessmentSectionRef $assessmentSectionRef, FileResolver $resolver) { try { $href = $resolver->resolve($assessmentSectionRef->getHref()); $doc = new XmlDocument(); $doc->load($href); return $doc->getDocumentComponent(); } catch (XmlStorageException $e) { $msg = "An error occured while unreferencing file '{$href}'."; throw new XmlStorageException($msg); } }