From: Roland Häder Date: Fri, 19 May 2017 21:50:07 +0000 (+0200) Subject: Also no longer generic ... Same reason! X-Git-Url: https://git.mxchange.org/?p=core.git;a=commitdiff_plain;h=d9d2b0266fc21f4664087a8488d05c6d6068073b Also no longer generic ... Same reason! Signed-off-by: Roland Häder --- diff --git a/framework/main/classes/factories/client/.htaccess b/framework/main/classes/factories/client/.htaccess deleted file mode 100644 index 3a428827..00000000 --- a/framework/main/classes/factories/client/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/framework/main/classes/factories/client/class_ClientFactory.php b/framework/main/classes/factories/client/class_ClientFactory.php deleted file mode 100644 index 5da193dc..00000000 --- a/framework/main/classes/factories/client/class_ClientFactory.php +++ /dev/null @@ -1,76 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class ClientFactory extends ObjectFactory { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates a client object for given protocol. This method uses the - * registry pattern to cache those instances. - * - * @param $protocolInstance An instance of a HandleableProtocol class to create a client object for (e.g. 'http' for a HTTP/1.1 client) - * @param $socketResource A valid socket resource (optional) - * @return $clientInstance An instance of the requested client - */ - public static final function createClientByProtocolInstance (HandleableProtocol $protocolInstance, $socketResource = false) { - // Default is NULL (to initialize variable) - $clientInstance = NULL; - - // Generate registry key - $registryKey = strtolower($protocolInstance->getProtocolName()) . '_client'; - - // Is the key already in registry? - if (Registry::getRegistry()->instanceExists($registryKey)) { - // Then use that instance - $clientInstance = Registry::getRegistry()->getInstance($registryKey); - - // Set socket resource - $clientInstance->setSocketResource($socketResource); - } else { - // Generate object instance - $clientInstance = self::createObjectByConfiguredName($registryKey, array($socketResource)); - - // Set it in registry for later re-use - Registry::getRegistry()->addInstance($registryKey, $clientInstance); - } - - // Return the prepared instance - return $clientInstance; - } - -}