aboutsummaryrefslogtreecommitdiffstats
path: root/include/classes/BigPipe/Item.php
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2016-07-10 11:24:33 +0200
committerThomas Lange <code@nerdmind.de>2016-07-10 11:24:33 +0200
commitdc0b1a382b5f980cffe87e9965e659d07107026e (patch)
treed05bd1dc5a7140caf40bb19483c93e0fe0a757f4 /include/classes/BigPipe/Item.php
parent28f2ba2a44ca932e16ba6791a07ed42b62fe6803 (diff)
downloadbigpipe-dc0b1a382b5f980cffe87e9965e659d07107026e.tar.gz
bigpipe-dc0b1a382b5f980cffe87e9965e659d07107026e.tar.xz
bigpipe-dc0b1a382b5f980cffe87e9965e659d07107026e.zip
Each resource has now an ID; Code improvements and comment blocks added.
Diffstat (limited to 'include/classes/BigPipe/Item.php')
-rw-r--r--include/classes/BigPipe/Item.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/include/classes/BigPipe/Item.php b/include/classes/BigPipe/Item.php
new file mode 100644
index 0000000..a4c739c
--- /dev/null
+++ b/include/classes/BigPipe/Item.php
@@ -0,0 +1,38 @@
+<?php
+#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#
+# Abstract item class [Thomas Lange <tl@nerdmind.de>] #
+#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#
+# #
+# The item class abstracts the properties and methods that are required by the #
+# Pagelet and Resource class both. Each one can have PhaseDoneJS callbacks for #
+# several phases numbers which are defined as constants of the specific class. #
+# #
+#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#
+namespace BigPipe;
+
+abstract class Item {
+ protected $ID = '';
+ protected $phaseDoneJS = [];
+
+ #===============================================================================
+ # Return the unique ID
+ #===============================================================================
+ public function getID() {
+ return $this->ID;
+ }
+
+ #===============================================================================
+ # Return all registered PhaseDoneJS callbacks
+ #===============================================================================
+ public function getPhaseDoneJS(): array {
+ return $this->phaseDoneJS;
+ }
+
+ #===============================================================================
+ # Attach a PhaseDoneJS callback
+ #===============================================================================
+ public function addPhaseDoneJS($phase, $callback) {
+ return $this->phaseDoneJS[$phase][] = removeLineBreaksAndTabs($callback);
+ }
+}
+?> \ No newline at end of file