From dc0b1a382b5f980cffe87e9965e659d07107026e Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Sun, 10 Jul 2016 11:24:33 +0200 Subject: Each resource has now an ID; Code improvements and comment blocks added. --- include/classes/BigPipe/Item.php | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 include/classes/BigPipe/Item.php (limited to 'include/classes/BigPipe/Item.php') 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 @@ +] # +#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# +# # +# 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 -- cgit v1.2.3