From 1d7348d802b3124e0047d94da1f86d47980b3972 Mon Sep 17 00:00:00 2001 From: "Bruno O. Notario" Date: Fri, 30 Jul 2021 02:37:27 -0300 Subject: [PATCH] Implement front interface --- system/engine/autoload.php | 5 +++-- system/engine/controller.php | 6 +----- system/engine/front.php | 11 ++++++++++- system/engine/interfaces/front.php | 14 ++++++++++++++ 4 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 system/engine/interfaces/front.php diff --git a/system/engine/autoload.php b/system/engine/autoload.php index bbd16b4..7b825c4 100644 --- a/system/engine/autoload.php +++ b/system/engine/autoload.php @@ -51,12 +51,13 @@ spl_autoload_register(function ($class) { 'document', 'response', 'classes', - 'abstracthelper' + 'abstracthelper', + 'interfaces\front' ]; if($namespace[0] == "Phacil" && in_array($classNative, $allowed)){ try { - include_once(DIR_SYSTEM . 'engine/'. $classNative.'.php'); + include_once(DIR_SYSTEM . 'engine/'. str_replace("\\", "/", $classNative).'.php'); return; } catch (\Exception $th) { $log = new \Phacil\Framework\Log(DIR_LOGS."exception.log"); diff --git a/system/engine/controller.php b/system/engine/controller.php index 1be3b56..2366f12 100644 --- a/system/engine/controller.php +++ b/system/engine/controller.php @@ -229,7 +229,7 @@ abstract class Controller { } } else { - $teste = DIR_APP_MODULAR.implode("/", $pegRoutWithoutLast)."/View/" .$this->template; + //$teste = DIR_APP_MODULAR.implode("/", $pegRoutWithoutLast)."/View/" .$this->template; if(file_exists(DIR_APP_MODULAR.implode("/", $pegRoutWithoutLast)."/View/" .$this->template)){ $templatePath = DIR_APP_MODULAR.implode("/", $pegRoutWithoutLast)."/View/"; } elseif(file_exists(DIR_APP_MODULAR.implode("/", $pegRoutWithoutPenultimate)."/View/" .$this->template)){ @@ -408,10 +408,6 @@ abstract class Controller { /** * @param bool $commonChildren * @return \Phacil\Framework\Response - * @throws TypeError - * @throws Mustache_Exception_UnknownTemplateException - * @throws RuntimeException - * @throws SmartyException * @throws Exception */ protected function out ($commonChildren = true) { diff --git a/system/engine/front.php b/system/engine/front.php index 1293057..065c71d 100644 --- a/system/engine/front.php +++ b/system/engine/front.php @@ -8,8 +8,12 @@ namespace Phacil\Framework; +use Phacil\Framework\Interfaces\front as frontinterface; + +use Exception; + /** @package Phacil\Framework */ -final class Front { +final class Front implements frontinterface { /** * @@ -67,6 +71,11 @@ final class Front { } } + /** + * @param object $action + * @return Action + * @throws Exception + */ private function execute(object $action) { $file = $action->getFile(); $class = $action->getClass(); diff --git a/system/engine/interfaces/front.php b/system/engine/interfaces/front.php new file mode 100644 index 0000000..8eca1b9 --- /dev/null +++ b/system/engine/interfaces/front.php @@ -0,0 +1,14 @@ +