]> git.mxchange.org Git - core.git/commitdiff
Some API changes:
authorRoland Haeder <roland@mxchange.org>
Tue, 7 Oct 2014 18:33:01 +0000 (20:33 +0200)
committerRoland Haeder <roland@mxchange.org>
Tue, 7 Oct 2014 18:34:27 +0000 (20:34 +0200)
- ClientFactory now wants a protocol handler instance, instead of direct prococol name
- Double-quotes converted to single

Signed-off-by: Roland Häder <roland@mxchange.org>
inc/classes/main/factories/client/class_ClientFactory.php
inc/classes/main/helper/web/links/class_WebLinkHelper.php
inc/classes/main/resolver/controller/class_BaseControllerResolver.php
inc/classes/main/template/menu/class_MenuTemplateEngine.php

index 880f5cec371b6378d1560b7d3a891d7da74d72c0..597d6be7317be5a4e366688a6a6ec5c9e68b6289 100644 (file)
@@ -36,26 +36,16 @@ class ClientFactory extends ObjectFactory {
         * Creates a client object for given protocol. This method uses the
         * registry pattern to cache those instances.
         *
-        * @param       $protocol                       Protocol to create a client object for (e.g. 'http' for a HTTP/1.1 client)
+        * @param       $protocolInstance       An instance of a ProtocolHandler 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
-        * @throws      EmptyVariableException  If a variable is empty unexpectly
         */
-       public static final function createClientByProtokol ($protocol, $socketResource = FALSE) {
-               // Is the class name valid and is the class there?
-               if (empty($protocol)) {
-                       // Get an instance of this factory
-                       $factoryInstance = new ClientFactory();
-
-                       // Throw an exception here
-                       throw new EmptyVariableException(array($factoryInstance, 'protocol'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
-               } // END - if
-
+       public static final function createClientByProtocolInstance (ProtocolHandler $protocolInstance, $socketResource = FALSE) {
                // Default is NULL (to initialize variable)
                $clientInstance = NULL;
 
                // Generate registry key
-               $registryKey = $protocol . '_client';
+               $registryKey = strtolower($protocolInstance->getProtocolName()) . '_client';
 
                // Is the key already in registry?
                if (Registry::getRegistry()->instanceExists($registryKey)) {
index 3f97b4a84a1c688e833272250d2c5c3bfffae353..9ed903767de675027dc0f3dc06dc058f6ee45246 100644 (file)
@@ -287,7 +287,7 @@ class WebLinkHelper extends BaseWebHelper implements HelpableTemplate {
                } // END - if
 
                // Prepare action
-               $action = sprintf("%saction=%s",
+               $action = sprintf('%saction=%s',
                        $separator,
                        $linkAction
                );
index 937db3532123dd9946ea30d5ae4322c0d240f7a2..88c441e20ab506b71cac2f7e457e8d023dc1aba4 100644 (file)
@@ -101,7 +101,7 @@ class BaseControllerResolver extends BaseResolver {
                $resolverConfigEntry = '';
 
                // Try to read a config entry for our resolver including controller name... ;-)
-               $resolverConfigEntry = sprintf("%s_cmd_%s_resolver_class", strtolower($this->getClassPrefix()), strtolower($controllerName));
+               $resolverConfigEntry = sprintf('%s_cmd_%s_resolver_class', strtolower($this->getClassPrefix()), strtolower($controllerName));
 
                // Get the config, this will throw an exception if there is no special command resolver
                $resolverClass = $this->getConfigInstance()->getConfigEntry($resolverConfigEntry);
index 2930165920c6bb6226739e051e23e460a2f39e3a..1e53e4fa83044ee7e10b24458582c252385fb37a 100644 (file)
@@ -721,7 +721,7 @@ class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTempla
         */
        public function getMenuCacheFqfn () {
                // Get the FQFN ready
-               $fqfn = sprintf("%s%s%s/%s.%s",
+               $fqfn = sprintf('%s%s%s/%s.%s',
                        $this->getConfigInstance()->getConfigEntry('base_path'),
                        $this->getGenericBasePath(),
                        'menus/_cache',