From: Roland Häder Date: Sat, 19 May 2012 14:53:51 +0000 (+0000) Subject: Added ifSocketResourceMatches() X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2c416f4507c23a19800dd055ec2f0e0e430c939c;p=core.git Added ifSocketResourceMatches() --- diff --git a/inc/classes/main/container/socket/class_SocketContainer.php b/inc/classes/main/container/socket/class_SocketContainer.php index 03cbc1cf..d7bb080e 100644 --- a/inc/classes/main/container/socket/class_SocketContainer.php +++ b/inc/classes/main/container/socket/class_SocketContainer.php @@ -83,6 +83,23 @@ class SocketContainer extends BaseContainer implements Registerable { // Return result return $matches; } + + /** + * Checks whether the given socket matches with stored + * + * @param $addressPort The address:port (IP to check + * @return $matches Whether given socket matches + */ + public final function ifSocketResourceMatches ($socketResource) { + // Debug message + /* NOISY-DEBUG: */ $this->debugOutput('SOCKET-CONTAINER: socketResource[' . gettype($socketResource) . ']=' .$socketResource . ',storedResource[' . gettype($this->getSocketResource()) . ']=' . $this->getSocketResource()); + + // So, does both match? + $matches = ((is_resource($socketResource)) && ($socketResource === $this->getSocketResource())); + + // Return result + return $matches; + } } // [EOF]