]> git.mxchange.org Git - core.git/commitdiff
Continued rewriting:
authorRoland Haeder <roland@mxchange.org>
Wed, 15 Feb 2017 21:40:24 +0000 (22:40 +0100)
committerRoland Haeder <roland@mxchange.org>
Tue, 28 Feb 2017 21:09:54 +0000 (22:09 +0100)
- 'loader.php' is now deprecated and also no longer loaded, instead selector.php
  (also deprecated but still around) will load application's classes
- class name ApplicationHelper is now hard-wired

Signed-off-by: Roland Häder <roland@mxchange.org>
application/tests/data.php
application/tests/exceptions.php
application/tests/loader.php
application/tests/starter.php
inc/config.php
inc/loader/class_ClassLoader.php
inc/selector.php

index 7d50b5871eff2b76fbb486839c2d400ef1143610..e2132b755ec63fc990d50b8168678f87da71bbff 100644 (file)
@@ -1,8 +1,4 @@
 <?php
-// Import framework stuff
-use CoreFramework\Configuration\FrameworkConfiguration;
-use CoreFramework\Helper\Application\ApplicationHelper;
-
 /**
  * Application data
  *
@@ -29,12 +25,9 @@ use CoreFramework\Helper\Application\ApplicationHelper;
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
-// Get config instance
-$cfg = FrameworkConfiguration::getSelfInstance();
-
 // Get an instance of the helper
 $app = call_user_func_array(
-       array($cfg->getConfigEntry('app_helper_class'), 'getSelfInstance'),
+       array('CoreFramework\Helper\Application\ApplicationHelper', 'getSelfInstance'),
        array()
 );
 
index da44cf5ecb6124ac63850ba2031013be4d1011b1..ea239eb594953aeb6cf3f8bfe2293ae4836192fc 100644 (file)
@@ -90,7 +90,7 @@ Backtrace:
                // Invalid exception instance detected! Do *only* throw exceptions that
                // extends our own exception 'FrameworkException' to get such nice
                // outputs like above.
-               print('exceptionInstance[]=' . gettype($exceptionInstance) . ' is invalid! Please inform the core developer team.');
+               print('exceptionInstance[]=' . gettype($exceptionInstance) . ' is invalid! Please inform the core developer team.' . PHP_EOL);
        }
 }
 
index 089bb9f5931dcf75888d700d9dbba287dde42f09..f551ef47b7591c74e7b59193e56a1fa6505a87ab 100644 (file)
@@ -1,31 +1,3 @@
 <?php
-// Import framework stuff
-use CoreFramework\Loader\ClassLoader;
-
-/**
- * The application's class loader
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-// Scan for application's classes, exceptions and interfaces
-ClassLoader::scanApplicationClasses();
-
-// [EOF]
+// @DEPRECATED
 ?>
index 26c1080e7517f644abe701a441b9f0ca6020378b..b3f8d7d85f960a2199c779a0fced6360eb90d9dd 100644 (file)
@@ -29,7 +29,7 @@ use CoreFramework\Configuration\FrameworkConfiguration;
 // maining the application
 $app = call_user_func_array(
        array(
-               FrameworkConfiguration::getSelfInstance()->getConfigEntry('app_helper_class'), 'getSelfInstance'
+               'CoreFramework\Helper\Application\ApplicationHelper', 'getSelfInstance'
        ), array()
 );
 
@@ -38,7 +38,7 @@ if ((empty($app)) || (is_null($app))) {
        // Something went wrong!
        ApplicationEntryPoint::app_exit(sprintf("[Main:] The application <span class=\"app_name\">%s</span> could not be launched because the helper class <span class=\"class_name\">%s</span> is not loaded.",
                $application,
-               FrameworkConfiguration::getSelfInstance()->getConfigEntry('app_helper_class')
+               'CoreFramework\Helper\Application\ApplicationHelper'
        ));
 } elseif (!is_object($app)) {
        // No object!
index 605f6eabd3f359bf36ee7431f7957ec5a72d010d..4e9b902d9511f725aeb35ff485803ada360a52e3 100644 (file)
@@ -70,9 +70,6 @@ $cfg->setConfigEntry('code_template_extension', '.ctp');
 // CFG: SELECTOR-PATH
 $cfg->setConfigEntry('selector_path', 'selector');
 
-// CFG: APPLICATION-HELPER-CLASS
-$cfg->setConfigEntry('app_helper_class', 'ApplicationHelper');
-
 // CFG: LAUNCH-METHOD
 $cfg->setConfigEntry('entry_method', 'entryPoint');
 
index 8886bd18e7ded2e7d19e8735303bbbcf73153ed2..cef7d66eb9a4f6ee50afdb5ebb2531400b493696 100644 (file)
@@ -338,7 +338,7 @@ class ClassLoader {
                }
 
                // Get a new iterator
-               //* NOISY-DEBUG: */ printf('[%s:%d] basePath=%s' . PHP_EOL, __METHOD__, __LINE__, $basePath);
+               /* NOISY-DEBUG: */ printf('[%s:%d] basePath=%s' . PHP_EOL, __METHOD__, __LINE__, $basePath);
                $iteratorInstance = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($basePath), RecursiveIteratorIterator::CHILD_FIRST);
 
                // Load all entries
