From ffdc0bd15e9506635ecbff78c2a59030f9be8c58 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Thu, 1 Mar 2018 17:21:48 +0100 Subject: [PATCH] [xdrm-framework] update: now implementations have 'Controller' as a suffix for the class name. --- build/api/core/ModuleFactory.php | 4 ++-- .../{Category.php => CategoryController.php} | 2 +- .../module/{Excel.php => ExcelController.php} | 6 ++--- ...{Formation.php => FormationController.php} | 2 +- .../{Stats.php => StatsController.php} | 3 +-- build/api/module/ProfessorController.php | 24 +++++++++++++++++++ .../{release.php => releaseController.php} | 2 +- .../module/{root.php => rootController.php} | 2 +- 8 files changed, 34 insertions(+), 11 deletions(-) rename build/api/module/{Category.php => CategoryController.php} (92%) rename build/api/module/{Excel.php => ExcelController.php} (99%) rename build/api/module/{Formation.php => FormationController.php} (92%) rename build/api/module/Professor/{Stats.php => StatsController.php} (97%) create mode 100644 build/api/module/ProfessorController.php rename build/api/module/{release.php => releaseController.php} (98%) rename build/api/module/{root.php => rootController.php} (89%) diff --git a/build/api/core/ModuleFactory.php b/build/api/core/ModuleFactory.php index 23ab7e5..8f3e22d 100755 --- a/build/api/core/ModuleFactory.php +++ b/build/api/core/ModuleFactory.php @@ -35,11 +35,11 @@ $module_ns = str_replace('/', '\\', $module); /* (4) On vérifie que la classe existe */ - if( !file_exists(__BUILD__."/api/module$module.php") ) + if( !file_exists(__BUILD__."/api/module${module}Controller.php") ) return false; /* (5) On récupère la classe */ - $class_name = "\\api\\module$module_ns"; + $class_name = "\\api\\module${module_ns}Controller"; /* (6) On retourne une instance */ return new $class_name($arguments); diff --git a/build/api/module/Category.php b/build/api/module/CategoryController.php similarity index 92% rename from build/api/module/Category.php rename to build/api/module/CategoryController.php index 77e7546..7a47427 100644 --- a/build/api/module/Category.php +++ b/build/api/module/CategoryController.php @@ -11,7 +11,7 @@ namespace api\module; use database\core\Repo; -class Category +class CategoryController { public function get($args){ diff --git a/build/api/module/Excel.php b/build/api/module/ExcelController.php similarity index 99% rename from build/api/module/Excel.php rename to build/api/module/ExcelController.php index ec842ff..2c3c398 100644 --- a/build/api/module/Excel.php +++ b/build/api/module/ExcelController.php @@ -21,7 +21,7 @@ use error\core\Err; use error\core\Error; use PhpOffice\PhpSpreadsheet\Exception; -class Excel +class ExcelController { private const startLineUE = 5; @@ -138,7 +138,7 @@ class Excel //starting the iteration foreach($UESpreadsheet->getRowIterator() as $row){ //skip the first rows - if($row->getRowIndex() < Excel::startLineUE) continue; + if($row->getRowIndex() < self::startLineUE) continue; $firstCellValue = ($UESpreadsheet->getCellByColumnAndRow(1,$row->getRowIndex()) ?? $exitWithNullException())->getValue(); @@ -260,7 +260,7 @@ class Excel foreach($ProfSpreadshit->getRowIterator() as $row){ //skip the first lines - if($row->getRowIndex() < Excel::startLineProf) continue; + if($row->getRowIndex() < self::startLineProf) continue; $firstCellValue = ($ProfSpreadshit->getCellByColumnAndRow(2,$row->getRowIndex()) ?? $exitWithNullException())->getValue(); $secondCellValue = ($ProfSpreadshit->getCellByColumnAndRow(3,$row->getRowIndex()) ?? $exitWithNullException())->getValue(); diff --git a/build/api/module/Formation.php b/build/api/module/FormationController.php similarity index 92% rename from build/api/module/Formation.php rename to build/api/module/FormationController.php index cd73ecb..14dfc9d 100644 --- a/build/api/module/Formation.php +++ b/build/api/module/FormationController.php @@ -11,7 +11,7 @@ namespace api\module; use database\core\Repo; -class Formation +class FormationController { public static function get($args){ diff --git a/build/api/module/Professor/Stats.php b/build/api/module/Professor/StatsController.php similarity index 97% rename from build/api/module/Professor/Stats.php rename to build/api/module/Professor/StatsController.php index f5b2524..f16e4f2 100644 --- a/build/api/module/Professor/Stats.php +++ b/build/api/module/Professor/StatsController.php @@ -12,8 +12,7 @@ namespace api\module\Professor; use database\core\Repo; use database\repo\professor; -class Stats -{ +class StatsController{ public static function get($args){ $idProf = 0; extract($args); diff --git a/build/api/module/ProfessorController.php b/build/api/module/ProfessorController.php new file mode 100644 index 0000000..eae9b0e --- /dev/null +++ b/build/api/module/ProfessorController.php @@ -0,0 +1,24 @@ + [1, 2]]; + } + +} \ No newline at end of file diff --git a/build/api/module/release.php b/build/api/module/releaseController.php similarity index 98% rename from build/api/module/release.php rename to build/api/module/releaseController.php index baa5c4f..091d45e 100644 --- a/build/api/module/release.php +++ b/build/api/module/releaseController.php @@ -6,7 +6,7 @@ use \error\core\Err; - class release{ + class releaseController{ /* Releases a project * diff --git a/build/api/module/root.php b/build/api/module/rootController.php similarity index 89% rename from build/api/module/root.php rename to build/api/module/rootController.php index 4534cb4..4195916 100644 --- a/build/api/module/root.php +++ b/build/api/module/rootController.php @@ -5,7 +5,7 @@ use \error\core\Error; - class root{ + class rootController{ /* Generates the API documentation *