Continued:
authorRoland Haeder <roland@mxchange.org>
Fri, 24 Feb 2017 20:23:05 +0000 (21:23 +0100)
committerRoland Haeder <roland@mxchange.org>
Tue, 28 Feb 2017 21:10:04 +0000 (22:10 +0100)
- scanApplicationClasses() must be called before starter.php is being included.
- this whole thing is old and needs an entire rewrite (which will take place
  slowly while this "namespace rewrite" and much more after it.
- added "import" for BaseResolver and Resolver

Signed-off-by: Roland H├Ąder <roland@mxchange.org>
application/tests/init.php
inc/loader/class_ClassLoader.php
inc/main/classes/resolver/action/class_BaseActionResolver.php
inc/main/classes/resolver/command/class_BaseCommandResolver.php
inc/main/classes/resolver/controller/class_BaseControllerResolver.php
inc/main/interfaces/resolver/actions/class_ActionResolver.php
inc/main/interfaces/resolver/class_Resolver.php
inc/main/interfaces/resolver/commands/class_CommandResolver.php
inc/main/interfaces/resolver/controller/class_ControllerResolver.php
inc/main/interfaces/resolver/state/class_StateResolver.php
inc/selector.php

index 4c6879c..b877ada 100644 (file)
@@ -1,13 +1,11 @@
 <?php
 // Import framework stuff
 use CoreFramework\Configuration\FrameworkConfiguration;
+use CoreFramework\Loader\ClassLoader;
 
 /**
  * Application initializer
  *
- * Please remember that this include file is being loaded *before* the class
- * loader is loading classes from "exceptions", "interfaces" and "main"!
- *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0
  * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
@@ -27,5 +25,8 @@ use CoreFramework\Configuration\FrameworkConfiguration;
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+// Scan for application's classes, exceptions and interfaces
+ClassLoader::scanApplicationClasses();
+
 // Get config instance
 $cfg = FrameworkConfiguration::getSelfInstance();
index 95e26bb..eee9fce 100644 (file)
@@ -190,11 +190,17 @@ class ClassLoader {
         * @return      void
         */
        public static function scanFrameworkClasses () {
+               // Trace message
+               /* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__);
+
                // Cache loader instance
                $loaderInstance = self::getSelfInstance();
 
                // Load all classes
                foreach (self::$frameworkPaths as $pathName) {
+                       // Debug message
+                       /* NOISY-DEBUG: */ printf('[%s:%d]: pathName=%s' . PHP_EOL, __METHOD__, __LINE__, $pathName);
+
                        // Try to load the framework classes
                        $loaderInstance->scanClassPath('inc/main/' . $pathName . '/');
                } // END - foreach
@@ -206,18 +212,24 @@ class ClassLoader {
         * @return      void
         */
        public static function scanApplicationClasses () {
+               // Trace message
+               /* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__);
+
                // Get config instance
                $cfg = FrameworkConfiguration::getSelfInstance();
 
                // Load all classes for the application
                foreach (self::$frameworkPaths as $class) {
                        // Create path name
-                       $path = sprintf('%s/%s/%s', $cfg->getConfigEntry('application_path'), $cfg->getConfigEntry('app_name'), $class);
+                       $pathName = sprintf('%s/%s/%s', $cfg->getConfigEntry('application_path'), $cfg->getConfigEntry('app_name'), $class);
+
+                       // Debug message
+                       /* NOISY-DEBUG: */ printf('[%s:%d]: pathName=%s' . PHP_EOL, __METHOD__, __LINE__, $pathName);
 
                        // Is the path readable?
-                       if (is_dir($path)) {
+                       if (is_dir($pathName)) {
                                // Try to load the application classes
-                               ClassLoader::getSelfInstance()->scanClassPath($path);
+                               ClassLoader::getSelfInstance()->scanClassPath($pathName);
                        } // END - if
                } // END - foreach
        }
index cd6cd5e..0c4841b 100644 (file)
@@ -4,6 +4,7 @@ namespace CoreFramework\Resolver\Action;
 
 // Import framework stuff
 use CoreFramework\Factory\ObjectFactory;
+use CoreFramework\Resolver\BaseResolver;
 
 /**
  * A generic action resolver class
index e538a8c..730e282 100644 (file)
@@ -5,6 +5,7 @@ namespace CoreFramework\Resolver\Controller;
 // Import framework stuff
 use CoreFramework\Factory\ObjectFactory;
 use CoreFramework\Request\Requestable;
+use CoreFramework\Resolver\BaseResolver;
 
 /**
  * A generic command resolver class
index 38b8124..13a086a 100644 (file)
@@ -4,6 +4,7 @@ namespace CoreFramework\Resolver\Controller;
 
 // Import framework stuff
 use CoreFramework\Factory\ObjectFactory;
+use CoreFramework\Resolver\BaseResolver;
 
 /**
  * A generic controller resolver class
index 7cfdccf..ec97b79 100644 (file)
@@ -4,6 +4,7 @@ namespace CoreFramework\Resolver\Action;
 
 // Import framework stuff
 use CoreFramework\Request\Requestable;
+use CoreFramework\Resolver\Generic\Resolver;
 
 /**
  * An instance for action resolver classes
index e06bdd4..437bbb8 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 // Own namespace
-namespace CoreFramework\Resolver;
+namespace CoreFramework\Resolver\Generic;
 
 // Import framework stuff
 use CoreFramework\Generic\FrameworkInterface;
index 149fa8f..71203a1 100644 (file)
@@ -4,6 +4,7 @@ namespace CoreFramework\Resolver\Command;
 
 // Import framework stuff
 use CoreFramework\Request\Requestable;
+use CoreFramework\Resolver\Generic\Resolver;
 
 /**
  * An instance for command resolver classes
index 1bf389a..a3c5307 100644 (file)
@@ -2,6 +2,9 @@
 // Own namespace
 namespace CoreFramework\Resolver\Controller;
 
+// Import framework stuff
+use CoreFramework\Resolver\Generic\Resolver;
+
 /**
  * An instance for controller resolver classes
  *
index be7657e..d9b8707 100644 (file)
@@ -2,6 +2,9 @@
 // Own namespace
 namespace CoreFramework\Resolver\State;
 
+// Import framework stuff
+use CoreFramework\Resolver\Generic\Resolver;
+
 /**
  * An instance for state resolver classes
  *
index 7c8594f..59abbe5 100644 (file)
@@ -81,6 +81,3 @@ unset($appInc);
 unset($configAppIncludes);
 unset($appFqFn);
 unset($basePathFile);
-
-// Scan for application's classes, exceptions and interfaces
-ClassLoader::scanApplicationClasses();