@@ -358,23 +358,23 @@ class ClassLoader {
                                $iteratorInstance->next();
 
                                // Skip non-file entries
-                               //* NOISY-DEBUG: */ printf('[%s:%d] SKIP: %s' . PHP_EOL, __METHOD__, __LINE__, $fileName);
+                               /* NOISY-DEBUG: */ printf('[%s:%d] SKIP: %s' . PHP_EOL, __METHOD__, __LINE__, $fileName);
                                continue;
                        } // END - if
 
                        // Is this file wanted?
-                       //* NOISY-DEBUG: */ printf('[%s:%d] FOUND: %s' . PHP_EOL, __METHOD__, __LINE__, $fileName);
+                       /* NOISY-DEBUG: */ printf('[%s:%d] FOUND: %s' . PHP_EOL, __METHOD__, __LINE__, $fileName);
                        if ((substr($fileName, 0, strlen($this->prefix)) == $this->prefix) && (substr($fileName, -strlen($this->suffix), strlen($this->suffix)) == $this->suffix)) {
                                // Add it to the list
-                               //* NOISY-DEBUG: */ printf('[%s:%d] ADD: %s,fqfn=%s' . PHP_EOL, __METHOD__, __LINE__, $fileName, $fqfn);
+                               /* NOISY-DEBUG: */ printf('[%s:%d] ADD: %s,fqfn=%s' . PHP_EOL, __METHOD__, __LINE__, $fileName, $fqfn);
                                $this->classes[$fileName] = $fqfn;
                        } else {
                                // Not added
-                               //* NOISY-DEBUG: */ printf('[%s:%d] NOT ADDED: %s,fqfn=%s' . PHP_EOL, __METHOD__, __LINE__, $fileName, $fqfn);
+                               /* NOISY-DEBUG: */ printf('[%s:%d] NOT ADDED: %s,fqfn=%s' . PHP_EOL, __METHOD__, __LINE__, $fileName, $fqfn);
                        }
 
                        // Advance to next entry
-                       //* NOISY-DEBUG: */ printf('[%s:%d] NEXT: %s' . PHP_EOL, __METHOD__, __LINE__, $fileName);
+                       /* NOISY-DEBUG: */ printf('[%s:%d] NEXT: %s' . PHP_EOL, __METHOD__, __LINE__, $fileName);
                        $iteratorInstance->next();
                } // END - while
        }
