// Our own exception handler
function __exceptionHandler (FrameworkException $e) {
- // Call the app_die() method
- ApplicationEntryPoint::app_die(sprintf("[Main:] The application <span class=\"app_name\">%s</span> (<span class=\"app_short_name\">%s</span>) has terminated due to an uncaught exception: <span class=\"exception_name\">%s</span> <span class=\"exception_number\">[%s]</span>: <span class=\"debug_exception\">%s</span> Backtrace: <div class=\"debug_backtrace\">%s</div>",
+ // Call the app_exit() method
+ ApplicationEntryPoint::app_exit(sprintf('[Main:] The application <span class="app_name">%s</span> (<span class="app_short_name">%s</span>) has terminated due to an uncaught exception: <span class="exception_name">%s</span> <span class="exception_number">[%s]</span>: <span class="debug_exception">%s</span> Backtrace: <div class="debug_backtrace">%s</div>',
ApplicationHelper::getSelfInstance()->getAppName(),
ApplicationHelper::getSelfInstance()->getAppShortName(),
$e->__toString(),
// Error handler
function __errorHandler ($errno, $errstr, $errfile, $errline, array $errcontext) {
// Construct the message
- $message = sprintf("File: <span class=\"debug_file\">%s</span>, Line: <span class=\"debug_line\">%s</span>, Code: <span class=\"debug_code\">%s</span>, Message: <span class=\"debug_message\">%s</span>",
+ $message = sprintf('File: <span class="debug_file">%s</span>, Line: <span class="debug_line">%s</span>, Code: <span class="debug_code">%s</span>, Message: <span class="debug_message">%s</span>',
basename($errfile),
$errline,
$errno,
// Assertion handler
function __assertHandler ($file, $line, $code) {
// Empty code?
- if ($code === "") $code = "<em>Unknown</em>";
+ if (empty($code)) {
+ $code = '<em>Unknown</em>';
+ } // END - if
// Create message
- $message = sprintf("File: <span class=\"debug_file\">%s</span>, Line: <span class=\"debug_line\">%s</span>, Code: <span class=\"debug_code\">%s</span>",
+ $message = sprintf('File: <span class="debug_file">%s</span>, Line: <span class="debug_line">%s</span>, Code: <span class="debug_code">%s</span>',
basename($file),
$line,
$code
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-// Get config instance
-$cfg = FrameworkConfiguration::getSelfInstance();
-
-// Load all classes for the application
-foreach ($lowerClasses as $className) {
- // Load the application classes
- ClassLoader::getSelfInstance()->scanClassPath(sprintf("%s/%s/%s", $cfg->getConfigEntry('application_path'), $cfg->getConfigEntry('app_name'), $className));
-} // END - if
-
-// Clean up the global namespace
-unset($lowerClasses);
-unset($className);
+// Scan for application's classes, exceptions and interfaces
+ClassLoader::scanApplicationClasses();
// [EOF]
?>
// Some sanity checks
if ((empty($app)) || (is_null($app))) {
// Something went wrong!
- ApplicationEntryPoint::app_die(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.",
+ 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')
));
} elseif (!is_object($app)) {
// No object!
- ApplicationEntryPoint::app_die(sprintf("[Main:] The application <span class=\"app_name\">%s</span> could not be launched because 'app' is not an object.",
+ ApplicationEntryPoint::app_exit(sprintf("[Main:] The application <span class=\"app_name\">%s</span> could not be launched because 'app' is not an object.",
$application
));
} elseif (!method_exists($app, FrameworkConfiguration::getSelfInstance()->getConfigEntry('entry_method'))) {
// Method not found!
- ApplicationEntryPoint::app_die(sprintf("[Main:] The application <span class=\"app_name\">%s</span> could not be launched because the method <span class=\"method_name\">%s</span> is missing.",
+ ApplicationEntryPoint::app_exit(sprintf("[Main:] The application <span class=\"app_name\">%s</span> could not be launched because the method <span class=\"method_name\">%s</span> is missing.",
$application,
FrameworkConfiguration::getSelfInstance()->getConfigEntry('entry_method')
));
// Set application name and version
$app->setAppName('Ship-Simu Shipping Simulator');
$app->setAppVersion('0.0.0');
-$app->setAppShortName('shipsimu');
+$app->setAppShortName('ship_simu');
// [EOF]
?>
// Our own exception handler
function __exceptionHandler (FrameworkException $e) {
- // Call the app_die() method
- ApplicationEntryPoint::app_die(sprintf("[Main:] The application <span class=\"app_name\">%s</span> (<span class=\"app_short_name\">%s</span>) has terminated due to an uncaught exception: <span class=\"exception_name\">%s</span> <span class=\"exception_number\">[%s]</span>: <span class=\"debug_exception\">%s</span> Backtrace: <div class=\"debug_backtrace\">%s</div>",
+ // Call the app_exit() method
+ ApplicationEntryPoint::app_exit(sprintf("[Main:] The application <span class=\"app_name\">%s</span> (<span class=\"app_short_name\">%s</span>) has terminated due to an uncaught exception: <span class=\"exception_name\">%s</span> <span class=\"exception_number\">[%s]</span>: <span class=\"debug_exception\">%s</span> Backtrace: <div class=\"debug_backtrace\">%s</div>",
ApplicationHelper::getSelfInstance()->getAppName(),
ApplicationHelper::getSelfInstance()->getAppShortName(),
$e->__toString(),
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-// Get config instance
-$cfg = FrameworkConfiguration::getSelfInstance();
-
-// Load all classes for the application
-foreach ($lowerClasses as $className) {
- // Load the application classes
- ClassLoader::getSelfInstance()->scanClassPath(sprintf("%s/%s/%s", $cfg->getConfigEntry('application_path'), $cfg->getConfigEntry('app_name'), $className));
-} // END - if
-
-// Clean up the global namespace
-unset($lowerClasses);
-unset($className);
+// Scan for application's classes, exceptions and interfaces
+ClassLoader::scanApplicationClasses();
// [EOF]
?>
// As a customer the shippng company can withdraw from a contract
public function withdrawFromContract (SignableContract $contractInstance) {
- ApplicationEntryPoint::app_die("WITHDRAW:<pre>".print_r($contractInstance, true)."</pre>");
+ ApplicationEntryPoint::app_exit("WITHDRAW:<pre>".print_r($contractInstance, true)."</pre>");
}
// Get latest added contract instance
// Some sanity checks
if ((empty($app)) || (is_null($app))) {
// Something went wrong!
- ApplicationEntryPoint::app_die(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.",
+ 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')
));
} elseif (!is_object($app)) {
// No object!
- ApplicationEntryPoint::app_die(sprintf("[Main:] The application <span class=\"app_name\">%s</span> could not be launched because 'app' is not an object.",
+ ApplicationEntryPoint::app_exit(sprintf("[Main:] The application <span class=\"app_name\">%s</span> could not be launched because 'app' is not an object.",
$application
));
} elseif (!method_exists($app, FrameworkConfiguration::getSelfInstance()->getConfigEntry('entry_method'))) {
// Method not found!
- ApplicationEntryPoint::app_die(sprintf("[Main:] The application <span class=\"app_name\">%s</span> could not be launched because the method <span class=\"method_name\">%s</span> is missing.",
+ ApplicationEntryPoint::app_exit(sprintf("[Main:] The application <span class=\"app_name\">%s</span> could not be launched because the method <span class=\"method_name\">%s</span> is missing.",
$application,
FrameworkConfiguration::getSelfInstance()->getConfigEntry('entry_method')
));
*
* @author Roland Haeder <webmaster@shipsimu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
* @license GNU GPL 3.0 or any newer version
* @link http://www.shipsimu.org
*
// Is a message set?
if (empty($message)) {
// No message provided
- $message = 'No message provided!';
+ $message = 'No message provided.';
} // END - if
// Get config instance