Passed
Push — master ( a29359...c5c3d0 )
by Blizzz
15:18 queued 10s
created
lib/private/DB/QueryBuilder/QuoteHelper.php 2 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -27,55 +27,55 @@
 block discarded – undo
27 27
 use OCP\DB\QueryBuilder\IQueryFunction;
28 28
 
29 29
 class QuoteHelper {
30
-	/**
31
-	 * @param array|string|ILiteral|IParameter|IQueryFunction $strings string, Literal or Parameter
32
-	 * @return array|string
33
-	 */
34
-	public function quoteColumnNames($strings) {
35
-		if (!is_array($strings)) {
36
-			return $this->quoteColumnName($strings);
37
-		}
30
+    /**
31
+     * @param array|string|ILiteral|IParameter|IQueryFunction $strings string, Literal or Parameter
32
+     * @return array|string
33
+     */
34
+    public function quoteColumnNames($strings) {
35
+        if (!is_array($strings)) {
36
+            return $this->quoteColumnName($strings);
37
+        }
38 38
 
39
-		$return = [];
40
-		foreach ($strings as $string) {
41
-			$return[] = $this->quoteColumnName($string);
42
-		}
39
+        $return = [];
40
+        foreach ($strings as $string) {
41
+            $return[] = $this->quoteColumnName($string);
42
+        }
43 43
 
44
-		return $return;
45
-	}
44
+        return $return;
45
+    }
46 46
 
47
-	/**
48
-	 * @param string|ILiteral|IParameter|IQueryFunction $string string, Literal or Parameter
49
-	 * @return string
50
-	 */
51
-	public function quoteColumnName($string) {
52
-		if ($string instanceof IParameter || $string instanceof ILiteral || $string instanceof IQueryFunction) {
53
-			return (string) $string;
54
-		}
47
+    /**
48
+     * @param string|ILiteral|IParameter|IQueryFunction $string string, Literal or Parameter
49
+     * @return string
50
+     */
51
+    public function quoteColumnName($string) {
52
+        if ($string instanceof IParameter || $string instanceof ILiteral || $string instanceof IQueryFunction) {
53
+            return (string) $string;
54
+        }
55 55
 
56
-		if ($string === null || $string === 'null' || $string === '*') {
57
-			return $string;
58
-		}
56
+        if ($string === null || $string === 'null' || $string === '*') {
57
+            return $string;
58
+        }
59 59
 
60
-		if (!is_string($string)) {
61
-			throw new \InvalidArgumentException('Only strings, Literals and Parameters are allowed');
62
-		}
60
+        if (!is_string($string)) {
61
+            throw new \InvalidArgumentException('Only strings, Literals and Parameters are allowed');
62
+        }
63 63
 
64
-		$string = str_replace(' AS ', ' as ', $string);
65
-		if (substr_count($string, ' as ')) {
66
-			return implode(' as ', array_map([$this, 'quoteColumnName'], explode(' as ', $string, 2)));
67
-		}
64
+        $string = str_replace(' AS ', ' as ', $string);
65
+        if (substr_count($string, ' as ')) {
66
+            return implode(' as ', array_map([$this, 'quoteColumnName'], explode(' as ', $string, 2)));
67
+        }
68 68
 
69
-		if (substr_count($string, '.')) {
70
-			list($alias, $columnName) = explode('.', $string, 2);
69
+        if (substr_count($string, '.')) {
70
+            list($alias, $columnName) = explode('.', $string, 2);
71 71
 
72
-			if ($columnName === '*') {
73
-				return '`' . $alias . '`.*';
74
-			}
72
+            if ($columnName === '*') {
73
+                return '`' . $alias . '`.*';
74
+            }
75 75
 
76
-			return '`' . $alias . '`.`' . $columnName . '`';
77
-		}
76
+            return '`' . $alias . '`.`' . $columnName . '`';
77
+        }
78 78
 
79
-		return '`' . $string . '`';
80
-	}
79
+        return '`' . $string . '`';
80
+    }
81 81
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -70,12 +70,12 @@
 block discarded – undo
70 70
 			list($alias, $columnName) = explode('.', $string, 2);
71 71
 
72 72
 			if ($columnName === '*') {
73
-				return '`' . $alias . '`.*';
73
+				return '`'.$alias.'`.*';
74 74
 			}
75 75
 
76
-			return '`' . $alias . '`.`' . $columnName . '`';
76
+			return '`'.$alias.'`.`'.$columnName.'`';
77 77
 		}
78 78
 
79
-		return '`' . $string . '`';
79
+		return '`'.$string.'`';
80 80
 	}
81 81
 }
Please login to merge, or discard this patch.
apps/testing/lib/Controller/ConfigController.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -29,39 +29,39 @@
 block discarded – undo
29 29
 
