* @return void
*/
public final function setSocketResource ($socketResource) {
+ //* NOISY-DEBUG: */ $this->debugOutput($this->__toString() . '::' . __FUNCTION__ . ': socketResource=' . $socketResource . ',previous[' . gettype($this->socketResource) . ']=' . $this->socketResource);
$this->socketResource = $socketResource;
}
*
* @return $socketResource A valid socket resource
*/
- public function getSocketResource () {
+ public final function getSocketResource () {
+ //* NOISY-DEBUG: */ $this->debugOutput($this->__toString() . '::' . __FUNCTION__ . ': socketResource[' . gettype($this->socketResource) . ']=' . $this->socketResource);
return $this->socketResource;
}
// Return result
return $ret;
}
+
+ /**
+ * Checks whether the given hexadecimal number is really a hex-number (only chars 0-9,a-f).
+ *
+ * @param $num A string consisting only chars between 0 and 9
+ * @param $assertMismatch Whether to assert mismatches
+ * @return $ret The (hopefully) secured hext-numbered value
+ */
+ public function hexval ($num, $assertMismatch = false) {
+ // Filter all numbers out
+ $ret = preg_replace('/[^0123456789abcdefABCDEF]/', '', $num);
+
+ // Assert only if requested
+ if ($assertMismatch === true) {
+ // Has the whole value changed?
+ assert(('' . $ret . '' != '' . $num . '') && (!is_null($num)));
+ } // END - if
+
+ // Return result
+ return $ret;
+ }
}
// [EOF]