@@ -429,12 +429,12 @@ class ClassLoader {
                $fileName = $this->prefix . $shortClassName . $this->suffix;
 
                // Now look it up in our index
-               //* NOISY-DEBUG: */ printf('[%s:%d] ISSET: %s' . PHP_EOL, __METHOD__, __LINE__, $fileName);
+               /* NOISY-DEBUG: */ printf('[%s:%d] ISSET: %s' . PHP_EOL, __METHOD__, __LINE__, $fileName);
                if ((isset($this->classes[$fileName])) && (!in_array($this->classes[$fileName], $this->loadedClasses))) {
                        // File is found and not loaded so load it only once
-                       //* NOISY-DEBUG: */ printf('[%s:%d] LOAD: %s - START' . PHP_EOL, __METHOD__, __LINE__, $fileName);
+                       /* NOISY-DEBUG: */ printf('[%s:%d] LOAD: %s - START' . PHP_EOL, __METHOD__, __LINE__, $fileName);
                        require($this->classes[$fileName]);
-                       //* NOISY-DEBUG: */ printf('[%s:%d] LOAD: %s - END' . PHP_EOL, __METHOD__, __LINE__, $fileName);
+                       /* NOISY-DEBUG: */ printf('[%s:%d] LOAD: %s - END' . PHP_EOL, __METHOD__, __LINE__, $fileName);
 
                        // Count this loaded class/interface/exception
                        $this->total++;
@@ -443,18 +443,18 @@ class ClassLoader {
                        array_push($this->loadedClasses, $this->classes[$fileName]);
 
                        // Remove it from classes list so it won't be found twice.
-                       //* NOISY-DEBUG: */ printf('[%s:%d] UNSET: %s' . PHP_EOL, __METHOD__, __LINE__, $fileName);
+                       /* NOISY-DEBUG: */ printf('[%s:%d] UNSET: %s' . PHP_EOL, __METHOD__, __LINE__, $fileName);
                        unset($this->classes[$fileName]);
 
                        // Developer mode excludes caching (better debugging)
                        if (!defined('DEVELOPER')) {
                                // Reset cache
-                               //* NOISY-DEBUG: */ printf('[%s:%d] classesCached=FALSE' . PHP_EOL, __METHOD__, __LINE__);
+                               /* NOISY-DEBUG: */ printf('[%s:%d] classesCached=FALSE' . PHP_EOL, __METHOD__, __LINE__);
                                $this->classesCached = FALSE;
                        } // END - if
                } else {
                        // Not found
-                       //* NOISY-DEBUG: */ printf('[%s:%d] 404: %s' . PHP_EOL, __METHOD__, __LINE__, $fileName);
+                       /* NOISY-DEBUG: */ printf('[%s:%d] 404: %s' . PHP_EOL, __METHOD__, __LINE__, $fileName);
                }
        }
 
@@ -472,7 +472,7 @@ class ClassLoader {
                                require($fqfn);
 
                                // Remove it from the list
-                               //* NOISY-DEBUG: */ printf('[%s:%d] UNSET: %s' . PHP_EOL, __METHOD__, __LINE__, $fileName);
+                               /* NOISY-DEBUG: */ printf('[%s:%d] UNSET: %s' . PHP_EOL, __METHOD__, __LINE__, $fileName);
                                unset($this->classes[$fileName]);
                        } // END - if
                } // END - foreach
index 19095dc113b7934d2ff5731ac17e34819a30d8c4..7c8594f20a0156d08a2202be80afe0126fa4080c 100644 (file)
@@ -30,10 +30,9 @@ use CoreFramework\Object\BaseFrameworkSystem;
 
 // Try to load these includes in the given order
 $configAppIncludes = array(
-       'class_' . FrameworkConfiguration::getSelfInstance()->getConfigEntry('app_helper_class'), // The ApplicationHelper class
+       'class_ApplicationHelper', // The ApplicationHelper class
        'debug',                // Some debugging stuff
        'exceptions',   // The application's own exception handler
-       'loader',               // The application's class loader
        'config',               // The application's own configuration
        'config-local', // Local configuration file (optional)
        'data',                 // Application data
@@ -82,3 +81,6 @@ unset($appInc);
 unset($configAppIncludes);
 unset($appFqFn);
 unset($basePathFile);
+
+// Scan for application's classes, exceptions and interfaces
+ClassLoader::scanApplicationClasses();