diff options
author | Thomas Lange <code@nerdmind.de> | 2018-02-03 20:48:03 +0100 |
---|---|---|
committer | Thomas Lange <code@nerdmind.de> | 2018-02-03 20:48:03 +0100 |
commit | 91b2862b990514c651a78f9b8f2c1fb6d5f11f12 (patch) | |
tree | 327f07fb134f8c2ebd4c6ba376b3c9de711c5615 /include/classes | |
parent | 9b9ff136acf374434f10f1b0b8d18fdc6d17de43 (diff) | |
download | bigpipe-91b2862b990514c651a78f9b8f2c1fb6d5f11f12.tar.gz bigpipe-91b2862b990514c651a78f9b8f2c1fb6d5f11f12.tar.xz bigpipe-91b2862b990514c651a78f9b8f2c1fb6d5f11f12.zip |
Add class "Application"
This commit adds a new class called "Application". This class will be responsible for creating Pagelet, Stylesheet and Javascript instances, either from the additional Debugging or original BigPipe namespace, based on whether the debugging flag of the application is set to true or false.
Diffstat (limited to 'include/classes')
-rw-r--r-- | include/classes/Application.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/include/classes/Application.php b/include/classes/Application.php new file mode 100644 index 0000000..d6ef6c5 --- /dev/null +++ b/include/classes/Application.php @@ -0,0 +1,38 @@ +<?php +class Application { + public static $debugging = FALSE; + + #=============================================================================== + # Create Pagelet instance + #=============================================================================== + public static function createPagelet($ID = NULL): BigPipe\Pagelet { + $namespace = self::$debugging ? 'Debugging' : 'BigPipe'; + $classname = "{$namespace}\Pagelet"; + + $Pagelet = new $classname(...func_get_args()); + return $Pagelet; + } + + #=============================================================================== + # Create Stylesheet instance + #=============================================================================== + public static function createStylesheet($ID, $href): BigPipe\Resource\Stylesheet { + $namespace = self::$debugging ? 'Debugging' : 'BigPipe'; + $classname = "{$namespace}\Resource\Stylesheet"; + + $Stylesheet = new $classname(...func_get_args()); + return $Stylesheet; + } + + #=============================================================================== + # Create Javascript instance + #=============================================================================== + public static function createJavascript($ID, $href): BigPipe\Resource\Javascript { + $namespace = self::$debugging ? 'Debugging' : 'BigPipe'; + $classname = "{$namespace}\Resource\Javascript"; + + $Javascript = new $classname(...func_get_args()); + return $Javascript; + } +} +?>
\ No newline at end of file |