Completed
Push — stable10 ( b85e94...1e5021 )
by
unknown
23:18 queued 12:32
created
lib/private/Memcache/CASTrait.php 2 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -23,35 +23,35 @@
 block discarded – undo
23 23
 namespace OC\Memcache;
24 24
 
25 25
 trait CASTrait {
26
-	abstract public function get($key);
26
+    abstract public function get($key);
27 27
 
28
-	abstract public function set($key, $value, $ttl = 0);
28
+    abstract public function set($key, $value, $ttl = 0);
29 29
 
30
-	abstract public function remove($key);
30
+    abstract public function remove($key);
31 31
 
32
-	abstract public function add($key, $value, $ttl = 0);
32
+    abstract public function add($key, $value, $ttl = 0);
33 33
 
34
-	/**
35
-	 * Compare and set
36
-	 *
37
-	 * @param string $key
38
-	 * @param mixed $old
39
-	 * @param mixed $new
40
-	 * @return bool
41
-	 */
42
-	public function cas($key, $old, $new) {
43
-		//no native cas, emulate with locking
44
-		if ($this->add($key . '_lock', true)) {
45
-			if ($this->get($key) === $old) {
46
-				$this->set($key, $new);
47
-				$this->remove($key . '_lock');
48
-				return true;
49
-			} else {
50
-				$this->remove($key . '_lock');
51
-				return false;
52
-			}
53
-		} else {
54
-			return false;
55
-		}
56
-	}
34
+    /**
35
+     * Compare and set
36
+     *
37
+     * @param string $key
38
+     * @param mixed $old
39
+     * @param mixed $new
40
+     * @return bool
41
+     */
42
+    public function cas($key, $old, $new) {
43
+        //no native cas, emulate with locking
44
+        if ($this->add($key . '_lock', true)) {
45
+            if ($this->get($key) === $old) {
46
+                $this->set($key, $new);
47
+                $this->remove($key . '_lock');
48
+                return true;
49
+            } else {
50
+                $this->remove($key . '_lock');
51
+                return false;
52
+            }
53
+        } else {
54
+            return false;
55
+        }
56
+    }
57 57
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,13 +41,13 @@
 block discarded – undo
41 41
 	 */
42 42
 	public function cas($key, $old, $new) {
43 43
 		//no native cas, emulate with locking
44
-		if ($this->add($key . '_lock', true)) {
44
+		if ($this->add($key.'_lock', true)) {
45 45
 			if ($this->get($key) === $old) {
46 46
 				$this->set($key, $new);
47
-				$this->remove($key . '_lock');
47
+				$this->remove($key.'_lock');
48 48
 				return true;
49 49
 			} else {
50
-				$this->remove($key . '_lock');
50
+				$this->remove($key.'_lock');
51 51
 				return false;
52 52
 			}
53 53
 		} else {
Please login to merge, or discard this patch.
lib/private/Memcache/Cache.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -26,72 +26,72 @@
 block discarded – undo
26 26
 namespace OC\Memcache;
27 27
 
28 28
 abstract class Cache implements \ArrayAccess, \OCP\ICache {
29
-	/**
30
-	 * @var string $prefix
31
-	 */
32
-	protected $prefix;
29
+    /**
30
+     * @var string $prefix
31
+     */
32
+    protected $prefix;
33 33
 
34
-	/**
35
-	 * @param string $prefix
36
-	 */
37
-	public function __construct($prefix = '') {
38
-		$this->prefix = $prefix;
39
-	}
34
+    /**
35
+     * @param string $prefix
36
+     */
37
+    public function __construct($prefix = '') {
38
+        $this->prefix = $prefix;
39
+    }
40 40
 
41
-	/**
42
-	 * @return string Prefix used for caching purposes
43
-	 */
44
-	public function getPrefix() {
45
-		return $this->prefix;
46
-	}
41
+    /**
42
+     * @return string Prefix used for caching purposes
43
+     */
44
+    public function getPrefix() {
45
+        return $this->prefix;
46
+    }
47 47
 
48
-	/**
49
-	 * @param string $key
50
-	 * @return mixed
51
-	 */
52
-	abstract public function get($key);
48
+    /**
49
+     * @param string $key
50
+     * @return mixed
51
+     */
52
+    abstract public function get($key);
53 53
 
54
-	/**
55
-	 * @param string $key
56
-	 * @param mixed $value
57
-	 * @param int $ttl
58
-	 * @return mixed
59
-	 */
60
-	abstract public function set($key, $value, $ttl = 0);
54
+    /**
55
+     * @param string $key
56
+     * @param mixed $value
57
+     * @param int $ttl
58
+     * @return mixed
59
+     */
60
+    abstract public function set($key, $value, $ttl = 0);
61 61
 
62
-	/**
63
-	 * @param string $key
64
-	 * @return mixed
65
-	 */
66
-	abstract public function hasKey($key);
62
+    /**
63
+     * @param string $key
64
+     * @return mixed
65
+     */
66
+    abstract public function hasKey($key);
67 67
 
68
-	/**
69
-	 * @param string $key
70
-	 * @return mixed
71
-	 */
72
-	abstract public function remove($key);
68
+    /**
69
+     * @param string $key
70
+     * @return mixed
71
+     */
72
+    abstract public function remove($key);
73 73
 
74
-	/**
75
-	 * @param string $prefix
76
-	 * @return mixed
77
-	 */
78
-	abstract public function clear($prefix = '');
74
+    /**
75
+     * @param string $prefix
76
+     * @return mixed
77
+     */
78
+    abstract public function clear($prefix = '');
79 79
 
80
-	//implement the ArrayAccess interface
80
+    //implement the ArrayAccess interface
81 81
 
82
-	public function offsetExists($offset) {
83
-		return $this->hasKey($offset);
84
-	}
82
+    public function offsetExists($offset) {
83
+        return $this->hasKey($offset);
84
+    }
85 85
 
86
-	public function offsetSet($offset, $value) {
87
-		$this->set($offset, $value);
88
-	}
86
+    public function offsetSet($offset, $value) {
87
+        $this->set($offset, $value);
88
+    }
89 89
 
90
-	public function offsetGet($offset) {
91
-		return $this->get($offset);
92
-	}
90
+    public function offsetGet($offset) {
91
+        return $this->get($offset);
92
+    }
93 93
 
94
-	public function offsetUnset($offset) {
95
-		$this->remove($offset);
96
-	}
94
+    public function offsetUnset($offset) {
95
+        $this->remove($offset);
96
+    }
97 97
 }
Please login to merge, or discard this patch.
lib/private/Memcache/CADTrait.php 2 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -23,32 +23,32 @@
 block discarded – undo
23 23
 namespace OC\Memcache;
24 24
 
25 25
 trait CADTrait {
26
-	abstract public function get($key);
26
+    abstract public function get($key);
27 27
 
28
-	abstract public function remove($key);
28
+    abstract public function remove($key);
29 29
 
30
-	abstract public function add($key, $value, $ttl = 0);
30
+    abstract public function add($key, $value, $ttl = 0);
31 31
 
32
-	/**
33
-	 * Compare and delete
34
-	 *
35
-	 * @param string $key
36
-	 * @param mixed $old
37
-	 * @return bool
38
-	 */
39
-	public function cad($key, $old) {
40
-		//no native cas, emulate with locking
41
-		if ($this->add($key . '_lock', true)) {
42
-			if ($this->get($key) === $old) {
43
-				$this->remove($key);
44
-				$this->remove($key . '_lock');
45
-				return true;
46
-			} else {
47
-				$this->remove($key . '_lock');
48
-				return false;
49
-			}
50
-		} else {
51
-			return false;
52
-		}
53
-	}
32
+    /**
33
+     * Compare and delete
34
+     *
35
+     * @param string $key
36
+     * @param mixed $old
37
+     * @return bool
38
+     */
39
+    public function cad($key, $old) {
40
+        //no native cas, emulate with locking
41
+        if ($this->add($key . '_lock', true)) {
42
+            if ($this->get($key) === $old) {
43
+                $this->remove($key);
44
+                $this->remove($key . '_lock');
45
+                return true;
46
+            } else {
47
+                $this->remove($key . '_lock');
48
+                return false;
49
+            }
50
+        } else {
51
+            return false;
52
+        }
53
+    }
54 54
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,13 +38,13 @@
 block discarded – undo
38 38
 	 */
39 39
 	public function cad($key, $old) {
40 40
 		//no native cas, emulate with locking
41
-		if ($this->add($key . '_lock', true)) {
41
+		if ($this->add($key.'_lock', true)) {
42 42
 			if ($this->get($key) === $old) {
43 43
 				$this->remove($key);
44
-				$this->remove($key . '_lock');
44
+				$this->remove($key.'_lock');
45 45
 				return true;
46 46
 			} else {
47
-				$this->remove($key . '_lock');
47
+				$this->remove($key.'_lock');
48 48
 				return false;
49 49
 			}
50 50
 		} else {
Please login to merge, or discard this patch.
lib/private/Memcache/NullCache.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -27,47 +27,47 @@
 block discarded – undo
27 27
 namespace OC\Memcache;
28 28
 
29 29
 class NullCache extends Cache implements \OCP\IMemcache {
30
-	public function get($key) {
31
-		return null;
32
-	}
30
+    public function get($key) {
31
+        return null;
32
+    }
33 33
 
34
-	public function set($key, $value, $ttl = 0) {
35
-		return true;
36
-	}
34
+    public function set($key, $value, $ttl = 0) {
35
+        return true;
36
+    }
37 37
 
38
-	public function hasKey($key) {
39
-		return false;
40
-	}
38
+    public function hasKey($key) {
39
+        return false;
40
+    }
41 41
 
42
-	public function remove($key) {
43
-		return true;
44
-	}
42
+    public function remove($key) {
43
+        return true;
44
+    }
45 45
 
46
-	public function add($key, $value, $ttl = 0) {
47
-		return true;
48
-	}
46
+    public function add($key, $value, $ttl = 0) {
47
+        return true;
48
+    }
49 49
 
50
-	public function inc($key, $step = 1) {
51
-		return true;
52
-	}
50
+    public function inc($key, $step = 1) {
51
+        return true;
52
+    }
53 53
 
54
-	public function dec($key, $step = 1) {
55
-		return true;
56
-	}
54
+    public function dec($key, $step = 1) {
55
+        return true;
56
+    }
57 57
 
58
-	public function cas($key, $old, $new) {
59
-		return true;
60
-	}
58
+    public function cas($key, $old, $new) {
59
+        return true;
60
+    }
61 61
 
62
-	public function cad($key, $old) {
63
-		return true;
64
-	}
62
+    public function cad($key, $old) {
63
+        return true;
64
+    }
65 65
 
66
-	public function clear($prefix = '') {
67
-		return true;
68
-	}
66
+    public function clear($prefix = '') {
67
+        return true;
68
+    }
69 69
 
70
-	static public function isAvailable() {
71
-		return true;
72
-	}
70
+    static public function isAvailable() {
71
+        return true;
72
+    }
73 73
 }
Please login to merge, or discard this patch.
lib/private/Memcache/XCache.php 2 patches
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -35,102 +35,102 @@
 block discarded – undo
35 35
  * functions etc.
36 36
  */
37 37
 class XCache extends Cache implements IMemcache {
38
-	use CASTrait;
38
+    use CASTrait;
39 39
 
40
-	use CADTrait;
40
+    use CADTrait;
41 41
 
42
-	/**
43
-	 * entries in XCache gets namespaced to prevent collisions between ownCloud instances and users
44
-	 */
45
-	protected function getNameSpace() {
46
-		return $this->prefix;
47
-	}
42
+    /**
43
+     * entries in XCache gets namespaced to prevent collisions between ownCloud instances and users
44
+     */
45
+    protected function getNameSpace() {
46
+        return $this->prefix;
47
+    }
48 48
 
49
-	public function get($key) {
50
-		return xcache_get($this->getNamespace() . $key);
51
-	}
49
+    public function get($key) {
50
+        return xcache_get($this->getNamespace() . $key);
51
+    }
52 52
 
53
-	public function set($key, $value, $ttl = 0) {
54
-		if ($ttl > 0) {
55
-			return xcache_set($this->getNamespace() . $key, $value, $ttl);
56
-		} else {
57
-			return xcache_set($this->getNamespace() . $key, $value);
58
-		}
59
-	}
53
+    public function set($key, $value, $ttl = 0) {
54
+        if ($ttl > 0) {
55
+            return xcache_set($this->getNamespace() . $key, $value, $ttl);
56
+        } else {
57
+            return xcache_set($this->getNamespace() . $key, $value);
58
+        }
59
+    }
60 60
 
61
-	public function hasKey($key) {
62
-		return xcache_isset($this->getNamespace() . $key);
63
-	}
61
+    public function hasKey($key) {
62
+        return xcache_isset($this->getNamespace() . $key);
63
+    }
64 64
 
65
-	public function remove($key) {
66
-		return xcache_unset($this->getNamespace() . $key);
67
-	}
65
+    public function remove($key) {
66
+        return xcache_unset($this->getNamespace() . $key);
67
+    }
68 68
 
69
-	public function clear($prefix = '') {
70
-		if (function_exists('xcache_unset_by_prefix')) {
71
-			return xcache_unset_by_prefix($this->getNamespace() . $prefix);
72
-		} else {
73
-			// Since we can not clear by prefix, we just clear the whole cache.
74
-			xcache_clear_cache(\XC_TYPE_VAR, 0);
75
-		}
76
-		return true;
77
-	}
69
+    public function clear($prefix = '') {
70
+        if (function_exists('xcache_unset_by_prefix')) {
71
+            return xcache_unset_by_prefix($this->getNamespace() . $prefix);
72
+        } else {
73
+            // Since we can not clear by prefix, we just clear the whole cache.
74
+            xcache_clear_cache(\XC_TYPE_VAR, 0);
75
+        }
76
+        return true;
77
+    }
78 78
 
79
-	/**
80
-	 * Set a value in the cache if it's not already stored
81
-	 *
82
-	 * @param string $key
83
-	 * @param mixed $value
84
-	 * @param int $ttl Time To Live in seconds. Defaults to 60*60*24
85
-	 * @return bool
86
-	 */
87
-	public function add($key, $value, $ttl = 0) {
88
-		if ($this->hasKey($key)) {
89
-			return false;
90
-		} else {
91
-			return $this->set($key, $value, $ttl);
92
-		}
93
-	}
79
+    /**
80
+     * Set a value in the cache if it's not already stored
81
+     *
82
+     * @param string $key
83
+     * @param mixed $value
84
+     * @param int $ttl Time To Live in seconds. Defaults to 60*60*24
85
+     * @return bool
86
+     */
87
+    public function add($key, $value, $ttl = 0) {
88
+        if ($this->hasKey($key)) {
89
+            return false;
90
+        } else {
91
+            return $this->set($key, $value, $ttl);
92
+        }
93
+    }
94 94
 
95
-	/**
96
-	 * Increase a stored number
97
-	 *
98
-	 * @param string $key
99
-	 * @param int $step
100
-	 * @return int | bool
101
-	 */
102
-	public function inc($key, $step = 1) {
103
-		return xcache_inc($this->getPrefix() . $key, $step);
104
-	}
95
+    /**
96
+     * Increase a stored number
97
+     *
98
+     * @param string $key
99
+     * @param int $step
100
+     * @return int | bool
101
+     */
102
+    public function inc($key, $step = 1) {
103
+        return xcache_inc($this->getPrefix() . $key, $step);
104
+    }
105 105
 
106
-	/**
107
-	 * Decrease a stored number
108
-	 *
109
-	 * @param string $key
110
-	 * @param int $step
111
-	 * @return int | bool
112
-	 */
113
-	public function dec($key, $step = 1) {
114
-		return xcache_dec($this->getPrefix() . $key, $step);
115
-	}
106
+    /**
107
+     * Decrease a stored number
108
+     *
109
+     * @param string $key
110
+     * @param int $step
111
+     * @return int | bool
112
+     */
113
+    public function dec($key, $step = 1) {
114
+        return xcache_dec($this->getPrefix() . $key, $step);
115
+    }
116 116
 
117
-	static public function isAvailable() {
118
-		if (!extension_loaded('xcache')) {
119
-			return false;
120
-		}
121
-		if (\OC::$CLI && !getenv('XCACHE_TEST')) {
122
-			return false;
123
-		}
124
-		if (!function_exists('xcache_unset_by_prefix') && \OC::$server->getIniWrapper()->getBool('xcache.admin.enable_auth')) {
125
-			// We do not want to use XCache if we can not clear it without
126
-			// using the administration function xcache_clear_cache()
127
-			// AND administration functions are password-protected.
128
-			return false;
129
-		}
130
-		$var_size = \OC::$server->getIniWrapper()->getBytes('xcache.var_size');
131
-		if (!$var_size) {
132
-			return false;
133
-		}
134
-		return true;
135
-	}
117
+    static public function isAvailable() {
118
+        if (!extension_loaded('xcache')) {
119
+            return false;
120
+        }
121
+        if (\OC::$CLI && !getenv('XCACHE_TEST')) {
122
+            return false;
123
+        }
124
+        if (!function_exists('xcache_unset_by_prefix') && \OC::$server->getIniWrapper()->getBool('xcache.admin.enable_auth')) {
125
+            // We do not want to use XCache if we can not clear it without
126
+            // using the administration function xcache_clear_cache()
127
+            // AND administration functions are password-protected.
128
+            return false;
129
+        }
130
+        $var_size = \OC::$server->getIniWrapper()->getBytes('xcache.var_size');
131
+        if (!$var_size) {
132
+            return false;
133
+        }
134
+        return true;
135
+    }
136 136
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -47,28 +47,28 @@  discard block
 block discarded – undo
47 47
 	}
48 48
 
49 49
 	public function get($key) {
50
-		return xcache_get($this->getNamespace() . $key);
50
+		return xcache_get($this->getNamespace().$key);
51 51
 	}
52 52
 
53 53
 	public function set($key, $value, $ttl = 0) {
54 54
 		if ($ttl > 0) {
55
-			return xcache_set($this->getNamespace() . $key, $value, $ttl);
55
+			return xcache_set($this->getNamespace().$key, $value, $ttl);
56 56
 		} else {
57
-			return xcache_set($this->getNamespace() . $key, $value);
57
+			return xcache_set($this->getNamespace().$key, $value);
58 58
 		}
59 59
 	}
60 60
 
61 61
 	public function hasKey($key) {
62
-		return xcache_isset($this->getNamespace() . $key);
62
+		return xcache_isset($this->getNamespace().$key);
63 63
 	}
64 64
 
65 65
 	public function remove($key) {
66
-		return xcache_unset($this->getNamespace() . $key);
66
+		return xcache_unset($this->getNamespace().$key);
67 67
 	}
68 68
 
69 69
 	public function clear($prefix = '') {
70 70
 		if (function_exists('xcache_unset_by_prefix')) {
71
-			return xcache_unset_by_prefix($this->getNamespace() . $prefix);
71
+			return xcache_unset_by_prefix($this->getNamespace().$prefix);
72 72
 		} else {
73 73
 			// Since we can not clear by prefix, we just clear the whole cache.
74 74
 			xcache_clear_cache(\XC_TYPE_VAR, 0);
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 * @return int | bool
101 101
 	 */
102 102
 	public function inc($key, $step = 1) {
103
-		return xcache_inc($this->getPrefix() . $key, $step);
103
+		return xcache_inc($this->getPrefix().$key, $step);
104 104
 	}
105 105
 
106 106
 	/**
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * @return int | bool
112 112
 	 */
113 113
 	public function dec($key, $step = 1) {
114
-		return xcache_dec($this->getPrefix() . $key, $step);
114
+		return xcache_dec($this->getPrefix().$key, $step);
115 115
 	}
116 116
 
117 117
 	static public function isAvailable() {
Please login to merge, or discard this patch.
lib/private/Memcache/Redis.php 2 patches
Indentation   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -29,153 +29,153 @@
 block discarded – undo
29 29
 use OCP\IMemcacheTTL;
30 30
 
31 31
 class Redis extends Cache implements IMemcacheTTL {
32
-	/**
33
-	 * @var \Redis $cache
34
-	 */
35
-	private static $cache = null;
36
-
37
-	public function __construct($prefix = '') {
38
-		parent::__construct($prefix);
39
-		if (is_null(self::$cache)) {
40
-			self::$cache = \OC::$server->getGetRedisFactory()->getInstance();
41
-		}
42
-	}
43
-
44
-	/**
45
-	 * entries in redis get namespaced to prevent collisions between ownCloud instances and users
46
-	 */
47
-	protected function getNameSpace() {
48
-		return $this->prefix;
49
-	}
50
-
51
-	public function get($key) {
52
-		$result = self::$cache->get($this->getNamespace() . $key);
53
-		if ($result === false && !self::$cache->exists($this->getNamespace() . $key)) {
54
-			return null;
55
-		} else {
56
-			return json_decode($result, true);
57
-		}
58
-	}
59
-
60
-	public function set($key, $value, $ttl = 0) {
61
-		if ($ttl > 0) {
62
-			return self::$cache->setex($this->getNamespace() . $key, $ttl, json_encode($value));
63
-		} else {
64
-			return self::$cache->set($this->getNamespace() . $key, json_encode($value));
65
-		}
66
-	}
67
-
68
-	public function hasKey($key) {
69
-		return self::$cache->exists($this->getNamespace() . $key);
70
-	}
71
-
72
-	public function remove($key) {
73
-		if (self::$cache->delete($this->getNamespace() . $key)) {
74
-			return true;
75
-		} else {
76
-			return false;
77
-		}
78
-	}
79
-
80
-	public function clear($prefix = '') {
81
-		$prefix = $this->getNamespace() . $prefix . '*';
82
-		$it = null;
83
-		self::$cache->setOption(\Redis::OPT_SCAN, \Redis::SCAN_RETRY);
84
-		while ($keys = self::$cache->scan($it, $prefix)) {
85
-			self::$cache->delete($keys);
86
-		}
87
-		return true;
88
-	}
89
-
90
-	/**
91
-	 * Set a value in the cache if it's not already stored
92
-	 *
93
-	 * @param string $key
94
-	 * @param mixed $value
95
-	 * @param int $ttl Time To Live in seconds. Defaults to 60*60*24
96
-	 * @return bool
97
-	 */
98
-	public function add($key, $value, $ttl = 0) {
99
-		// don't encode ints for inc/dec
100
-		if (!is_int($value)) {
101
-			$value = json_encode($value);
102
-		}
103
-		return self::$cache->setnx($this->getPrefix() . $key, $value);
104
-	}
105
-
106
-	/**
107
-	 * Increase a stored number
108
-	 *
109
-	 * @param string $key
110
-	 * @param int $step
111
-	 * @return int | bool
112
-	 */
113
-	public function inc($key, $step = 1) {
114
-		return self::$cache->incrBy($this->getNamespace() . $key, $step);
115
-	}
116
-
117
-	/**
118
-	 * Decrease a stored number
119
-	 *
120
-	 * @param string $key
121
-	 * @param int $step
122
-	 * @return int | bool
123
-	 */
124
-	public function dec($key, $step = 1) {
125
-		if (!$this->hasKey($key)) {
126
-			return false;
127
-		}
128
-		return self::$cache->decrBy($this->getNamespace() . $key, $step);
129
-	}
130
-
131
-	/**
132
-	 * Compare and set
133
-	 *
134
-	 * @param string $key
135
-	 * @param mixed $old
136
-	 * @param mixed $new
137
-	 * @return bool
138
-	 */
139
-	public function cas($key, $old, $new) {
140
-		if (!is_int($new)) {
141
-			$new = json_encode($new);
142
-		}
143
-		self::$cache->watch($this->getNamespace() . $key);
144
-		if ($this->get($key) === $old) {
145
-			$result = self::$cache->multi()
146
-				->set($this->getNamespace() . $key, $new)
147
-				->exec();
148
-			return ($result === false) ? false : true;
149
-		}
150
-		self::$cache->unwatch();
151
-		return false;
152
-	}
153
-
154
-	/**
155
-	 * Compare and delete
156
-	 *
157
-	 * @param string $key
158
-	 * @param mixed $old
159
-	 * @return bool
160
-	 */
161
-	public function cad($key, $old) {
162
-		self::$cache->watch($this->getNamespace() . $key);
163
-		if ($this->get($key) === $old) {
164
-			$result = self::$cache->multi()
165
-				->del($this->getNamespace() . $key)
166
-				->exec();
167
-			return ($result === false) ? false : true;
168
-		}
169
-		self::$cache->unwatch();
170
-		return false;
171
-	}
172
-
173
-	public function setTTL($key, $ttl) {
174
-		self::$cache->expire($this->getNamespace() . $key, $ttl);
175
-	}
176
-
177
-	static public function isAvailable() {
178
-		return \OC::$server->getGetRedisFactory()->isAvailable();
179
-	}
32
+    /**
33
+     * @var \Redis $cache
34
+     */
35
+    private static $cache = null;
36
+
37
+    public function __construct($prefix = '') {
38
+        parent::__construct($prefix);
39
+        if (is_null(self::$cache)) {
40
+            self::$cache = \OC::$server->getGetRedisFactory()->getInstance();
41
+        }
42
+    }
43
+
44
+    /**
45
+     * entries in redis get namespaced to prevent collisions between ownCloud instances and users
46
+     */
47
+    protected function getNameSpace() {
48
+        return $this->prefix;
49
+    }
50
+
51
+    public function get($key) {
52
+        $result = self::$cache->get($this->getNamespace() . $key);
53
+        if ($result === false && !self::$cache->exists($this->getNamespace() . $key)) {
54
+            return null;
55
+        } else {
56
+            return json_decode($result, true);
57
+        }
58
+    }
59
+
60
+    public function set($key, $value, $ttl = 0) {
61
+        if ($ttl > 0) {
62
+            return self::$cache->setex($this->getNamespace() . $key, $ttl, json_encode($value));
63
+        } else {
64
+            return self::$cache->set($this->getNamespace() . $key, json_encode($value));
65
+        }
66
+    }
67
+
68
+    public function hasKey($key) {
69
+        return self::$cache->exists($this->getNamespace() . $key);
70
+    }
71
+
72
+    public function remove($key) {
73
+        if (self::$cache->delete($this->getNamespace() . $key)) {
74
+            return true;
75
+        } else {
76
+            return false;
77
+        }
78
+    }
79
+
80
+    public function clear($prefix = '') {
81
+        $prefix = $this->getNamespace() . $prefix . '*';
82
+        $it = null;
83
+        self::$cache->setOption(\Redis::OPT_SCAN, \Redis::SCAN_RETRY);
84
+        while ($keys = self::$cache->scan($it, $prefix)) {
85
+            self::$cache->delete($keys);
86
+        }
87
+        return true;
88
+    }
89
+
90
+    /**
91
+     * Set a value in the cache if it's not already stored
92
+     *
93
+     * @param string $key
94
+     * @param mixed $value
95
+     * @param int $ttl Time To Live in seconds. Defaults to 60*60*24
96
+     * @return bool
97
+     */
98
+    public function add($key, $value, $ttl = 0) {
99
+        // don't encode ints for inc/dec
100
+        if (!is_int($value)) {
101
+            $value = json_encode($value);
102
+        }
103
+        return self::$cache->setnx($this->getPrefix() . $key, $value);
104
+    }
105
+
106
+    /**
107
+     * Increase a stored number
108
+     *
109
+     * @param string $key
110
+     * @param int $step
111
+     * @return int | bool
112
+     */
113
+    public function inc($key, $step = 1) {
114
+        return self::$cache->incrBy($this->getNamespace() . $key, $step);
115
+    }
116
+
117
+    /**
118
+     * Decrease a stored number
119
+     *
120
+     * @param string $key
121
+     * @param int $step
122
+     * @return int | bool
123
+     */
124
+    public function dec($key, $step = 1) {
125
+        if (!$this->hasKey($key)) {
126
+            return false;
127
+        }
128
+        return self::$cache->decrBy($this->getNamespace() . $key, $step);
129
+    }
130
+
131
+    /**
132
+     * Compare and set
133
+     *
134
+     * @param string $key
135
+     * @param mixed $old
136
+     * @param mixed $new
137
+     * @return bool
138
+     */
139
+    public function cas($key, $old, $new) {
140
+        if (!is_int($new)) {
141
+            $new = json_encode($new);
142
+        }
143
+        self::$cache->watch($this->getNamespace() . $key);
144
+        if ($this->get($key) === $old) {
145
+            $result = self::$cache->multi()
146
+                ->set($this->getNamespace() . $key, $new)
147
+                ->exec();
148
+            return ($result === false) ? false : true;
149
+        }
150
+        self::$cache->unwatch();
151
+        return false;
152
+    }
153
+
154
+    /**
155
+     * Compare and delete
156
+     *
157
+     * @param string $key
158
+     * @param mixed $old
159
+     * @return bool
160
+     */
161
+    public function cad($key, $old) {
162
+        self::$cache->watch($this->getNamespace() . $key);
163
+        if ($this->get($key) === $old) {
164
+            $result = self::$cache->multi()
165
+                ->del($this->getNamespace() . $key)
166
+                ->exec();
167
+            return ($result === false) ? false : true;
168
+        }
169
+        self::$cache->unwatch();
170
+        return false;
171
+    }
172
+
173
+    public function setTTL($key, $ttl) {
174
+        self::$cache->expire($this->getNamespace() . $key, $ttl);
175
+    }
176
+
177
+    static public function isAvailable() {
178
+        return \OC::$server->getGetRedisFactory()->isAvailable();
179
+    }
180 180
 }
181 181
 
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 	}
50 50
 
51 51
 	public function get($key) {
52
-		$result = self::$cache->get($this->getNamespace() . $key);
53
-		if ($result === false && !self::$cache->exists($this->getNamespace() . $key)) {
52
+		$result = self::$cache->get($this->getNamespace().$key);
53
+		if ($result === false && !self::$cache->exists($this->getNamespace().$key)) {
54 54
 			return null;
55 55
 		} else {
56 56
 			return json_decode($result, true);
@@ -59,18 +59,18 @@  discard block
 block discarded – undo
59 59
 
60 60
 	public function set($key, $value, $ttl = 0) {
61 61
 		if ($ttl > 0) {
62
-			return self::$cache->setex($this->getNamespace() . $key, $ttl, json_encode($value));
62
+			return self::$cache->setex($this->getNamespace().$key, $ttl, json_encode($value));
63 63
 		} else {
64
-			return self::$cache->set($this->getNamespace() . $key, json_encode($value));
64
+			return self::$cache->set($this->getNamespace().$key, json_encode($value));
65 65
 		}
66 66
 	}
67 67
 
68 68
 	public function hasKey($key) {
69
-		return self::$cache->exists($this->getNamespace() . $key);
69
+		return self::$cache->exists($this->getNamespace().$key);
70 70
 	}
71 71
 
72 72
 	public function remove($key) {
73
-		if (self::$cache->delete($this->getNamespace() . $key)) {
73
+		if (self::$cache->delete($this->getNamespace().$key)) {
74 74
 			return true;
75 75
 		} else {
76 76
 			return false;
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	}
79 79
 
80 80
 	public function clear($prefix = '') {
81
-		$prefix = $this->getNamespace() . $prefix . '*';
81
+		$prefix = $this->getNamespace().$prefix.'*';
82 82
 		$it = null;
83 83
 		self::$cache->setOption(\Redis::OPT_SCAN, \Redis::SCAN_RETRY);
84 84
 		while ($keys = self::$cache->scan($it, $prefix)) {
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 		if (!is_int($value)) {
101 101
 			$value = json_encode($value);
102 102
 		}
103
-		return self::$cache->setnx($this->getPrefix() . $key, $value);
103
+		return self::$cache->setnx($this->getPrefix().$key, $value);
104 104
 	}
105 105
 
106 106
 	/**
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * @return int | bool
112 112
 	 */
113 113
 	public function inc($key, $step = 1) {
114
-		return self::$cache->incrBy($this->getNamespace() . $key, $step);
114
+		return self::$cache->incrBy($this->getNamespace().$key, $step);
115 115
 	}
116 116
 
117 117
 	/**
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 		if (!$this->hasKey($key)) {
126 126
 			return false;
127 127
 		}
128
-		return self::$cache->decrBy($this->getNamespace() . $key, $step);
128
+		return self::$cache->decrBy($this->getNamespace().$key, $step);
129 129
 	}
130 130
 
131 131
 	/**
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 		if (!is_int($new)) {
141 141
 			$new = json_encode($new);
142 142
 		}
143
-		self::$cache->watch($this->getNamespace() . $key);
143
+		self::$cache->watch($this->getNamespace().$key);
144 144
 		if ($this->get($key) === $old) {
145 145
 			$result = self::$cache->multi()
146
-				->set($this->getNamespace() . $key, $new)
146
+				->set($this->getNamespace().$key, $new)
147 147
 				->exec();
148 148
 			return ($result === false) ? false : true;
149 149
 		}
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
159 159
 	 * @return bool
160 160
 	 */
161 161
 	public function cad($key, $old) {
162
-		self::$cache->watch($this->getNamespace() . $key);
162
+		self::$cache->watch($this->getNamespace().$key);
163 163
 		if ($this->get($key) === $old) {
164 164
 			$result = self::$cache->multi()
165
-				->del($this->getNamespace() . $key)
165
+				->del($this->getNamespace().$key)
166 166
 				->exec();
167 167
 			return ($result === false) ? false : true;
168 168
 		}
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	}
172 172
 
173 173
 	public function setTTL($key, $ttl) {
174
-		self::$cache->expire($this->getNamespace() . $key, $ttl);
174
+		self::$cache->expire($this->getNamespace().$key, $ttl);
175 175
 	}
176 176
 
177 177
 	static public function isAvailable() {
Please login to merge, or discard this patch.
lib/private/OCS/Provider.php 2 patches
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -24,75 +24,75 @@
 block discarded – undo
24 24
 namespace OC\OCS;
25 25
 
26 26
 class Provider extends \OCP\AppFramework\Controller {
27
-	/** @var \OCP\App\IAppManager */
28
-	private $appManager;
27
+    /** @var \OCP\App\IAppManager */
28
+    private $appManager;
29 29
 
30
-	/**
31
-	 * @param string $appName
32
-	 * @param \OCP\IRequest $request
33
-	 * @param \OCP\App\IAppManager $appManager
34
-	 */
35
-	public function __construct($appName,
36
-								\OCP\IRequest $request,
37
-								\OCP\App\IAppManager $appManager) {
38
-		parent::__construct($appName, $request);
39
-		$this->appManager = $appManager;
40
-	}
30
+    /**
31
+     * @param string $appName
32
+     * @param \OCP\IRequest $request
33
+     * @param \OCP\App\IAppManager $appManager
34
+     */
35
+    public function __construct($appName,
36
+                                \OCP\IRequest $request,
37
+                                \OCP\App\IAppManager $appManager) {
38
+        parent::__construct($appName, $request);
39
+        $this->appManager = $appManager;
40
+    }
41 41
 
42
-	/**
43
-	 * @return \OCP\AppFramework\Http\JSONResponse
44
-	 */
45
-	public function buildProviderList() {
46
-		$services = [
47
-			'PRIVATE_DATA' => [
48
-				'version' => 1,
49
-				'endpoints' => [
50
-					'store' => '/ocs/v2.php/privatedata/setattribute',
51
-					'read' => '/ocs/v2.php/privatedata/getattribute',
52
-					'delete' => '/ocs/v2.php/privatedata/deleteattribute',
53
-				],
54
-			],
55
-		];
42
+    /**
43
+     * @return \OCP\AppFramework\Http\JSONResponse
44
+     */
45
+    public function buildProviderList() {
46
+        $services = [
47
+            'PRIVATE_DATA' => [
48
+                'version' => 1,
49
+                'endpoints' => [
50
+                    'store' => '/ocs/v2.php/privatedata/setattribute',
51
+                    'read' => '/ocs/v2.php/privatedata/getattribute',
52
+                    'delete' => '/ocs/v2.php/privatedata/deleteattribute',
53
+                ],
54
+            ],
55
+        ];
56 56
 
57
-		if($this->appManager->isEnabledForUser('files_sharing')) {
58
-			$services['SHARING'] = [
59
-				'version' => 1,
60
-				'endpoints' => [
61
-					'share' => '/ocs/v2.php/apps/files_sharing/api/v1/shares',
62
-				],
63
-			];
64
-			$services['FEDERATED_SHARING'] = [
65
-				'version' => 1,
66
-				'endpoints' => [
67
-					'share' => '/ocs/v2.php/cloud/shares',
68
-					'webdav' => '/public.php/webdav/',
69
-				],
70
-			];
71
-		}
57
+        if($this->appManager->isEnabledForUser('files_sharing')) {
58
+            $services['SHARING'] = [
59
+                'version' => 1,
60
+                'endpoints' => [
61
+                    'share' => '/ocs/v2.php/apps/files_sharing/api/v1/shares',
62
+                ],
63
+            ];
64
+            $services['FEDERATED_SHARING'] = [
65
+                'version' => 1,
66
+                'endpoints' => [
67
+                    'share' => '/ocs/v2.php/cloud/shares',
68
+                    'webdav' => '/public.php/webdav/',
69
+                ],
70
+            ];
71
+        }
72 72
 
73
-		if($this->appManager->isEnabledForUser('activity')) {
74
-			$services['ACTIVITY'] = [
75
-				'version' => 1,
76
-				'endpoints' => [
77
-					'list' => '/ocs/v2.php/cloud/activity',
78
-				],
79
-			];
80
-		}
73
+        if($this->appManager->isEnabledForUser('activity')) {
74
+            $services['ACTIVITY'] = [
75
+                'version' => 1,
76
+                'endpoints' => [
77
+                    'list' => '/ocs/v2.php/cloud/activity',
78
+                ],
79
+            ];
80
+        }
81 81
 
82
-		if($this->appManager->isEnabledForUser('provisioning_api')) {
83
-			$services['PROVISIONING'] = [
84
-				'version' => 1,
85
-				'endpoints' => [
86
-					'user' => '/ocs/v2.php/cloud/users',
87
-					'groups' => '/ocs/v2.php/cloud/groups',
88
-					'apps' => '/ocs/v2.php/cloud/apps',
89
-				],
90
-			];
91
-		}
82
+        if($this->appManager->isEnabledForUser('provisioning_api')) {
83
+            $services['PROVISIONING'] = [
84
+                'version' => 1,
85
+                'endpoints' => [
86
+                    'user' => '/ocs/v2.php/cloud/users',
87
+                    'groups' => '/ocs/v2.php/cloud/groups',
88
+                    'apps' => '/ocs/v2.php/cloud/apps',
89
+                ],
90
+            ];
91
+        }
92 92
 
93
-		return new \OCP\AppFramework\Http\JSONResponse([
94
-			'version' => 2,
95
-			'services' => $services,
96
-		]);
97
-	}
93
+        return new \OCP\AppFramework\Http\JSONResponse([
94
+            'version' => 2,
95
+            'services' => $services,
96
+        ]);
97
+    }
98 98
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 			],
55 55
 		];
56 56
 
57
-		if($this->appManager->isEnabledForUser('files_sharing')) {
57
+		if ($this->appManager->isEnabledForUser('files_sharing')) {
58 58
 			$services['SHARING'] = [
59 59
 				'version' => 1,
60 60
 				'endpoints' => [
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 			];
71 71
 		}
72 72
 
73
-		if($this->appManager->isEnabledForUser('activity')) {
73
+		if ($this->appManager->isEnabledForUser('activity')) {
74 74
 			$services['ACTIVITY'] = [
75 75
 				'version' => 1,
76 76
 				'endpoints' => [
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 			];
80 80
 		}
81 81
 
82
-		if($this->appManager->isEnabledForUser('provisioning_api')) {
82
+		if ($this->appManager->isEnabledForUser('provisioning_api')) {
83 83
 			$services['PROVISIONING'] = [
84 84
 				'version' => 1,
85 85
 				'endpoints' => [
Please login to merge, or discard this patch.
lib/private/OCS/Result.php 2 patches
Indentation   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -32,129 +32,129 @@
 block discarded – undo
32 32
 
33 33
 class Result {
34 34
 
35
-	/** @var array  */
36
-	protected $data;
37
-
38
-	/** @var null|string */
39
-	protected $message;
40
-
41
-	/** @var int */
42
-	protected $statusCode;
43
-
44
-	/** @var integer */
45
-	protected $items;
46
-
47
-	/** @var integer */
48
-	protected $perPage;
49
-
50
-	/** @var array */
51
-	private $headers = [];
52
-
53
-	/**
54
-	 * create the OCS_Result object
55
-	 * @param mixed $data the data to return
56
-	 * @param int $code
57
-	 * @param null|string $message
58
-	 * @param array $headers
59
-	 */
60
-	public function __construct($data = null, $code = 100, $message = null, $headers = []) {
61
-		if ($data === null) {
62
-			$this->data = array();
63
-		} elseif (!is_array($data)) {
64
-			$this->data = array($this->data);
65
-		} else {
66
-			$this->data = $data;
67
-		}
68
-		$this->statusCode = $code;
69
-		$this->message = $message;
70
-		$this->headers = $headers;
71
-	}
72
-
73
-	/**
74
-	 * optionally set the total number of items available
75
-	 * @param int $items
76
-	 */
77
-	public function setTotalItems($items) {
78
-		$this->items = $items;
79
-	}
80
-
81
-	/**
82
-	 * optionally set the the number of items per page
83
-	 * @param int $items
84
-	 */
85
-	public function setItemsPerPage($items) {
86
-		$this->perPage = $items;
87
-	}
88
-
89
-	/**
90
-	 * get the status code
91
-	 * @return int
92
-	 */
93
-	public function getStatusCode() {
94
-		return $this->statusCode;
95
-	}
96
-
97
-	/**
98
-	 * get the meta data for the result
99
-	 * @return array
100
-	 */
101
-	public function getMeta() {
102
-		$meta = array();
103
-		$meta['status'] = $this->succeeded() ? 'ok' : 'failure';
104
-		$meta['statuscode'] = $this->statusCode;
105
-		$meta['message'] = $this->message;
106
-		if(isset($this->items)) {
107
-			$meta['totalitems'] = $this->items;
108
-		}
109
-		if(isset($this->perPage)) {
110
-			$meta['itemsperpage'] = $this->perPage;
111
-		}
112
-		return $meta;
113
-
114
-	}
115
-
116
-	/**
117
-	 * get the result data
118
-	 * @return array
119
-	 */
120
-	public function getData() {
121
-		return $this->data;
122
-	}
123
-
124
-	/**
125
-	 * return bool Whether the method succeeded
126
-	 * @return bool
127
-	 */
128
-	public function succeeded() {
129
-		return ($this->statusCode == 100);
130
-	}
131
-
132
-	/**
133
-	 * Adds a new header to the response
134
-	 * @param string $name The name of the HTTP header
135
-	 * @param string $value The value, null will delete it
136
-	 * @return $this
137
-	 */
138
-	public function addHeader($name, $value) {
139
-		$name = trim($name);  // always remove leading and trailing whitespace
140
-		// to be able to reliably check for security
141
-		// headers
142
-
143
-		if(is_null($value)) {
144
-			unset($this->headers[$name]);
145
-		} else {
146
-			$this->headers[$name] = $value;
147
-		}
148
-
149
-		return $this;
150
-	}
151
-
152
-	/**
153
-	 * Returns the set headers
154
-	 * @return array the headers
155
-	 */
156
-	public function getHeaders() {
157
-		return $this->headers;
158
-	}
35
+    /** @var array  */
36
+    protected $data;
37
+
38
+    /** @var null|string */
39
+    protected $message;
40
+
41
+    /** @var int */
42
+    protected $statusCode;
43
+
44
+    /** @var integer */
45
+    protected $items;
46
+
47
+    /** @var integer */
48
+    protected $perPage;
49
+
50
+    /** @var array */
51
+    private $headers = [];
52
+
53
+    /**
54
+     * create the OCS_Result object
55
+     * @param mixed $data the data to return
56
+     * @param int $code
57
+     * @param null|string $message
58
+     * @param array $headers
59
+     */
60
+    public function __construct($data = null, $code = 100, $message = null, $headers = []) {
61
+        if ($data === null) {
62
+            $this->data = array();
63
+        } elseif (!is_array($data)) {
64
+            $this->data = array($this->data);
65
+        } else {
66
+            $this->data = $data;
67
+        }
68
+        $this->statusCode = $code;
69
+        $this->message = $message;
70
+        $this->headers = $headers;
71
+    }
72
+
73
+    /**
74
+     * optionally set the total number of items available
75
+     * @param int $items
76
+     */
77
+    public function setTotalItems($items) {
78
+        $this->items = $items;
79
+    }
80
+
81
+    /**
82
+     * optionally set the the number of items per page
83
+     * @param int $items
84
+     */
85
+    public function setItemsPerPage($items) {
86
+        $this->perPage = $items;
87
+    }
88
+
89
+    /**
90
+     * get the status code
91
+     * @return int
92
+     */
93
+    public function getStatusCode() {
94
+        return $this->statusCode;
95
+    }
96
+
97
+    /**
98
+     * get the meta data for the result
99
+     * @return array
100
+     */
101
+    public function getMeta() {
102
+        $meta = array();
103
+        $meta['status'] = $this->succeeded() ? 'ok' : 'failure';
104
+        $meta['statuscode'] = $this->statusCode;
105
+        $meta['message'] = $this->message;
106
+        if(isset($this->items)) {
107
+            $meta['totalitems'] = $this->items;
108
+        }
109
+        if(isset($this->perPage)) {
110
+            $meta['itemsperpage'] = $this->perPage;
111
+        }
112
+        return $meta;
113
+
114
+    }
115
+
116
+    /**
117
+     * get the result data
118
+     * @return array
119
+     */
120
+    public function getData() {
121
+        return $this->data;
122
+    }
123
+
124
+    /**
125
+     * return bool Whether the method succeeded
126
+     * @return bool
127
+     */
128
+    public function succeeded() {
129
+        return ($this->statusCode == 100);
130
+    }
131
+
132
+    /**
133
+     * Adds a new header to the response
134
+     * @param string $name The name of the HTTP header
135
+     * @param string $value The value, null will delete it
136
+     * @return $this
137
+     */
138
+    public function addHeader($name, $value) {
139
+        $name = trim($name);  // always remove leading and trailing whitespace
140
+        // to be able to reliably check for security
141
+        // headers
142
+
143
+        if(is_null($value)) {
144
+            unset($this->headers[$name]);
145
+        } else {
146
+            $this->headers[$name] = $value;
147
+        }
148
+
149
+        return $this;
150
+    }
151
+
152
+    /**
153
+     * Returns the set headers
154
+     * @return array the headers
155
+     */
156
+    public function getHeaders() {
157
+        return $this->headers;
158
+    }
159 159
 
160 160
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
 		$meta['status'] = $this->succeeded() ? 'ok' : 'failure';
104 104
 		$meta['statuscode'] = $this->statusCode;
105 105
 		$meta['message'] = $this->message;
106
-		if(isset($this->items)) {
106
+		if (isset($this->items)) {
107 107
 			$meta['totalitems'] = $this->items;
108 108
 		}
109
-		if(isset($this->perPage)) {
109
+		if (isset($this->perPage)) {
110 110
 			$meta['itemsperpage'] = $this->perPage;
111 111
 		}
112 112
 		return $meta;
@@ -136,11 +136,11 @@  discard block
 block discarded – undo
136 136
 	 * @return $this
137 137
 	 */
138 138
 	public function addHeader($name, $value) {
139
-		$name = trim($name);  // always remove leading and trailing whitespace
139
+		$name = trim($name); // always remove leading and trailing whitespace
140 140
 		// to be able to reliably check for security
141 141
 		// headers
142 142
 
143
-		if(is_null($value)) {
143
+		if (is_null($value)) {
144 144
 			unset($this->headers[$name]);
145 145
 		} else {
146 146
 			$this->headers[$name] = $value;
Please login to merge, or discard this patch.
lib/private/OCS/Exception.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@
 block discarded – undo
25 25
 
26 26
 class Exception extends \Exception {
27 27
 
28
-	public function __construct(Result $result) {
29
-		$this->result = $result;
30
-	}
28
+    public function __construct(Result $result) {
29
+        $this->result = $result;
30
+    }
31 31
 
32
-	public function getResult() {
33
-		return $this->result;
34
-	}
32
+    public function getResult() {
33
+        return $this->result;
34
+    }
35 35
 
36 36
 }
Please login to merge, or discard this patch.