Completed
Push — master ( 9e17e8...bb6fe9 )
by Fatih
01:21
created
src/AWSCustomMetric/Plugin/RedisCheck.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
 
53 53
     private function getServerPortArgs()
54 54
     {
55
-        return '-h ' . $this->getServer() . ' -p ' . $this->getPort();
55
+        return '-h '.$this->getServer().' -p '.$this->getPort();
56 56
     }
57 57
 
58 58
     private function getRedisCliCmd()
59 59
     {
60
-        return '/usr/bin/redis-cli ' . $this->getServerPortArgs();
60
+        return '/usr/bin/redis-cli '.$this->getServerPortArgs();
61 61
     }
62 62
 
63 63
     /**
@@ -82,28 +82,28 @@  discard block
 block discarded – undo
82 82
     private function findKeys()
83 83
     {
84 84
         try {
85
-            $this->diObj->getCommandRunner()->execute($this->getRedisCliCmd() . ' --raw dbsize');
85
+            $this->diObj->getCommandRunner()->execute($this->getRedisCliCmd().' --raw dbsize');
86 86
             $retVal = $this->diObj->getCommandRunner()->getReturnCode();
87 87
             $redisKeyCount = $this->diObj->getCommandRunner()->getOutput();
88 88
 
89 89
             if ($retVal!==0) {
90 90
                 if ($this->diObj->getLogger()) {
91 91
                     $this->diObj->getLogger()->error(
92
-                        'Redis KEyCount cmd failed!, RETVAL: ' . $retVal
93
-                        . ', OUT: ' . implode('|', $redisKeyCount)
92
+                        'Redis KEyCount cmd failed!, RETVAL: '.$retVal
93
+                        . ', OUT: '.implode('|', $redisKeyCount)
94 94
                     );
95 95
                 }
96 96
                 return false;
97 97
             }
98 98
             if ($redisKeyCount[0]>0) {
99
-                $this->diObj->getCommandRunner()->execute($this->getRedisCliCmd() . ' --raw keys *');
99
+                $this->diObj->getCommandRunner()->execute($this->getRedisCliCmd().' --raw keys *');
100 100
                 $retVal = $this->diObj->getCommandRunner()->getReturnCode();
101 101
                 $redisKeyList = $this->diObj->getCommandRunner()->getOutput();
102 102
                 if ($retVal!==0) {
103 103
                     if ($this->diObj->getLogger()) {
104 104
                         $this->diObj->getLogger()->error(
105
-                            'Redis KeyList cmd failed!, RETVAL: ' . $retVal
106
-                            . ', OUT: ' . implode('|', $redisKeyList)
105
+                            'Redis KeyList cmd failed!, RETVAL: '.$retVal
106
+                            . ', OUT: '.implode('|', $redisKeyList)
107 107
                         );
108 108
                     }
109 109
                     return false;
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
             }
115 115
         } catch (\Exception $e) {
116 116
             if ($this->diObj->getLogger()) {
117
-                $this->diObj->getLogger()->error('Redis client thrown exception! ExcpMsg: ' . $e->getMessage());
117
+                $this->diObj->getLogger()->error('Redis client thrown exception! ExcpMsg: '.$e->getMessage());
118 118
             }
119 119
             return false;
120 120
         }
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
     public function getMetrics()
127 127
     {
128 128
         try {
129
-            $redisKeyList = count($this->keys)==0?$this->findKeys():$this->keys;
129
+            $redisKeyList = count($this->keys)==0 ? $this->findKeys() : $this->keys;
130 130
             $totalLen     = 0;
131 131
             if ($redisKeyList && is_array($redisKeyList)) {
132 132
                 foreach ($redisKeyList as $redisKey) {
133 133
                     $this->diObj->getCommandRunner()->execute(
134
-                        $this->getRedisCliCmd() . ' --raw llen ' . trim($redisKey)
134
+                        $this->getRedisCliCmd().' --raw llen '.trim($redisKey)
135 135
                     );
136 136
                     $retVal = $this->diObj->getCommandRunner()->getReturnCode();
137 137
                     $redisKeyLen = $this->diObj->getCommandRunner()->getOutput();
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
             ];
146 146
         } catch (\Exception $e) {
147 147
             if ($this->diObj->getLogger()) {
148
-                $this->diObj->getLogger()->error('Redis client thrown exception! ExcpMsg: ' . $e->getMessage());
148
+                $this->diObj->getLogger()->error('Redis client thrown exception! ExcpMsg: '.$e->getMessage());
149 149
             }
150 150
             return false;
151 151
         }
Please login to merge, or discard this patch.