use CoreFramework\Object\BaseFrameworkSystem;
use CoreFramework\Response\Responseable;
+// Import SPL stuff
+use \SplFileInfo;
+
/**
* A generic template engine
*
private $compiledData = '';
/**
- * The last loaded template's FQFN for debugging the engine
+ * The last loaded template's file instance (SplFileInfo)
*/
- private $lastTemplate = '';
+ private $lastTemplate = NULL;
/**
* The variable stack for the templates
}
/**
- * Setter for the last loaded template's FQFN
+ * Setter for the last loaded template's file instance
*
* @param $template The last loaded template
* @return void
*/
- private final function setLastTemplate ($template) {
- $this->lastTemplate = (string) $template;
+ private final function setLastTemplate (SplFileInfo $fileInstance) {
+ $this->lastTemplate = $fileInstance;
}
/**
- * Getter for the last loaded template's FQFN
+ * Getter for the last loaded template's file instance
*
* @return $template The last loaded template
*/
* now entirely done by php_intl. These old thing with language-based
* template paths comes from an older time.
*/
- $fqfn = sprintf('%s%s%s%s%s%s',
+ $fileInstance = new SplFileInfo(sprintf('%s%s%s%s%s%s',
$this->getTemplateBasePath(),
$this->getGenericBasePath(),
$this->getTemplateType(),
DIRECTORY_SEPARATOR,
(string) $templateName,
$ext
- );
+ ));
// First try this
try {
// Load the raw template data
- $this->loadRawTemplateData($fqfn);
+ $this->loadRawTemplateData($fileInstance);
} catch (FileNotFoundException $e) {
// If we shall load a code-template we need to switch the file extension
if (($this->getTemplateType() != $this->getConfigInstance()->getConfigEntry('html_template_type')) && (empty($extOther))) {
$this->loadTemplate($templateName, $ext);
} else {
// Throw it again
- throw new FileNotFoundException($fqfn, self::EXCEPTION_FILE_NOT_FOUND);
+ throw new FileNotFoundException($fileInstance, self::EXCEPTION_FILE_NOT_FOUND);
}
}
/**
* A private loader for raw template names
*
- * @param $fqfn The full-qualified file name for a template
+ * @param $fileInstance An instance of a SplFileInfo class
* @return void
*/
- private function loadRawTemplateData ($fqfn) {
+ private function loadRawTemplateData (SplFileInfo $fileInstance) {
// Some debug code to look on the file which is being loaded
- //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']: FQFN=' . $fqfn);
+ //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEMPLATE[' . __METHOD__ . ':' . __LINE__ . ']: fileInstance=' . $fileInstance);
// Load the raw template
- $rawTemplateData = $this->getFileIoInstance()->loadFileContents($fqfn);
+ $rawTemplateData = $this->getFileIoInstance()->loadFileContents($fileInstance);
// Store the template's contents into this class
$this->setRawTemplateData($rawTemplateData);
- // Remember the template's FQFN
- $this->setLastTemplate($fqfn);
+ // Remember the template's file instance
+ $this->setLastTemplate($fileInstance);
}
/**