*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Hub Developer Team
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
/**
* Instance of this class
*/
- private static $registryInstance = null;
+ private static $registryInstance = NULL;
/**
* Protected constructor
*
* @return $registryInstance An instance of this class
*/
- public final static function createSocketRegistry () {
+ public static final function createSocketRegistry () {
// Is an instance there?
if (is_null(self::$registryInstance)) {
// Not yet, so create one
// Is the socket already registered?
if ($this->isSocketRegistered($protocolInstance, $socketResource)) {
// Throw the exception
- throw new SocketAlreadyRegisteredException($protocolInstance, BaseListener::EXCEPTION_SOCKET_ALREADY_REGISTERED);
+ throw new SocketAlreadyRegisteredException(array($protocolInstance, $socketResource), BaseListener::EXCEPTION_SOCKET_ALREADY_REGISTERED);
} // END - if
// Does the instance exist?
$socketInstance = ObjectFactory::CreateObjectByConfiguredName('socket_container_class', array($socketResource, $protocolInstance, $packageData));
// We have a sub-registry, the socket key and the socket, now we need to put all together
+ /* DEBUG: */ $this->debugOutput('SOCKET-REGISTRY: socketKey=' . $socketKey . ',socketResource=' . $socketResource . ' - adding socket container instance ...');
$registryInstance->addInstance($socketKey, $socketInstance);
}
*/
public function getHandlerInstanceFromPackageData (array $packageData) {
// Init protocol instance
- $protocolInstance = null;
+ $protocolInstance = NULL;
// Get all keys and check them
foreach ($this->getInstanceRegistry() as $key=>$registryInstance) {
// This is always a SubRegistry instance
foreach ($registryInstance->getInstanceRegistry() as $subKey=>$containerInstance) {
// This is a SocketContainer instance, so does the recipient match?
- if ($containerInstance->ifAddressMatches($packageData['recipient'])) {
- // Found one, so get the protocol instance and abort
+ if ($containerInstance->ifAddressMatches($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT])) {
+ // Found one, so get the protocol instance and abort any further search
$protocolInstance = $containerInstance->getProtocolInstance();
break;
} // END - if