class_WebTemplateEngine.php

Go to the documentation of this file.
00001 <?php
00025 class WebTemplateEngine extends BaseTemplateEngine implements CompileableTemplate {
00031         protected function __construct () {
00032                 // Call parent constructor
00033                 parent::__construct(__CLASS__);
00034         }
00035 
00050         public final static function createWebTemplateEngine ($basePath, ManageableLanguage  $langInstance, FileIoHandler $ioInstance) {
00051                 // Get a new instance
00052                 $tplInstance = new WebTemplateEngine();
00053 
00054                 // Is the base path valid?
00055                 if (empty($basePath)) {
00056                         // Base path is empty
00057                         throw new BasePathIsEmptyException($tplInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
00058                 } elseif (!is_string($basePath)) {
00059                         // Is not a string
00060                         throw new InvalidBasePathStringException(array($tplInstance, $basePath), self::EXCEPTION_INVALID_STRING);
00061                 } elseif (!is_dir($basePath)) {
00062                         // Is not a path
00063                         throw new BasePathIsNoDirectoryException(array($tplInstance, $basePath), self::EXCEPTION_INVALID_PATH_NAME);
00064                 } elseif (!is_readable($basePath)) {
00065                         // Is not readable
00066                         throw new BasePathReadProtectedException(array($tplInstance, $basePath), self::EXCEPTION_READ_PROTECED_PATH);
00067                 }
00068 
00069                 // Get configuration instance
00070                 $cfgInstance = FrameworkConfiguration::getInstance();
00071 
00072                 // Set the base path
00073                 $tplInstance->setBasePath($basePath);
00074 
00075                 // Set the language and IO instances
00076                 $tplInstance->setLanguageInstance($langInstance);
00077                 $tplInstance->setFileIoInstance($ioInstance);
00078 
00079                 // Set template extensions
00080                 $tplInstance->setRawTemplateExtension($cfgInstance->readConfig('raw_template_extension'));
00081                 $tplInstance->setCodeTemplateExtension($cfgInstance->readConfig('code_template_extension'));
00082 
00083                 // Absolute output path for compiled templates
00084                 $tplInstance->setCompileOutputPath($cfgInstance->readConfig('base_path') . $cfgInstance->readConfig('compile_output_path'));
00085 
00086                 // Return the prepared instance
00087                 return $tplInstance;
00088         }
00089 }
00090 
00091 // [EOF]
00092 ?>

Generated on Mon Dec 8 01:06:46 2008 for Ship-Simulator by  doxygen 1.5.6