30 30
 class ConfigController extends OCSController {
31 31
 
32
-	/** @var IConfig */
33
-	private $config;
32
+    /** @var IConfig */
33
+    private $config;
34 34
 
35
-	/**
36
-	 * @param string $appName
37
-	 * @param IRequest $request
38
-	 * @param IConfig $config
39
-	 */
40
-	public function __construct($appName,
41
-								IRequest $request,
42
-								IConfig $config) {
43
-		parent::__construct($appName, $request);
44
-		$this->config = $config;
45
-	}
35
+    /**
36
+     * @param string $appName
37
+     * @param IRequest $request
38
+     * @param IConfig $config
39
+     */
40
+    public function __construct($appName,
41
+                                IRequest $request,
42
+                                IConfig $config) {
43
+        parent::__construct($appName, $request);
44
+        $this->config = $config;
45
+    }
46 46
 
47
-	/**
48
-	 * @param string $appid
49
-	 * @param string $configkey
50
-	 * @param string $value
51
-	 * @return DataResponse
52
-	 */
53
-	public function setAppValue($appid, $configkey, $value) {
54
-		$this->config->setAppValue($appid, $configkey, $value);
55
-		return new DataResponse();
56
-	}
47
+    /**
48
+     * @param string $appid
49
+     * @param string $configkey
50
+     * @param string $value
51
+     * @return DataResponse
52
+     */
53
+    public function setAppValue($appid, $configkey, $value) {
54
+        $this->config->setAppValue($appid, $configkey, $value);
55
+        return new DataResponse();
56
+    }
57 57
 
58
-	/**
59
-	 * @param string $appid
60
-	 * @param string $configkey
61
-	 * @return DataResponse
62
-	 */
63
-	public function deleteAppValue($appid, $configkey) {
64
-		$this->config->deleteAppValue($appid, $configkey);
65
-		return new DataResponse();
66
-	}
58
+    /**
59
+     * @param string $appid
60
+     * @param string $configkey
61
+     * @return DataResponse
62
+     */
63
+    public function deleteAppValue($appid, $configkey) {
64
+        $this->config->deleteAppValue($appid, $configkey);
65
+        return new DataResponse();
66
+    }
67 67
 }
Please login to merge, or discard this patch.
lib/public/AppFramework/Http/ICallbackResponse.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -33,12 +33,12 @@
 block discarded – undo
33 33
  */
34 34
 interface ICallbackResponse {
35 35
 
36
-	/**
37
-	 * Outputs the content that should be printed
38
-	 *
39
-	 * @param IOutput $output a small wrapper that handles output
40
-	 * @since 8.1.0
41
-	 */
42
-	public function callback(IOutput $output);
36
+    /**
37
+     * Outputs the content that should be printed
38
+     *
39
+     * @param IOutput $output a small wrapper that handles output
40
+     * @since 8.1.0
41
+     */
42
+    public function callback(IOutput $output);
43 43
 
44 44
 }
Please login to merge, or discard this patch.
lib/private/Memcache/Memcached.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	}
98 98
 
