]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/statistics/connection/class_ConnectionStatisticsHelper.php
Refacturing to pass a ProtocolHandler instance instead of the direct name. This
[hub.git] / application / hub / main / statistics / connection / class_ConnectionStatisticsHelper.php
index 29e5df2d1395fe4780e4b747c3eb335bc25e822a..c0d5be35c883cd37e41f3e277f68b7923dd575db 100644 (file)
@@ -59,14 +59,14 @@ class ConnectionStatisticsHelper extends BaseHubSystem {
        public static function isConnectRetryExhausted (ConnectionHelper $helperInstance) {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-STATISTICS[' . __METHOD__ . ':' . __LINE__ . ']: helperInstance=' . $helperInstance->__toString() . ' - ENTERED!');
                // Construct config entry
-               $configEntry = $helperInstance->getProtocol() . '_connect_retry_max';
+               $configEntry = $helperInstance->getProtocolName() . '_connect_retry_max';
 
                // Check it out
                $isExhausted = (
                        (
-                               isset(self::$connectionStatistics[$helperInstance->getProtocol()][$helperInstance->__toString()]['retry_count'])
+                               isset(self::$connectionStatistics[$helperInstance->getProtocolName()][$helperInstance->__toString()]['retry_count'])
                        ) && (
-                               self::$connectionStatistics[$helperInstance->getProtocol()][$helperInstance->__toString()]['retry_count'] >= $helperInstance->getConfigInstance()->getConfigEntry($configEntry)
+                               self::$connectionStatistics[$helperInstance->getProtocolName()][$helperInstance->__toString()]['retry_count'] >= $helperInstance->getConfigInstance()->getConfigEntry($configEntry)
                        )
                );
 
@@ -84,19 +84,19 @@ class ConnectionStatisticsHelper extends BaseHubSystem {
        public static function increaseConnectRetry (ConnectionHelper $helperInstance) {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-STATISTICS[' . __METHOD__ . ':' . __LINE__ . ']: helperInstance=' . $helperInstance->__toString() . ' - ENTERED!');
                // Is the counter there
-               if (!isset(self::$connectionStatistics[$helperInstance->getProtocol()][$helperInstance->__toString()]['retry_count'])) {
+               if (!isset(self::$connectionStatistics[$helperInstance->getProtocolName()][$helperInstance->__toString()]['retry_count'])) {
                        // First attempt
                        //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-STATISTICS[' . __METHOD__ . ':' . __LINE__ . ']: helperInstance=' . $helperInstance->__toString() . ' - FIRST!');
-                       self::$connectionStatistics[$helperInstance->getProtocol()][$helperInstance->__toString()]['retry_count'] = 1;
+                       self::$connectionStatistics[$helperInstance->getProtocolName()][$helperInstance->__toString()]['retry_count'] = 1;
                } else {
                        // Next attempt
                        //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-STATISTICS[' . __METHOD__ . ':' . __LINE__ . ']: helperInstance=' . $helperInstance->__toString() . ' - INCREMENT!');
-                       self::$connectionStatistics[$helperInstance->getProtocol()][$helperInstance->__toString()]['retry_count']++;
+                       self::$connectionStatistics[$helperInstance->getProtocolName()][$helperInstance->__toString()]['retry_count']++;
                }
 
                // Create/update 'last_update' for purging
                // @TODO last_update is not being used at the moment
-               self::$connectionStatistics[$helperInstance->getProtocol()][$helperInstance->__toString()]['last_update'] = time();
+               self::$connectionStatistics[$helperInstance->getProtocolName()][$helperInstance->__toString()]['last_update'] = time();
        }
 }