diff options
author | Thomas Lange <code@nerdmind.de> | 2016-07-10 11:24:33 +0200 |
---|---|---|
committer | Thomas Lange <code@nerdmind.de> | 2016-07-10 11:24:33 +0200 |
commit | dc0b1a382b5f980cffe87e9965e659d07107026e (patch) | |
tree | d05bd1dc5a7140caf40bb19483c93e0fe0a757f4 /include/classes/BigPipe/Resource.php | |
parent | 28f2ba2a44ca932e16ba6791a07ed42b62fe6803 (diff) | |
download | bigpipe-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/Resource.php')
-rwxr-xr-x | include/classes/BigPipe/Resource.php | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/include/classes/BigPipe/Resource.php b/include/classes/BigPipe/Resource.php index d93ad16..1aaeb35 100755 --- a/include/classes/BigPipe/Resource.php +++ b/include/classes/BigPipe/Resource.php @@ -1,11 +1,16 @@ <?php +#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# +# Abstract Resource representation class [Thomas Lange <tl@nerdmind.de>] # +#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# +# # +# [More information coming soon] # +# # +#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# namespace BigPipe; -abstract class Resource { - private $ID = ''; +abstract class Resource extends Item { private $type = ''; private $resourceURL = ''; - private $phaseDoneJS = []; private static $count = 0; #=============================================================================== @@ -29,18 +34,12 @@ abstract class Resource { #=============================================================================== # Build resource #=============================================================================== - public function __construct($type, $resourceURL) { - $this->phaseDoneJS = array_pad($this->phaseDoneJS, 3, []); - $this->ID = 'R'.++self::$count; + public function __construct($customID = NULL, $type, $resourceURL) { + $this->ID = $customID ?? 'R'.++self::$count; $this->type = $type; $this->resourceURL = $resourceURL; - } - #=============================================================================== - # Return the unique ID - #=============================================================================== - public function getID() { - return $this->ID; + $this->phaseDoneJS = array_pad($this->phaseDoneJS, 3, []); } #=============================================================================== @@ -56,19 +55,5 @@ abstract class Resource { public function getURL() { return $this->resourceURL; } - - #=============================================================================== - # Attach a PhaseDoneJS callback - #=============================================================================== - public function addPhaseDoneJS($phase, $callback) { - return $this->phaseDoneJS[$phase][] = removeLineBreaksAndTabs($callback); - } - - #=============================================================================== - # Return all registered PhaseDoneJS callbacks - #=============================================================================== - public function getPhaseDoneJS() { - return $this->phaseDoneJS; - } } ?>
\ No newline at end of file |