From 417c6c9013006e8159a9035e94dabcabfa8f2b1b Mon Sep 17 00:00:00 2001 From: Stephan Kasdorf Date: Sat, 9 Nov 2019 18:08:35 +0100 Subject: [PATCH 1/2] REFACTORING: new autoloading functionallity, the modules are now structured for a better overview and module and visibility. Now the modules can also be used for bigger systems, but still are light weight. --- .../{ => module/users}/interfaces/users.php | 2 +- .../{trait => module/users/traits}/users.php | 2 +- application/module/{ => users}/users.php | 10 +-- .../settings/config/settings.development.ini | 6 +- core/c/autoloader.php | 76 +++++++------------ core/i/db.php | 1 + core/i/form.php | 2 +- 7 files changed, 38 insertions(+), 61 deletions(-) rename application/{ => module/users}/interfaces/users.php (85%) rename application/{trait => module/users/traits}/users.php (86%) rename application/module/{ => users}/users.php (64%) diff --git a/application/interfaces/users.php b/application/module/users/interfaces/users.php similarity index 85% rename from application/interfaces/users.php rename to application/module/users/interfaces/users.php index af2deba..ab40652 100644 --- a/application/interfaces/users.php +++ b/application/module/users/interfaces/users.php @@ -1,5 +1,5 @@ getConfig()[self::SETTINGS_SECTION][self::SETTINGS_CLASS_POS]; + foreach($folderSettings as $moduleFolderName) + { + $folderPath = str_replace(self::REGEX_PATH_NAME, $moduleFolderName, $folderPath); + } return new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator( $folderPath )); } @@ -205,58 +214,25 @@ class Autoloader /** * @desc run check on modules that should provide an interface as well as a trait */ - $iterator = self::folderContent(__DIR__ . Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS][self::INTERFACE_FOLDER] ); - foreach ( $iterator as $item ) + foreach(self::MODULES as $module) { - if($item->getFileName()!= self::MY_FILE_NAME && $item->getFileName()!="." && $item->getFileName()!="..") + $iterator = self::folderContent(__DIR__ . Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS][$module] ); + foreach ( $iterator as $item ) { - $interfaces[] = array( - 'nfilename' => str_replace('.php', '', $item->getFileName()), - 'filepathname' => $item->getPath() . '/' . $item->getFileName() - ); + if($item->getFileName()!= self::MY_FILE_NAME && $item->getFileName()!="." && $item->getFileName()!="..") + { + $moduleFolder[] = array( + 'nfilename' => str_replace('.php', '', $item->getFileName()), + 'filepathname' => $item->getPath() . '/' . $item->getFileName() + ); + } } - } - asort($interfaces); - $Sinterfaces = self::sortOrderModules($interfaces, self::SETTINGS_IFACE_POS); - foreach ($Sinterfaces as $interface) - { - self::$_filesInFoler[] = $interface['filepathname']; - } - - $iterator = self::folderContent(__DIR__ . Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS][self::TRAIT_FOLDER] ); - foreach ( $iterator as $item ) - { - if($item->getFileName()!= self::MY_FILE_NAME && $item->getFileName()!="." && $item->getFileName()!="..") + asort($moduleFolder); + $itms = self::sortOrderModules($moduleFolder, self::SETTINGS_IFACE_POS); + foreach ($itms as $itm) { - $traits[] = array( - 'nfilename' => str_replace('.php', '', $item->getFileName()), - 'filepathname' => $item->getPath() . '/' . $item->getFileName() - ); + self::$_filesInFoler[] = $itm['filepathname']; } } - asort($traits); - $Straits = self::sortOrderModules($traits, self::SETTINGS_TRAIT_POS); - foreach($Straits as $trait) - { - self::$_filesInFoler[] = $trait['filepathname']; - } - - $iterator = self::folderContent(__DIR__ . Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS][self::MODULE_FOLDER] ); - foreach ( $iterator as $item ) - { - if($item->getFileName()!= self::MY_FILE_NAME && $item->getFileName()!="." && $item->getFileName()!="..") - { - $modules[] = array( - 'nfilename' => str_replace('.php', '', $item->getFileName()), - 'filepathname' => $item->getPath() . '/' . $item->getFileName() - ); - } - } - asort($modules); - $Smodules = self::sortOrderModules($modules, self::SETTINGS_CLASS_POS); - foreach ($Smodules as $module) - { - self::$_filesInFoler[] = $module['filepathname']; - } } } \ No newline at end of file diff --git a/core/i/db.php b/core/i/db.php index e2d7301..6660dec 100644 --- a/core/i/db.php +++ b/core/i/db.php @@ -20,6 +20,7 @@ interface IDb * @desc inserts a rowset into the table, by the given nextInsertIndex return * value for the table * @param bool $id + * @param array $rowset * @return mixed */ public function insertRowsetById( $rowset = array(), $id = false ); diff --git a/core/i/form.php b/core/i/form.php index c1fbab4..33aa9ba 100644 --- a/core/i/form.php +++ b/core/i/form.php @@ -43,7 +43,7 @@ interface IForm /** * @desc loads the current Form element to the form - * @param $element + * @param $attributes * @return mixed */ public function loadElement( $attributes ); From d0971daff8a1e42a486f32bb4d0d578ff3452335 Mon Sep 17 00:00:00 2001 From: Stephan Kasdorf Date: Sat, 9 Nov 2019 18:31:52 +0100 Subject: [PATCH 2/2] REFACTORING: added documentation --- README.md | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 98d8a7f..9000963 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Nibiru ### Rapid Prototyping PHP Framework -Version 0.7.0 beta +Version 0.9.3 beta ## Introduction
Nibiru is a rapid prototyping framework written in PHP and based on the MVC design pattern. Now one may say that writing
@@ -100,7 +100,6 @@ Engine Implementation.
  • A soap extension will not be part of the system anymore, since that is just a bad habit, so this will be replaced with a REST api.
  • -

    Update

    Version 0.7.0 beta 27.01.2018

    -

    TODO

    -

    Version 0.7.1 beta

    +

    Version 0.7.0 beta

    +

    Update

    +

    Version 0.9.3 beta 09.11.2019

    + + +

    TODO

    +

    Still in progress for the next version

    +
    The start is done, have success with PHP prototyping, and always remember to have fun!
    Author: Stephan Kasdorf

    \ No newline at end of file