99 99
 	public function get($key) {
100
-		$result = self::$cache->get($this->getNameSpace() . $key);
100
+		$result = self::$cache->get($this->getNameSpace().$key);
101 101
 		if ($result === false and self::$cache->getResultCode() == \Memcached::RES_NOTFOUND) {
102 102
 			return null;
103 103
 		} else {
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
 
108 108
 	public function set($key, $value, $ttl = 0) {
109 109
 		if ($ttl > 0) {
110
-			$result =  self::$cache->set($this->getNameSpace() . $key, $value, $ttl);
110
+			$result = self::$cache->set($this->getNameSpace().$key, $value, $ttl);
111 111
 		} else {
112
-			$result = self::$cache->set($this->getNameSpace() . $key, $value);
112
+			$result = self::$cache->set($this->getNameSpace().$key, $value);
113 113
 		}
114 114
 		if ($result !== true) {
115 115
 			$this->verifyReturnCode();
@@ -118,12 +118,12 @@  discard block
 block discarded – undo
118 118
 	}
119 119
 
120 120
 	public function hasKey($key) {
121
-		self::$cache->get($this->getNameSpace() . $key);
121
+		self::$cache->get($this->getNameSpace().$key);
122 122
 		return self::$cache->getResultCode() === \Memcached::RES_SUCCESS;
123 123
 	}
124 124
 
125 125
 	public function remove($key) {
126
-		$result= self::$cache->delete($this->getNameSpace() . $key);
126
+		$result = self::$cache->delete($this->getNameSpace().$key);
127 127
 		if (self::$cache->getResultCode() !== \Memcached::RES_NOTFOUND) {
128 128
 			$this->verifyReturnCode();
129 129
 		}
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	}
132 132
 
133 133
 	public function clear($prefix = '') {
134
-		$prefix = $this->getNameSpace() . $prefix;
134
+		$prefix = $this->getNameSpace().$prefix;
135 135
 		$allKeys = self::$cache->getAllKeys();
136 136
 		if ($allKeys === false) {
137 137
 			// newer Memcached doesn't like getAllKeys(), flush everything
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 * @throws \Exception
166 166
 	 */
167 167
 	public function add($key, $value, $ttl = 0) {
168
-		$result = self::$cache->add($this->getPrefix() . $key, $value, $ttl);
168
+		$result = self::$cache->add($this->getPrefix().$key, $value, $ttl);
169 169
 		if (self::$cache->getResultCode() !== \Memcached::RES_NOTSTORED) {
170 170
 			$this->verifyReturnCode();
171 171
 		}
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 */
182 182
 	public function inc($key, $step = 1) {
183 183
 		$this->add($key, 0);
184
-		$result = self::$cache->increment($this->getPrefix() . $key, $step);
184
+		$result = self::$cache->increment($this->getPrefix().$key, $step);
185 185
 
186 186
 		if (self::$cache->getResultCode() !== \Memcached::RES_SUCCESS) {
187 187
 			return false;
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 * @return int | bool
199 199
 	 */
200 200
 	public function dec($key, $step = 1) {
201
-		$result = self::$cache->decrement($this->getPrefix() . $key, $step);
201
+		$result = self::$cache->decrement($this->getPrefix().$key, $step);
202 202
 
203 203
 		if (self::$cache->getResultCode() !== \Memcached::RES_SUCCESS) {
204 204
 			return false;
Please login to merge, or discard this patch.
Indentation   +189 added lines, -189 removed lines patch added patch discarded remove patch
@@ -36,193 +36,193 @@
 block discarded – undo
36 36
 use OCP\IMemcache;
37 37
 
38 38
 class Memcached extends Cache implements IMemcache {
39
-	use CASTrait;
40
-
41
-	/**
42
-	 * @var \Memcached $cache
43
-	 */
44
-	private static $cache = null;
45
-
46
-	use CADTrait;
47
-
48
-	public function __construct($prefix = '') {
49
-		parent::__construct($prefix);
50
-		if (is_null(self::$cache)) {
51
-			self::$cache = new \Memcached();
52
-
53
-			$defaultOptions = [
54
-				\Memcached::OPT_CONNECT_TIMEOUT => 50,
55
-				\Memcached::OPT_RETRY_TIMEOUT =>   50,
56
-				\Memcached::OPT_SEND_TIMEOUT =>    50,
57
-				\Memcached::OPT_RECV_TIMEOUT =>    50,
58
-				\Memcached::OPT_POLL_TIMEOUT =>    50,
59
-
60
-				// Enable compression
61
-				\Memcached::OPT_COMPRESSION =>          true,
62
-
63
-				// Turn on consistent hashing
64
-				\Memcached::OPT_LIBKETAMA_COMPATIBLE => true,
65
-
66
-				// Enable Binary Protocol
67
-				//\Memcached::OPT_BINARY_PROTOCOL =>      true,
68
-			];
69
-			// by default enable igbinary serializer if available
70
-			if (\Memcached::HAVE_IGBINARY) {
71
-				$defaultOptions[\Memcached::OPT_SERIALIZER] =
72
-					\Memcached::SERIALIZER_IGBINARY;
73
-			}
74
-			$options = \OC::$server->getConfig()->getSystemValue('memcached_options', []);
75
-			if (is_array($options)) {
76
-				$options = $options + $defaultOptions;
77
-				self::$cache->setOptions($options);
78
-			} else {
79
-				throw new HintException("Expected 'memcached_options' config to be an array, got $options");
80
-			}
81
-
82
-			$servers = \OC::$server->getSystemConfig()->getValue('memcached_servers');
83
-			if (!$servers) {
84
-				$server = \OC::$server->getSystemConfig()->getValue('memcached_server');
85
-				if ($server) {
86
-					$servers = [$server];
87
-				} else {
88
-					$servers = [['localhost', 11211]];
89
-				}
90
-			}
91
-			self::$cache->addServers($servers);
92
-		}
93
-	}
94
-
95
-	/**
96
-	 * entries in XCache gets namespaced to prevent collisions between owncloud instances and users
97
-	 */
98
-	protected function getNameSpace() {
99
-		return $this->prefix;
100
-	}
101
-
102
-	public function get($key) {
103
-		$result = self::$cache->get($this->getNameSpace() . $key);
104
-		if ($result === false and self::$cache->getResultCode() == \Memcached::RES_NOTFOUND) {
105
-			return null;
106
-		} else {
107
-			return $result;
108
-		}
109
-	}
110
-
111
-	public function set($key, $value, $ttl = 0) {
112
-		if ($ttl > 0) {
113
-			$result =  self::$cache->set($this->getNameSpace() . $key, $value, $ttl);
114
-		} else {
115
-			$result = self::$cache->set($this->getNameSpace() . $key, $value);
116
-		}
117
-		if ($result !== true) {
118
-			$this->verifyReturnCode();
119
-		}
120
-		return $result;
121
-	}
122
-
123
-	public function hasKey($key) {
124
-		self::$cache->get($this->getNameSpace() . $key);
125
-		return self::$cache->getResultCode() === \Memcached::RES_SUCCESS;
126
-	}
127
-
128
-	public function remove($key) {
129
-		$result= self::$cache->delete($this->getNameSpace() . $key);
130
-		if (self::$cache->getResultCode() !== \Memcached::RES_NOTFOUND) {
131
-			$this->verifyReturnCode();
132
-		}
133
-		return $result;
134
-	}
135
-
136
-	public function clear($prefix = '') {
137
-		$prefix = $this->getNameSpace() . $prefix;
138
-		$allKeys = self::$cache->getAllKeys();
139
-		if ($allKeys === false) {
140
-			// newer Memcached doesn't like getAllKeys(), flush everything
141
-			self::$cache->flush();
142
-			return true;
143
-		}
144
-		$keys = [];
145
-		$prefixLength = strlen($prefix);
146
-		foreach ($allKeys as $key) {
147
-			if (substr($key, 0, $prefixLength) === $prefix) {
148
-				$keys[] = $key;
149
-			}
150
-		}
151
-		if (method_exists(self::$cache, 'deleteMulti')) {
152
-			self::$cache->deleteMulti($keys);
153
-		} else {
154
-			foreach ($keys as $key) {
155
-				self::$cache->delete($key);
156
-			}
157
-		}
158
-		return true;
159
-	}
160
-
161
-	/**
162
-	 * Set a value in the cache if it's not already stored
163
-	 *
164
-	 * @param string $key
165
-	 * @param mixed $value
166
-	 * @param int $ttl Time To Live in seconds. Defaults to 60*60*24
167
-	 * @return bool
168
-	 * @throws \Exception
169
-	 */
170
-	public function add($key, $value, $ttl = 0) {
171
-		$result = self::$cache->add($this->getPrefix() . $key, $value, $ttl);
172
-		if (self::$cache->getResultCode() !== \Memcached::RES_NOTSTORED) {
173
-			$this->verifyReturnCode();
174
-		}
175
-		return $result;
176
-	}
177
-
178
-	/**
179
-	 * Increase a stored number
180
-	 *
181
-	 * @param string $key
182
-	 * @param int $step
183
-	 * @return int | bool
184
-	 */
185
-	public function inc($key, $step = 1) {
186
-		$this->add($key, 0);
187
-		$result = self::$cache->increment($this->getPrefix() . $key, $step);
188
-
189
-		if (self::$cache->getResultCode() !== \Memcached::RES_SUCCESS) {
190
-			return false;
191
-		}
192
-
193
-		return $result;
194
-	}
195
-
196
-	/**
197
-	 * Decrease a stored number
198
-	 *
199
-	 * @param string $key
200
-	 * @param int $step
201
-	 * @return int | bool
202
-	 */
203
-	public function dec($key, $step = 1) {
204
-		$result = self::$cache->decrement($this->getPrefix() . $key, $step);
205
-
206
-		if (self::$cache->getResultCode() !== \Memcached::RES_SUCCESS) {
207
-			return false;
208
-		}
209
-
210
-		return $result;
211
-	}
212
-
213
-	public static function isAvailable() {
214
-		return extension_loaded('memcached');
215
-	}
216
-
217
-	/**
218
-	 * @throws \Exception
219
-	 */
220
-	private function verifyReturnCode() {
221
-		$code = self::$cache->getResultCode();
222
-		if ($code === \Memcached::RES_SUCCESS) {
223
-			return;
224
-		}
225
-		$message = self::$cache->getResultMessage();
226
-		throw new \Exception("Error $code interacting with memcached : $message");
227
-	}
39
+    use CASTrait;
40
+
41
+    /**
42
+     * @var \Memcached $cache
43
+     */
44
+    private static $cache = null;
45
+
46
+    use CADTrait;
47
+
48
+    public function __construct($prefix = '') {
49
+        parent::__construct($prefix);
50
+        if (is_null(self::$cache)) {
51
+            self::$cache = new \Memcached();
52
+
53
+            $defaultOptions = [
54
+                \Memcached::OPT_CONNECT_TIMEOUT => 50,
55
+                \Memcached::OPT_RETRY_TIMEOUT =>   50,
56
+                \Memcached::OPT_SEND_TIMEOUT =>    50,
57
+                \Memcached::OPT_RECV_TIMEOUT =>    50,
58
+                \Memcached::OPT_POLL_TIMEOUT =>    50,
59
+
60
+                // Enable compression
61
+                \Memcached::OPT_COMPRESSION =>          true,
62
+
63
+                // Turn on consistent hashing
64
+                \Memcached::OPT_LIBKETAMA_COMPATIBLE => true,
65
+
66
+                // Enable Binary Protocol
67
+                //\Memcached::OPT_BINARY_PROTOCOL =>      true,
68
+            ];
69
+            // by default enable igbinary serializer if available
70
+            if (\Memcached::HAVE_IGBINARY) {
71
+                $defaultOptions[\Memcached::OPT_SERIALIZER] =
72
+                    \Memcached::SERIALIZER_IGBINARY;
73
+            }
74
+            $options = \OC::$server->getConfig()->getSystemValue('memcached_options', []);
75
+            if (is_array($options)) {
76
+                $options = $options + $defaultOptions;
77
+                self::$cache->setOptions($options);
78
+            } else {
79
+                throw new HintException("Expected 'memcached_options' config to be an array, got $options");
80
+            }
81
+
82
+            $servers = \OC::$server->getSystemConfig()->getValue('memcached_servers');
83
+            if (!$servers) {
84
+                $server = \OC::$server->getSystemConfig()->getValue('memcached_server');
85
+                if ($server) {
86
+                    $servers = [$server];
87
+                } else {
88
+                    $servers = [['localhost', 11211]];
89
+                }
90
+            }
91
+            self::$cache->addServers($servers);
92
+        }
93
+    }
94
+
95
+    /**
96
+     * entries in XCache gets namespaced to prevent collisions between owncloud instances and users
97
+     */
98
+    protected function getNameSpace() {
99
+        return $this->prefix;
100
+    }
101
+
102
+    public function get($key) {
103
+        $result = self::$cache->get($this->getNameSpace() . $key);
104
+        if ($result === false and self::$cache->getResultCode() == \Memcached::RES_NOTFOUND) {
105
+            return null;
106
+        } else {
107
+            return $result;
108
+        }
109
+    }
110
+
111
+    public function set($key, $value, $ttl = 0) {
112
+        if ($ttl > 0) {
113
+            $result =  self::$cache->set($this->getNameSpace() . $key, $value, $ttl);
114
+        } else {
115
+            $result = self::$cache->set($this->getNameSpace() . $key, $value);
116
+        }
117
+        if ($result !== true) {
118
+            $this->verifyReturnCode();
119
+        }
120
+        return $result;
121
+    }
122
+
123
+    public function hasKey($key) {
124
+        self::$cache->get($this->getNameSpace() . $key);
125
+        return self::$cache->getResultCode() === \Memcached::RES_SUCCESS;
126
+    }
127
+
128
+    public function remove($key) {
129
+        $result= self::$cache->delete($this->getNameSpace() . $key);
130
+        if (self::$cache->getResultCode() !== \Memcached::RES_NOTFOUND) {
131
+            $this->verifyReturnCode();
132
+        }
133
+        return $result;
134
+    }
135
+
136
+    public function clear($prefix = '') {
137
+        $prefix = $this->getNameSpace() . $prefix;
138
+        $allKeys = self::$cache->getAllKeys();
139
+        if ($allKeys === false) {
140
+            // newer Memcached doesn't like getAllKeys(), flush everything
141
+            self::$cache->flush();
142
+            return true;
143
+        }
144
+        $keys = [];
145
+        $prefixLength = strlen($prefix);
146
+        foreach ($allKeys as $key) {
147
+            if (substr($key, 0, $prefixLength) === $prefix) {
148
+                $keys[] = $key;
149
+            }
150
+        }
151
+        if (method_exists(self::$cache, 'deleteMulti')) {
152
+            self::$cache->deleteMulti($keys);
153
+        } else {
154
+            foreach ($keys as $key) {
155
+                self::$cache->delete($key);
156
+            }
157
+        }
158
+        return true;
159
+    }
160
+
161
+    /**
162
+     * Set a value in the cache if it's not already stored
163
+     *
164
+     * @param string $key
165
+     * @param mixed $value
166
+     * @param int $ttl Time To Live in seconds. Defaults to 60*60*24
167
+     * @return bool
168
+     * @throws \Exception
169
+     */
170
+    public function add($key, $value, $ttl = 0) {
171
+        $result = self::$cache->add($this->getPrefix() . $key, $value, $ttl);
172
+        if (self::$cache->getResultCode() !== \Memcached::RES_NOTSTORED) {
173
+            $this->verifyReturnCode();
174
+        }
175
+        return $result;
176
+    }
177
+
178
+    /**
179
+     * Increase a stored number
180
+     *
181
+     * @param string $key
182
+     * @param int $step
183
+     * @return int | bool
184
+     */
185
+    public function inc($key, $step = 1) {
186
+        $this->add($key, 0);
187
+        $result = self::$cache->increment($this->getPrefix() . $key, $step);
188
+
189
+        if (self::$cache->getResultCode() !== \Memcached::RES_SUCCESS) {
190
+            return false;
191
+        }
192
+
193
+        return $result;
194
+    }
195
+
196
+    /**
197
+     * Decrease a stored number
198
+     *
199
+     * @param string $key
200
+     * @param int $step
201
+     * @return int | bool
202
+     */
203
+    public function dec($key, $step = 1) {
204
+        $result = self::$cache->decrement($this->getPrefix() . $key, $step);
205
+
206
+        if (self::$cache->getResultCode() !== \Memcached::RES_SUCCESS) {
207
+            return false;
208
+        }
209
+
210
+        return $result;
211
+    }
212
+
213
+    public static function isAvailable() {
214
+        return extension_loaded('memcached');
215
+    }
216
+
217
+    /**
218
+     * @throws \Exception
219
+     */
220
+    private function verifyReturnCode() {
221
+        $code = self::$cache->getResultCode();
222
+        if ($code === \Memcached::RES_SUCCESS) {
223
+            return;
224
+        }
225
+        $message = self::$cache->getResultMessage();
226
+        throw new \Exception("Error $code interacting with memcached : $message");
227
+    }
228 228
 }
Please login to merge, or discard this patch.
lib/private/OCS/Exception.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -25,16 +25,16 @@
 block discarded – undo
25 25
 
26 26
 class Exception extends \Exception {
27 27
 
28
-	/** @var Result */
29
-	private $result;
28
+    /** @var Result */
29
+    private $result;
30 30
 
31
-	public function __construct(Result $result) {
32
-		parent::__construct();
33
-		$this->result = $result;
34
-	}
31
+    public function __construct(Result $result) {
32
+        parent::__construct();
33
+        $this->result = $result;
34
+    }
35 35
 
36
-	public function getResult() {
37
-		return $this->result;
38
-	}
36
+    public function getResult() {
37
+        return $this->result;
38
+    }
39 39
 
40 40
 }
Please login to merge, or discard this patch.
lib/private/BackgroundJob/TimedJob.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -32,26 +32,26 @@
 block discarded – undo
32 32
  * @package OC\BackgroundJob
33 33
  */
34 34
 abstract class TimedJob extends Job {
35
-	protected $interval = 0;
35
+    protected $interval = 0;
36 36
 
37
-	/**
38
-	 * set the interval for the job
39
-	 *
40
-	 * @param int $interval
41
-	 */
42
-	public function setInterval($interval) {
43
-		$this->interval = $interval;
44
-	}
37
+    /**
38
+     * set the interval for the job
39
+     *
40
+     * @param int $interval
41
+     */
42
+    public function setInterval($interval) {
43
+        $this->interval = $interval;
44
+    }
45 45
 
46
-	/**
47
-	 * run the job if
48
-	 *
49
-	 * @param JobList $jobList
50
-	 * @param ILogger|null $logger
51
-	 */
52
-	public function execute($jobList, ILogger $logger = null) {
53
-		if ((time() - $this->lastRun) > $this->interval) {
54
-			parent::execute($jobList, $logger);
55
-		}
56
-	}
46
+    /**
47
+     * run the job if
48
+     *
49
+     * @param JobList $jobList
50
+     * @param ILogger|null $logger
51
+     */
52
+    public function execute($jobList, ILogger $logger = null) {
53
+        if ((time() - $this->lastRun) > $this->interval) {
54
+            parent::execute($jobList, $logger);
55
+        }
56
+    }
57 57
 }
Please login to merge, or discard this patch.
lib/private/BackgroundJob/QueuedJob.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -32,14 +32,14 @@
 block discarded – undo
32 32
  * @package OC\BackgroundJob
33 33
  */
34 34
 abstract class QueuedJob extends Job {
35
-	/**
36
-	 * run the job, then remove it from the joblist
37
-	 *
38
-	 * @param JobList $jobList
39
-	 * @param ILogger|null $logger
40
-	 */
41
-	public function execute($jobList, ILogger $logger = null) {
42
-		$jobList->remove($this, $this->argument);
43
-		parent::execute($jobList, $logger);
44
-	}
35
+    /**
36
+     * run the job, then remove it from the joblist
37
+     *
38
+     * @param JobList $jobList
39
+     * @param ILogger|null $logger
40
+     */
41
+    public function execute($jobList, ILogger $logger = null) {
42
+        $jobList->remove($this, $this->argument);
43
+        parent::execute($jobList, $logger);
44
+    }
45 45
 }
Please login to merge, or discard this patch.
lib/public/IDateTimeFormatter.php 1 patch
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -30,114 +30,114 @@
 block discarded – undo
30 30
  * @since 8.0.0
31 31
  */
32 32
 interface IDateTimeFormatter {
33
-	/**
34
-	 * Formats the date of the given timestamp
35
-	 *
36
-	 * @param int|\DateTime		$timestamp
37
-	 * @param string	$format			Either 'full', 'long', 'medium' or 'short'
38
-	 * 				full:	e.g. 'EEEE, MMMM d, y'	=> 'Wednesday, August 20, 2014'
39
-	 * 				long:	e.g. 'MMMM d, y'		=> 'August 20, 2014'
40
-	 * 				medium:	e.g. 'MMM d, y'			=> 'Aug 20, 2014'
41
-	 * 				short:	e.g. 'M/d/yy'			=> '8/20/14'
42
-	 * 				The exact format is dependent on the language
43
-	 * @param \DateTimeZone|null	$timeZone	The timezone to use
44
-	 * @param \OCP\IL10N|null	$l			The locale to use
45
-	 * @return string Formatted date string
46
-	 * @since 8.0.0
47
-	 */
48
-	public function formatDate($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null);
33
+    /**
34
+     * Formats the date of the given timestamp
35
+     *
36
+     * @param int|\DateTime		$timestamp
37
+     * @param string	$format			Either 'full', 'long', 'medium' or 'short'
38
+     * 				full:	e.g. 'EEEE, MMMM d, y'	=> 'Wednesday, August 20, 2014'
39
+     * 				long:	e.g. 'MMMM d, y'		=> 'August 20, 2014'
40
+     * 				medium:	e.g. 'MMM d, y'			=> 'Aug 20, 2014'
41
+     * 				short:	e.g. 'M/d/yy'			=> '8/20/14'
42
+     * 				The exact format is dependent on the language
43
+     * @param \DateTimeZone|null	$timeZone	The timezone to use
44
+     * @param \OCP\IL10N|null	$l			The locale to use
45
+     * @return string Formatted date string
46
+     * @since 8.0.0
47
+     */
48
+    public function formatDate($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null);
49 49
 
50
-	/**
51
-	 * Formats the date of the given timestamp
52
-	 *
53
-	 * @param int|\DateTime		$timestamp
54
-	 * @param string	$format			Either 'full', 'long', 'medium' or 'short'
55
-	 * 				full:	e.g. 'EEEE, MMMM d, y'	=> 'Wednesday, August 20, 2014'
56
-	 * 				long:	e.g. 'MMMM d, y'		=> 'August 20, 2014'
57
-	 * 				medium:	e.g. 'MMM d, y'			=> 'Aug 20, 2014'
58
-	 * 				short:	e.g. 'M/d/yy'			=> '8/20/14'
59
-	 * 				The exact format is dependent on the language
60
-	 * 					Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable
61
-	 * @param \DateTimeZone|null	$timeZone	The timezone to use
62
-	 * @param \OCP\IL10N|null	$l			The locale to use
63
-	 * @return string Formatted relative date string
64
-	 * @since 8.0.0
65
-	 */
66
-	public function formatDateRelativeDay($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null);
50
+    /**
51
+     * Formats the date of the given timestamp
52
+     *
53
+     * @param int|\DateTime		$timestamp
54
+     * @param string	$format			Either 'full', 'long', 'medium' or 'short'
55
+     * 				full:	e.g. 'EEEE, MMMM d, y'	=> 'Wednesday, August 20, 2014'
56
+     * 				long:	e.g. 'MMMM d, y'		=> 'August 20, 2014'
57
+     * 				medium:	e.g. 'MMM d, y'			=> 'Aug 20, 2014'
58
+     * 				short:	e.g. 'M/d/yy'			=> '8/20/14'
59
+     * 				The exact format is dependent on the language
60
+     * 					Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable
61
+     * @param \DateTimeZone|null	$timeZone	The timezone to use
62
+     * @param \OCP\IL10N|null	$l			The locale to use
63
+     * @return string Formatted relative date string
64
+     * @since 8.0.0
65
+     */
66
+    public function formatDateRelativeDay($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null);
67 67
 
68
-	/**
69
-	 * Gives the relative date of the timestamp
70
-	 * Only works for past dates
71
-	 *
72
-	 * @param int|\DateTime	$timestamp
73
-	 * @param int|\DateTime|null	$baseTimestamp	Timestamp to compare $timestamp against, defaults to current time
74
-	 * @param \OCP\IL10N|null		$l			The locale to use
75
-	 * @return string	Dates returned are:
76
-	 * 				<  1 month	=> Today, Yesterday, n days ago
77
-	 * 				< 13 month	=> last month, n months ago
78
-	 * 				>= 13 month	=> last year, n years ago
79
-	 * @since 8.0.0
80
-	 */
81
-	public function formatDateSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null);
68
+    /**
69
+     * Gives the relative date of the timestamp
70
+     * Only works for past dates
71
+     *
72
+     * @param int|\DateTime	$timestamp
73
+     * @param int|\DateTime|null	$baseTimestamp	Timestamp to compare $timestamp against, defaults to current time
74
+     * @param \OCP\IL10N|null		$l			The locale to use
75
+     * @return string	Dates returned are:
76
+     * 				<  1 month	=> Today, Yesterday, n days ago
77
+     * 				< 13 month	=> last month, n months ago
78
+     * 				>= 13 month	=> last year, n years ago
79
+     * @since 8.0.0
80
+     */
81
+    public function formatDateSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null);
82 82
 
83
-	/**
84
-	 * Formats the time of the given timestamp
85
-	 *
86
-	 * @param int|\DateTime $timestamp
87
-	 * @param string	$format			Either 'full', 'long', 'medium' or 'short'
88
-	 * 				full:	e.g. 'h:mm:ss a zzzz'	=> '11:42:13 AM GMT+0:00'
89
-	 * 				long:	e.g. 'h:mm:ss a z'		=> '11:42:13 AM GMT'
90
-	 * 				medium:	e.g. 'h:mm:ss a'		=> '11:42:13 AM'
91
-	 * 				short:	e.g. 'h:mm a'			=> '11:42 AM'
92
-	 * 				The exact format is dependent on the language
93
-	 * @param \DateTimeZone|null	$timeZone	The timezone to use
94
-	 * @param \OCP\IL10N|null		$l			The locale to use
95
-	 * @return string Formatted time string
96
-	 * @since 8.0.0
97
-	 */
98
-	public function formatTime($timestamp, $format = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null);
83
+    /**
84
+     * Formats the time of the given timestamp
85
+     *
86
+     * @param int|\DateTime $timestamp
87
+     * @param string	$format			Either 'full', 'long', 'medium' or 'short'
88
+     * 				full:	e.g. 'h:mm:ss a zzzz'	=> '11:42:13 AM GMT+0:00'
89
+     * 				long:	e.g. 'h:mm:ss a z'		=> '11:42:13 AM GMT'
90
+     * 				medium:	e.g. 'h:mm:ss a'		=> '11:42:13 AM'
91
+     * 				short:	e.g. 'h:mm a'			=> '11:42 AM'
92
+     * 				The exact format is dependent on the language
93
+     * @param \DateTimeZone|null	$timeZone	The timezone to use
94
+     * @param \OCP\IL10N|null		$l			The locale to use
95
+     * @return string Formatted time string
96
+     * @since 8.0.0
97
+     */
98
+    public function formatTime($timestamp, $format = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null);
99 99
 
100
-	/**
101
-	 * Gives the relative past time of the timestamp
102
-	 *
103
-	 * @param int|\DateTime	$timestamp
104
-	 * @param int|\DateTime|null	$baseTimestamp	Timestamp to compare $timestamp against, defaults to current time
105
-	 * @param \OCP\IL10N|null		$l			The locale to use
106
-	 * @return string	Dates returned are:
107
-	 * 				< 60 sec	=> seconds ago
108
-	 * 				<  1 hour	=> n minutes ago
109
-	 * 				<  1 day	=> n hours ago
110
-	 * 				<  1 month	=> Yesterday, n days ago
111
-	 * 				< 13 month	=> last month, n months ago
112
-	 * 				>= 13 month	=> last year, n years ago
113
-	 * @since 8.0.0
114
-	 */
115
-	public function formatTimeSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null);
100
+    /**
101
+     * Gives the relative past time of the timestamp
102
+     *
103
+     * @param int|\DateTime	$timestamp
104
+     * @param int|\DateTime|null	$baseTimestamp	Timestamp to compare $timestamp against, defaults to current time
105
+     * @param \OCP\IL10N|null		$l			The locale to use
106
+     * @return string	Dates returned are:
107
+     * 				< 60 sec	=> seconds ago
108
+     * 				<  1 hour	=> n minutes ago
109
+     * 				<  1 day	=> n hours ago
110
+     * 				<  1 month	=> Yesterday, n days ago
111
+     * 				< 13 month	=> last month, n months ago
112
+     * 				>= 13 month	=> last year, n years ago
113
+     * @since 8.0.0
114
+     */
115
+    public function formatTimeSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null);
116 116
 
117
-	/**
118
-	 * Formats the date and time of the given timestamp
119
-	 *
120
-	 * @param int|\DateTime $timestamp
121
-	 * @param string	$formatDate		See formatDate() for description
122
-	 * @param string	$formatTime		See formatTime() for description
123
-	 * @param \DateTimeZone|null	$timeZone	The timezone to use
124
-	 * @param \OCP\IL10N|null		$l			The locale to use
125
-	 * @return string Formatted date and time string
126
-	 * @since 8.0.0
127
-	 */
128
-	public function formatDateTime($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null);
117
+    /**
118
+     * Formats the date and time of the given timestamp
119
+     *
120
+     * @param int|\DateTime $timestamp
121
+     * @param string	$formatDate		See formatDate() for description
122
+     * @param string	$formatTime		See formatTime() for description
123
+     * @param \DateTimeZone|null	$timeZone	The timezone to use
124
+     * @param \OCP\IL10N|null		$l			The locale to use
125
+     * @return string Formatted date and time string
126
+     * @since 8.0.0
127
+     */
128
+    public function formatDateTime($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null);
129 129
 
130
-	/**
131
-	 * Formats the date and time of the given timestamp
132
-	 *
133
-	 * @param int|\DateTime $timestamp
134
-	 * @param string	$formatDate		See formatDate() for description
135
-	 * 					Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable
136
-	 * @param string	$formatTime		See formatTime() for description
137
-	 * @param \DateTimeZone|null	$timeZone	The timezone to use
138
-	 * @param \OCP\IL10N|null		$l			The locale to use
139
-	 * @return string Formatted relative date and time string
140
-	 * @since 8.0.0
141
-	 */
142
-	public function formatDateTimeRelativeDay($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null);
130
+    /**
131
+     * Formats the date and time of the given timestamp
132
+     *
133
+     * @param int|\DateTime $timestamp
134
+     * @param string	$formatDate		See formatDate() for description
135
+     * 					Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable
136
+     * @param string	$formatTime		See formatTime() for description
137
+     * @param \DateTimeZone|null	$timeZone	The timezone to use
138
+     * @param \OCP\IL10N|null		$l			The locale to use
139
+     * @return string Formatted relative date and time string
140
+     * @since 8.0.0
141
+     */
142
+    public function formatDateTimeRelativeDay($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null);
143 143
 }
Please login to merge, or discard this patch.
lib/public/Share/Exceptions/GenericShareException.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -31,18 +31,18 @@
 block discarded – undo
31 31
  */
32 32
 class GenericShareException extends HintException {
33 33
 
34
-	/**
35
-	 * @param string $message
36
-	 * @param string $hint
37
-	 * @param int $code
38
-	 * @param \Exception|null $previous
39
-	 * @since 9.0.0
40
-	 */
41
-	public function __construct($message = '', $hint = '', $code = 0, \Exception $previous = null) {
42
-		if (empty($message)) {
43
-			$message = 'There was an error retrieving the share. Maybe the link is wrong, it was unshared, or it was deleted.';
44
-		}
45
-		parent::__construct($message, $hint, $code, $previous);
46
-	}
34
+    /**
35
+     * @param string $message
36
+     * @param string $hint
37
+     * @param int $code
38
+     * @param \Exception|null $previous
39
+     * @since 9.0.0
40
+     */
41
+    public function __construct($message = '', $hint = '', $code = 0, \Exception $previous = null) {
42
+        if (empty($message)) {
43
+            $message = 'There was an error retrieving the share. Maybe the link is wrong, it was unshared, or it was deleted.';
44
+        }
45
+        parent::__construct($message, $hint, $code, $previous);
46
+    }
47 47
 
48 48
 }
Please login to merge, or discard this patch.