X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=framework%2Fmain%2Fclasses%2Ftemplate%2Fconsole%2Fclass_ConsoleTemplateEngine.php;h=438e5a398c16b35368022efda513f41cadfeeedb;hp=9d485c4e9b191ef347e6af95b0d4ab068651286a;hb=refs%2Fheads%2Fmaster;hpb=3bb159161d180dd4c9a9d404f40bd77e855d56c4 diff --git a/framework/main/classes/template/console/class_ConsoleTemplateEngine.php b/framework/main/classes/template/console/class_ConsoleTemplateEngine.php index 9d485c4e..438e5a39 100644 --- a/framework/main/classes/template/console/class_ConsoleTemplateEngine.php +++ b/framework/main/classes/template/console/class_ConsoleTemplateEngine.php @@ -1,10 +1,14 @@ * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2023 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.shipsimu.org * @todo This template engine does not make use of setTemplateType() @@ -38,7 +42,7 @@ class ConsoleTemplateEngine extends BaseTemplateEngine implements CompileableTem * * @return void */ - protected function __construct () { + private function __construct () { // Call parent constructor parent::__construct(__CLASS__); } @@ -58,18 +62,15 @@ class ConsoleTemplateEngine extends BaseTemplateEngine implements CompileableTem $templateInstance = new ConsoleTemplateEngine(); // Get the application instance from registry - $applicationInstance = Registry::getRegistry()->getInstance('app'); + $applicationInstance = ApplicationHelper::getSelfInstance(); // Determine base path - $templateBasePath = $templateInstance->getConfigInstance()->getConfigEntry('application_base_path') . $applicationInstance->getRequestInstance()->getRequestElement('app') . '/'; + $templateBasePath = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('application_base_path') . $applicationInstance->getAppShortName(). '/'; // Is the base path valid? if (empty($templateBasePath)) { // Base path is empty - throw new UnexpectedValueException(sprintf('[%s:%d] Variable templateBasePath is empty.', $templateInstance->__toString(), __LINE__), self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif (!is_string($templateBasePath)) { - // Is not a string - throw new UnexpectedValueException(sprintf('[%s:%d] %s is not a string with a base path.', $templateInstance->__toString(), __LINE__, $templateBasePath), self::EXCEPTION_INVALID_STRING); + throw new UnexpectedValueException(sprintf('[%s:%d] Variable templateBasePath is empty.', $templateInstance->__toString(), __LINE__), FrameworkInterface::EXCEPTION_UNEXPECTED_VALUE); } elseif (!is_dir($templateBasePath)) { // Is not a path throw new InvalidDirectoryException(array($templateInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME); @@ -82,11 +83,14 @@ class ConsoleTemplateEngine extends BaseTemplateEngine implements CompileableTem $templateInstance->setTemplateBasePath($templateBasePath); // Set template extensions - $templateInstance->setRawTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('raw_template_extension')); - $templateInstance->setCodeTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('code_template_extension')); + $templateInstance->setRawTemplateExtension(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('raw_template_extension')); + $templateInstance->setCodeTemplateExtension(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('code_template_extension')); // Absolute output path for compiled templates - $templateInstance->setCompileOutputPath($templateInstance->getConfigInstance()->getConfigEntry('base_path') . $templateInstance->getConfigInstance()->getConfigEntry('compile_output_path')); + $templateInstance->setCompileOutputPath(sprintf('%s%s/', + $templateBasePath, + FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('compile_output_path') + )); // Return the prepared instance return $templateInstance;