]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/listener/class_BaseListener.php
Use array_push() instead of [] as array_push() checks if parameter 1 is really an...
[hub.git] / application / hub / main / listener / class_BaseListener.php
index 2906ef426e8626db91e40de8687410008c3853ed..6651198a5b7e7ad6144b3beabad770c3c547b54a 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Hub Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Hub Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.ship-simu.org
  *
@@ -82,7 +82,7 @@ class BaseListener extends BaseHubSystem implements Visitable {
                // We need to clear the error here if it is a resource
                if ($isServerSocket === true) {
                        // Clear the error
-                       //* DEBUG: */ $this->debugOutput('socketResource[]=' . gettype($socketResource));
+                       //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('socketResource[]=' . gettype($socketResource));
                        socket_clear_error($socketResource);
                } // END - if
 
@@ -242,6 +242,9 @@ class BaseListener extends BaseHubSystem implements Visitable {
 
                // Register the socket
                $registryInstance->registerSocket($this, $socketResource);
+
+               // And set it here
+               $this->setSocketResource($socketResource);
        }
 
        /**
@@ -261,22 +264,6 @@ class BaseListener extends BaseHubSystem implements Visitable {
                return $isRegistered;
        }
 
-       /**
-        * Getter for "this" socket resource
-        *
-        * @return      $socketResource         A valid socket resource
-        */
-       public final function getSocketResource () {
-               // Get a socket registry instance (singleton)
-               $registryInstance = SocketRegistryFactory::createSocketRegistryInstance();
-
-               // Get the socket resource
-               $socketResource = $registryInstance->getRegisteredSocketResource($this);
-
-               // Return it
-               return $socketResource;
-       }
-
        /**
         * Accepts the visitor to process the visit "request"
         *
@@ -285,7 +272,7 @@ class BaseListener extends BaseHubSystem implements Visitable {
         */
        public function accept (Visitor $visitorInstance) {
                // Debug message
-               //* DEBUG: */ $this->debugOutput(strtoupper($this->getProtocol()) . '-LISTENER: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - START');
+               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(strtoupper($this->getProtocol()) . '-LISTENER[' . __LINE__ . ']: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - START');
 
                // Visit this listener
                $visitorInstance->visitListener($this);
@@ -296,7 +283,7 @@ class BaseListener extends BaseHubSystem implements Visitable {
                } // END - if
 
                // Debug message
-               //* DEBUG: */ $this->debugOutput(strtoupper($this->getProtocol()) . '-LISTENER: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - FINISHED');
+               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(strtoupper($this->getProtocol()) . '-LISTENER[' . __LINE__ . ']: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - FINISHED');
        }
 
        /**