]> git.mxchange.org Git - shipsimu.git/blobdiff - ship-simu/inc/classes.php
Initial import of current development status
[shipsimu.git] / ship-simu / inc / classes.php
diff --git a/ship-simu/inc/classes.php b/ship-simu/inc/classes.php
new file mode 100644 (file)
index 0000000..3830e40
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+/////// Load framework classes first ////////
+
+/**
+ * Lower framework classes
+ */
+$lowerClasses = array(
+       0 => "exceptions", // Exceptions
+       1 => "interfaces", // Interfaces
+       2 => "main",       // General main classes
+       3 => "middleware"  // The middleware
+);
+
+// Load all classes
+foreach ($lowerClasses as $class) {
+       // Try to load the framework classes
+       try {
+               ClassLoader::getInstance()->loadClasses(sprintf("inc/classes/%s/", $class));
+       } catch (PathIsNoDirectoryException $e) {
+               ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad <strong>%s</strong> nicht laden. Reason: <strong>%s</strong>",
+                       $class
+               ));
+       } catch (PathIsEmptyException $e) {
+               ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad <strong>%s</strong> nicht laden. Reason: <strong>%s</strong>",
+                       $class
+               ));
+       } catch (PathReadProtectedException $e) {
+               ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad <strong>%s</strong> nicht laden. Reason: <strong>%s</strong>",
+                       $class
+               ));
+       } catch (DirPointerNotOpenedException $e) {
+               ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad <strong>%s</strong> nicht laden. Reason: <strong>%s</strong>",
+                       $class
+               ));
+       }
+}
+
+// Include all classes
+ClassLoader::getInstance()->includeAllClasses();
+
+// Clean up the global namespace
+unset($lowerClasses[3]); // Applications shall not have any middleware
+unset($class);
+
+////// Until here the framework classes are loaded //////
+
+// [EOF]
+?>