Added ifSocketResourceMatches()
authorRoland Häder <roland@mxchange.org>
Sat, 19 May 2012 14:53:51 +0000 (14:53 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 19 May 2012 14:53:51 +0000 (14:53 +0000)
inc/classes/main/container/socket/class_SocketContainer.php

index 03cbc1cf97a3e9115695432017c398d18935344a..d7bb080ebac48a721453b68aaf806718d1d5c0ea 100644 (file)
@@ -83,6 +83,23 @@ class SocketContainer extends BaseContainer implements Registerable {
                // Return result
                return $matches;
        }
                // 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]
 }
 
 // [EOF]