summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
4253d60)
- 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>
* Creates a client object for given protocol. This method uses the
* registry pattern to cache those instances.
*
* 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
* @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
// 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)) {
// Is the key already in registry?
if (Registry::getRegistry()->instanceExists($registryKey)) {
} // END - if
// Prepare action
} // END - if
// Prepare action
- $action = sprintf("%saction=%s",
+ $action = sprintf('%saction=%s',
$separator,
$linkAction
);
$separator,
$linkAction
);
$resolverConfigEntry = '';
// Try to read a config entry for our resolver including controller name... ;-)
$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);
// Get the config, this will throw an exception if there is no special command resolver
$resolverClass = $this->getConfigInstance()->getConfigEntry($resolverConfigEntry);
*/
public function getMenuCacheFqfn () {
// Get the FQFN ready
*/
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',
$this->getConfigInstance()->getConfigEntry('base_path'),
$this->getGenericBasePath(),
'menus/_cache',