Passed
Push — master ( b8c01d...9fe4d8 )
by Roeland
10:37 queued 10s
created
lib/private/RedisFactory.php 1 patch
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -25,88 +25,88 @@
 block discarded – undo
25 25
 namespace OC;
26 26
 
27 27
 class RedisFactory {
28
-	/** @var  \Redis */
29
-	private $instance;
28
+    /** @var  \Redis */
29
+    private $instance;
30 30
 
31
-	/** @var  SystemConfig */
32
-	private $config;
31
+    /** @var  SystemConfig */
32
+    private $config;
33 33
 
34
-	/**
35
-	 * RedisFactory constructor.
36
-	 *
37
-	 * @param SystemConfig $config
38
-	 */
39
-	public function __construct(SystemConfig $config) {
40
-		$this->config = $config;
41
-	}
34
+    /**
35
+     * RedisFactory constructor.
36
+     *
37
+     * @param SystemConfig $config
38
+     */
39
+    public function __construct(SystemConfig $config) {
40
+        $this->config = $config;
41
+    }
42 42
 
43
-	private function create() {
44
-		if ($config = $this->config->getValue('redis.cluster', [])) {
45
-			if (!class_exists('RedisCluster')) {
46
-				throw new \Exception('Redis Cluster support is not available');
47
-			}
48
-			// cluster config
49
-			if (isset($config['timeout'])) {
50
-				$timeout = $config['timeout'];
51
-			} else {
52
-				$timeout = null;
53
-			}
54
-			if (isset($config['read_timeout'])) {
55
-				$readTimeout = $config['read_timeout'];
56
-			} else {
57
-				$readTimeout = null;
58
-			}
59
-			$this->instance = new \RedisCluster(null, $config['seeds'], $timeout, $readTimeout);
43
+    private function create() {
44
+        if ($config = $this->config->getValue('redis.cluster', [])) {
45
+            if (!class_exists('RedisCluster')) {
46
+                throw new \Exception('Redis Cluster support is not available');
47
+            }
48
+            // cluster config
49
+            if (isset($config['timeout'])) {
50
+                $timeout = $config['timeout'];
51
+            } else {
52
+                $timeout = null;
53
+            }
54
+            if (isset($config['read_timeout'])) {
55
+                $readTimeout = $config['read_timeout'];
56
+            } else {
57
+                $readTimeout = null;
58
+            }
59
+            $this->instance = new \RedisCluster(null, $config['seeds'], $timeout, $readTimeout);
60 60
 
61
-			if (isset($config['failover_mode'])) {
62
-				$this->instance->setOption(\RedisCluster::OPT_SLAVE_FAILOVER, $config['failover_mode']);
63
-			}
64
-		} else {
61
+            if (isset($config['failover_mode'])) {
62
+                $this->instance->setOption(\RedisCluster::OPT_SLAVE_FAILOVER, $config['failover_mode']);
63
+            }
64
+        } else {
65 65
 
66
-			$this->instance = new \Redis();
67
-			$config = $this->config->getValue('redis', []);
68
-			if (isset($config['host'])) {
69
-				$host = $config['host'];
70
-			} else {
71
-				$host = '127.0.0.1';
72
-			}
73
-			if (isset($config['port'])) {
74
-				$port = $config['port'];
75
-			} else if ($host[0] !== '/') {
76
-				$port = 6379;
77
-			} else {
78
-				$port = null;
79
-			}
80
-			if (isset($config['timeout'])) {
81
-				$timeout = $config['timeout'];
82
-			} else {
83
-				$timeout = 0.0; // unlimited
84
-			}
66
+            $this->instance = new \Redis();
67
+            $config = $this->config->getValue('redis', []);
68
+            if (isset($config['host'])) {
69
+                $host = $config['host'];
70
+            } else {
71
+                $host = '127.0.0.1';
72
+            }
73
+            if (isset($config['port'])) {
74
+                $port = $config['port'];
75
+            } else if ($host[0] !== '/') {
76
+                $port = 6379;
77
+            } else {
78
+                $port = null;
79
+            }
80
+            if (isset($config['timeout'])) {
81
+                $timeout = $config['timeout'];
82
+            } else {
83
+                $timeout = 0.0; // unlimited
84
+            }
85 85
 
86
-			$this->instance->connect($host, $port, $timeout);
87
-			if (isset($config['password']) && $config['password'] !== '') {
88
-				$this->instance->auth($config['password']);
89
-			}
86
+            $this->instance->connect($host, $port, $timeout);
87
+            if (isset($config['password']) && $config['password'] !== '') {
88
+                $this->instance->auth($config['password']);
89
+            }
90 90
 
91
-			if (isset($config['dbindex'])) {
92
-				$this->instance->select($config['dbindex']);
93
-			}
94
-		}
95
-	}
91
+            if (isset($config['dbindex'])) {
92
+                $this->instance->select($config['dbindex']);
93
+            }
94
+        }
95
+    }
96 96
 
97
-	public function getInstance() {
98
-		if (!$this->isAvailable()) {
99
-			throw new \Exception('Redis support is not available');
100
-		}
101
-		if (!$this->instance instanceof \Redis) {
102
-			$this->create();
103
-		}
97
+    public function getInstance() {
98
+        if (!$this->isAvailable()) {
99
+            throw new \Exception('Redis support is not available');
100
+        }
101
+        if (!$this->instance instanceof \Redis) {
102
+            $this->create();
103
+        }
104 104
 
105
-		return $this->instance;
106
-	}
105
+        return $this->instance;
106
+    }
107 107
 
108
-	public function isAvailable() {
109
-		return extension_loaded('redis')
110
-		&& version_compare(phpversion('redis'), '2.2.5', '>=');
111
-	}
108
+    public function isAvailable() {
109
+        return extension_loaded('redis')
110
+        && version_compare(phpversion('redis'), '2.2.5', '>=');
111
+    }
112 112
 }
Please login to merge, or discard this patch.