Passed
Push — master ( f0dd71...c56a27 )
by Christoph
11:49 queued 12s
created
lib/public/Http/Client/IClient.php 1 patch
Indentation   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -32,178 +32,178 @@
 block discarded – undo
32 32
  */
33 33
 interface IClient {
34 34
 
35
-	/**
36
-	 * Sends a GET request
37
-	 * @param string $uri
38
-	 * @param array $options Array such as
39
-	 *              'query' => [
40
-	 *                  'field' => 'abc',
41
-	 *                  'other_field' => '123',
42
-	 *                  'file_name' => fopen('/path/to/file', 'r'),
43
-	 *              ],
44
-	 *              'headers' => [
45
-	 *                  'foo' => 'bar',
46
-	 *              ],
47
-	 *              'cookies' => ['
48
-	 *                  'foo' => 'bar',
49
-	 *              ],
50
-	 *              'allow_redirects' => [
51
-	 *                   'max'       => 10,  // allow at most 10 redirects.
52
-	 *                   'strict'    => true,     // use "strict" RFC compliant redirects.
53
-	 *                   'referer'   => true,     // add a Referer header
54
-	 *                   'protocols' => ['https'] // only allow https URLs
55
-	 *              ],
56
-	 *              'save_to' => '/path/to/file', // save to a file or a stream
57
-	 *              'verify' => true, // bool or string to CA file
58
-	 *              'debug' => true,
59
-	 * @return IResponse
60
-	 * @throws \Exception If the request could not get completed
61
-	 * @since 8.1.0
62
-	 */
63
-	public function get(string $uri, array $options = []): IResponse;
35
+    /**
36
+     * Sends a GET request
37
+     * @param string $uri
38
+     * @param array $options Array such as
39
+     *              'query' => [
40
+     *                  'field' => 'abc',
41
+     *                  'other_field' => '123',
42
+     *                  'file_name' => fopen('/path/to/file', 'r'),
43
+     *              ],
44
+     *              'headers' => [
45
+     *                  'foo' => 'bar',
46
+     *              ],
47
+     *              'cookies' => ['
48
+     *                  'foo' => 'bar',
49
+     *              ],
50
+     *              'allow_redirects' => [
51
+     *                   'max'       => 10,  // allow at most 10 redirects.
52
+     *                   'strict'    => true,     // use "strict" RFC compliant redirects.
53
+     *                   'referer'   => true,     // add a Referer header
54
+     *                   'protocols' => ['https'] // only allow https URLs
55
+     *              ],
56
+     *              'save_to' => '/path/to/file', // save to a file or a stream
57
+     *              'verify' => true, // bool or string to CA file
58
+     *              'debug' => true,
59
+     * @return IResponse
60
+     * @throws \Exception If the request could not get completed
61
+     * @since 8.1.0
62
+     */
63
+    public function get(string $uri, array $options = []): IResponse;
64 64
 
65
-	/**
66
-	 * Sends a HEAD request
67
-	 * @param string $uri
68
-	 * @param array $options Array such as
69
-	 *              'headers' => [
70
-	 *                  'foo' => 'bar',
71
-	 *              ],
72
-	 *              'cookies' => ['
73
-	 *                  'foo' => 'bar',
74
-	 *              ],
75
-	 *              'allow_redirects' => [
76
-	 *                   'max'       => 10,  // allow at most 10 redirects.
77
-	 *                   'strict'    => true,     // use "strict" RFC compliant redirects.
78
-	 *                   'referer'   => true,     // add a Referer header
79
-	 *                   'protocols' => ['https'] // only allow https URLs
80
-	 *              ],
81
-	 *              'save_to' => '/path/to/file', // save to a file or a stream
82
-	 *              'verify' => true, // bool or string to CA file
83
-	 *              'debug' => true,
84
-	 * @return IResponse
85
-	 * @throws \Exception If the request could not get completed
86
-	 * @since 8.1.0
87
-	 */
88
-	public function head(string $uri, array $options = []): IResponse;
65
+    /**
66
+     * Sends a HEAD request
67
+     * @param string $uri
68
+     * @param array $options Array such as
69
+     *              'headers' => [
70
+     *                  'foo' => 'bar',
71
+     *              ],
72
+     *              'cookies' => ['
73
+     *                  'foo' => 'bar',
74
+     *              ],
75
+     *              'allow_redirects' => [
76
+     *                   'max'       => 10,  // allow at most 10 redirects.
77
+     *                   'strict'    => true,     // use "strict" RFC compliant redirects.
78
+     *                   'referer'   => true,     // add a Referer header
79
+     *                   'protocols' => ['https'] // only allow https URLs
80
+     *              ],
81
+     *              'save_to' => '/path/to/file', // save to a file or a stream
82
+     *              'verify' => true, // bool or string to CA file
83
+     *              'debug' => true,
84
+     * @return IResponse
85
+     * @throws \Exception If the request could not get completed
86
+     * @since 8.1.0
87
+     */
88
+    public function head(string $uri, array $options = []): IResponse;
89 89
 
90
-	/**
91
-	 * Sends a POST request
92
-	 * @param string $uri
93
-	 * @param array $options Array such as
94
-	 *              'body' => [
95
-	 *                  'field' => 'abc',
96
-	 *                  'other_field' => '123',
97
-	 *                  'file_name' => fopen('/path/to/file', 'r'),
98
-	 *              ],
99
-	 *              'headers' => [
100
-	 *                  'foo' => 'bar',
101
-	 *              ],
102
-	 *              'cookies' => ['
103
-	 *                  'foo' => 'bar',
104
-	 *              ],
105
-	 *              'allow_redirects' => [
106
-	 *                   'max'       => 10,  // allow at most 10 redirects.
107
-	 *                   'strict'    => true,     // use "strict" RFC compliant redirects.
108
-	 *                   'referer'   => true,     // add a Referer header
109
-	 *                   'protocols' => ['https'] // only allow https URLs
110
-	 *              ],
111
-	 *              'save_to' => '/path/to/file', // save to a file or a stream
112
-	 *              'verify' => true, // bool or string to CA file
113
-	 *              'debug' => true,
114
-	 * @return IResponse
115
-	 * @throws \Exception If the request could not get completed
116
-	 * @since 8.1.0
117
-	 */
118
-	public function post(string $uri, array $options = []): IResponse;
90
+    /**
91
+     * Sends a POST request
92
+     * @param string $uri
93
+     * @param array $options Array such as
94
+     *              'body' => [
95
+     *                  'field' => 'abc',
96
+     *                  'other_field' => '123',
97
+     *                  'file_name' => fopen('/path/to/file', 'r'),
98
+     *              ],
99
+     *              'headers' => [
100
+     *                  'foo' => 'bar',
101
+     *              ],
102
+     *              'cookies' => ['
103
+     *                  'foo' => 'bar',
104
+     *              ],
105
+     *              'allow_redirects' => [
106
+     *                   'max'       => 10,  // allow at most 10 redirects.
107
+     *                   'strict'    => true,     // use "strict" RFC compliant redirects.
108
+     *                   'referer'   => true,     // add a Referer header
109
+     *                   'protocols' => ['https'] // only allow https URLs
110
+     *              ],
111
+     *              'save_to' => '/path/to/file', // save to a file or a stream
112
+     *              'verify' => true, // bool or string to CA file
113
+     *              'debug' => true,
114
+     * @return IResponse
115
+     * @throws \Exception If the request could not get completed
116
+     * @since 8.1.0
117
+     */
118
+    public function post(string $uri, array $options = []): IResponse;
119 119
 
120
-	/**
121
-	 * Sends a PUT request
122
-	 * @param string $uri
123
-	 * @param array $options Array such as
124
-	 *              'body' => [
125
-	 *                  'field' => 'abc',
126
-	 *                  'other_field' => '123',
127
-	 *                  'file_name' => fopen('/path/to/file', 'r'),
128
-	 *              ],
129
-	 *              'headers' => [
130
-	 *                  'foo' => 'bar',
131
-	 *              ],
132
-	 *              'cookies' => ['
133
-	 *                  'foo' => 'bar',
134
-	 *              ],
135
-	 *              'allow_redirects' => [
136
-	 *                   'max'       => 10,  // allow at most 10 redirects.
137
-	 *                   'strict'    => true,     // use "strict" RFC compliant redirects.
138
-	 *                   'referer'   => true,     // add a Referer header
139
-	 *                   'protocols' => ['https'] // only allow https URLs
140
-	 *              ],
141
-	 *              'save_to' => '/path/to/file', // save to a file or a stream
142
-	 *              'verify' => true, // bool or string to CA file
143
-	 *              'debug' => true,
144
-	 * @return IResponse
145
-	 * @throws \Exception If the request could not get completed
146
-	 * @since 8.1.0
147
-	 */
148
-	public function put(string $uri, array $options = []): IResponse;
120
+    /**
121
+     * Sends a PUT request
122
+     * @param string $uri
123
+     * @param array $options Array such as
124
+     *              'body' => [
125
+     *                  'field' => 'abc',
126
+     *                  'other_field' => '123',
127
+     *                  'file_name' => fopen('/path/to/file', 'r'),
128
+     *              ],
129
+     *              'headers' => [
130
+     *                  'foo' => 'bar',
131
+     *              ],
132
+     *              'cookies' => ['
133
+     *                  'foo' => 'bar',
134
+     *              ],
135
+     *              'allow_redirects' => [
136
+     *                   'max'       => 10,  // allow at most 10 redirects.
137
+     *                   'strict'    => true,     // use "strict" RFC compliant redirects.
138
+     *                   'referer'   => true,     // add a Referer header
139
+     *                   'protocols' => ['https'] // only allow https URLs
140
+     *              ],
141
+     *              'save_to' => '/path/to/file', // save to a file or a stream
142
+     *              'verify' => true, // bool or string to CA file
143
+     *              'debug' => true,
144
+     * @return IResponse
145
+     * @throws \Exception If the request could not get completed
146
+     * @since 8.1.0
147
+     */
148
+    public function put(string $uri, array $options = []): IResponse;
149 149
 
150
-	/**
151
-	 * Sends a DELETE request
152
-	 * @param string $uri
153
-	 * @param array $options Array such as
154
-	 *              'body' => [
155
-	 *                  'field' => 'abc',
156
-	 *                  'other_field' => '123',
157
-	 *                  'file_name' => fopen('/path/to/file', 'r'),
158
-	 *              ],
159
-	 *              'headers' => [
160
-	 *                  'foo' => 'bar',
161
-	 *              ],
162
-	 *              'cookies' => ['
163
-	 *                  'foo' => 'bar',
164
-	 *              ],
165
-	 *              'allow_redirects' => [
166
-	 *                   'max'       => 10,  // allow at most 10 redirects.
167
-	 *                   'strict'    => true,     // use "strict" RFC compliant redirects.
168
-	 *                   'referer'   => true,     // add a Referer header
169
-	 *                   'protocols' => ['https'] // only allow https URLs
170
-	 *              ],
171
-	 *              'save_to' => '/path/to/file', // save to a file or a stream
172
-	 *              'verify' => true, // bool or string to CA file
173
-	 *              'debug' => true,
174
-	 * @return IResponse
175
-	 * @throws \Exception If the request could not get completed
176
-	 * @since 8.1.0
177
-	 */
178
-	public function delete(string $uri, array $options = []): IResponse;
150
+    /**
151
+     * Sends a DELETE request
152
+     * @param string $uri
153
+     * @param array $options Array such as
154
+     *              'body' => [
155
+     *                  'field' => 'abc',
156
+     *                  'other_field' => '123',
157
+     *                  'file_name' => fopen('/path/to/file', 'r'),
158
+     *              ],
159
+     *              'headers' => [
160
+     *                  'foo' => 'bar',
161
+     *              ],
162
+     *              'cookies' => ['
163
+     *                  'foo' => 'bar',
164
+     *              ],
165
+     *              'allow_redirects' => [
166
+     *                   'max'       => 10,  // allow at most 10 redirects.
167
+     *                   'strict'    => true,     // use "strict" RFC compliant redirects.
168
+     *                   'referer'   => true,     // add a Referer header
169
+     *                   'protocols' => ['https'] // only allow https URLs
170
+     *              ],
171
+     *              'save_to' => '/path/to/file', // save to a file or a stream
172
+     *              'verify' => true, // bool or string to CA file
173
+     *              'debug' => true,
174
+     * @return IResponse
175
+     * @throws \Exception If the request could not get completed
176
+     * @since 8.1.0
177
+     */
178
+    public function delete(string $uri, array $options = []): IResponse;
179 179
 
180
-	/**
181
-	 * Sends a options request
182
-	 * @param string $uri
183
-	 * @param array $options Array such as
184
-	 *              'body' => [
185
-	 *                  'field' => 'abc',
186
-	 *                  'other_field' => '123',
187
-	 *                  'file_name' => fopen('/path/to/file', 'r'),
188
-	 *              ],
189
-	 *              'headers' => [
190
-	 *                  'foo' => 'bar',
191
-	 *              ],
192
-	 *              'cookies' => ['
193
-	 *                  'foo' => 'bar',
194
-	 *              ],
195
-	 *              'allow_redirects' => [
196
-	 *                   'max'       => 10,  // allow at most 10 redirects.
197
-	 *                   'strict'    => true,     // use "strict" RFC compliant redirects.
198
-	 *                   'referer'   => true,     // add a Referer header
199
-	 *                   'protocols' => ['https'] // only allow https URLs
200
-	 *              ],
201
-	 *              'save_to' => '/path/to/file', // save to a file or a stream
202
-	 *              'verify' => true, // bool or string to CA file
203
-	 *              'debug' => true,
204
-	 * @return IResponse
205
-	 * @throws \Exception If the request could not get completed
206
-	 * @since 8.1.0
207
-	 */
208
-	public function options(string $uri, array $options = []): IResponse;
180
+    /**
181
+     * Sends a options request
182
+     * @param string $uri
183
+     * @param array $options Array such as
184
+     *              'body' => [
185
+     *                  'field' => 'abc',
186
+     *                  'other_field' => '123',
187
+     *                  'file_name' => fopen('/path/to/file', 'r'),
188
+     *              ],
189
+     *              'headers' => [
190
+     *                  'foo' => 'bar',
191
+     *              ],
192
+     *              'cookies' => ['
193
+     *                  'foo' => 'bar',
194
+     *              ],
195
+     *              'allow_redirects' => [
196
+     *                   'max'       => 10,  // allow at most 10 redirects.
197
+     *                   'strict'    => true,     // use "strict" RFC compliant redirects.
198
+     *                   'referer'   => true,     // add a Referer header
199
+     *                   'protocols' => ['https'] // only allow https URLs
200
+     *              ],
201
+     *              'save_to' => '/path/to/file', // save to a file or a stream
202
+     *              'verify' => true, // bool or string to CA file
203
+     *              'debug' => true,
204
+     * @return IResponse
205
+     * @throws \Exception If the request could not get completed
206
+     * @since 8.1.0
207
+     */
208
+    public function options(string $uri, array $options = []): IResponse;
209 209
 }
Please login to merge, or discard this patch.
lib/public/Http/Client/IClientService.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@
 block discarded – undo
31 31
  * @since 8.1.0
32 32
  */
33 33
 interface IClientService {
34
-	/**
35
-	 * @return IClient
36
-	 * @since 8.1.0
37
-	 */
38
-	public function newClient(): IClient;
34
+    /**
35
+     * @return IClient
36
+     * @since 8.1.0
37
+     */
38
+    public function newClient(): IClient;
39 39
 }
Please login to merge, or discard this patch.
lib/public/Http/Client/IResponse.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -32,28 +32,28 @@
 block discarded – undo
32 32
  * @since 8.1.0
33 33
  */
34 34
 interface IResponse {
35
-	/**
36
-	 * @return string|resource
37
-	 * @since 8.1.0
38
-	 */
39
-	public function getBody();
35
+    /**
36
+     * @return string|resource
37
+     * @since 8.1.0
38
+     */
39
+    public function getBody();
40 40
 
41
-	/**
42
-	 * @return int
43
-	 * @since 8.1.0
44
-	 */
45
-	public function getStatusCode(): int;
41
+    /**
42
+     * @return int
43
+     * @since 8.1.0
44
+     */
45
+    public function getStatusCode(): int;
46 46
 
47
-	/**
48
-	 * @param string $key
49
-	 * @return string
50
-	 * @since 8.1.0
51
-	 */
52
-	public function getHeader(string $key): string;
47
+    /**
48
+     * @param string $key
49
+     * @return string
50
+     * @since 8.1.0
51
+     */
52
+    public function getHeader(string $key): string;
53 53
 
54
-	/**
55
-	 * @return array
56
-	 * @since 8.1.0
57
-	 */
58
-	public function getHeaders(): array;
54
+    /**
55
+     * @return array
56
+     * @since 8.1.0
57
+     */
58
+    public function getHeaders(): array;
59 59
 }
Please login to merge, or discard this patch.
lib/private/Http/Client/ClientService.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -35,25 +35,25 @@
 block discarded – undo
35 35
  * @package OC\Http
36 36
  */
37 37
 class ClientService implements IClientService {
38
-	/** @var IConfig */
39
-	private $config;
40
-	/** @var ICertificateManager */
41
-	private $certificateManager;
38
+    /** @var IConfig */
39
+    private $config;
40
+    /** @var ICertificateManager */
41
+    private $certificateManager;
42 42
 
43
-	/**
44
-	 * @param IConfig $config
45
-	 * @param ICertificateManager $certificateManager
46
-	 */
47
-	public function __construct(IConfig $config,
48
-								ICertificateManager $certificateManager) {
49
-		$this->config = $config;
50
-		$this->certificateManager = $certificateManager;
51
-	}
43
+    /**
44
+     * @param IConfig $config
45
+     * @param ICertificateManager $certificateManager
46
+     */
47
+    public function __construct(IConfig $config,
48
+                                ICertificateManager $certificateManager) {
49
+        $this->config = $config;
50
+        $this->certificateManager = $certificateManager;
51
+    }
52 52
 
53
-	/**
54
-	 * @return Client
55
-	 */
56
-	public function newClient(): IClient {
57
-		return new Client($this->config, $this->certificateManager, new GuzzleClient());
58
-	}
53
+    /**
54
+     * @return Client
55
+     */
56
+    public function newClient(): IClient {
57
+        return new Client($this->config, $this->certificateManager, new GuzzleClient());
58
+    }
59 59
 }
Please login to merge, or discard this patch.
lib/private/Lock/AbstractLockingProvider.php 1 patch
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -30,100 +30,100 @@
 block discarded – undo
30 30
  * to release any left over locks at the end of the request
31 31
  */
32 32
 abstract class AbstractLockingProvider implements ILockingProvider {
33
-	/** @var int $ttl */
34
-	protected $ttl; // how long until we clear stray locks in seconds
33
+    /** @var int $ttl */
34
+    protected $ttl; // how long until we clear stray locks in seconds
35 35
 
36
-	protected $acquiredLocks = [
37
-		'shared' => [],
38
-		'exclusive' => []
39
-	];
36
+    protected $acquiredLocks = [
37
+        'shared' => [],
38
+        'exclusive' => []
39
+    ];
40 40
 
41
-	/**
42
-	 * Check if we've locally acquired a lock
43
-	 *
44
-	 * @param string $path
45
-	 * @param int $type
46
-	 * @return bool
47
-	 */
48
-	protected function hasAcquiredLock(string $path, int $type): bool {
49
-		if ($type === self::LOCK_SHARED) {
50
-			return isset($this->acquiredLocks['shared'][$path]) && $this->acquiredLocks['shared'][$path] > 0;
51
-		} else {
52
-			return isset($this->acquiredLocks['exclusive'][$path]) && $this->acquiredLocks['exclusive'][$path] === true;
53
-		}
54
-	}
41
+    /**
42
+     * Check if we've locally acquired a lock
43
+     *
44
+     * @param string $path
45
+     * @param int $type
46
+     * @return bool
47
+     */
48
+    protected function hasAcquiredLock(string $path, int $type): bool {
49
+        if ($type === self::LOCK_SHARED) {
50
+            return isset($this->acquiredLocks['shared'][$path]) && $this->acquiredLocks['shared'][$path] > 0;
51
+        } else {
52
+            return isset($this->acquiredLocks['exclusive'][$path]) && $this->acquiredLocks['exclusive'][$path] === true;
53
+        }
54
+    }
55 55
 
56
-	/**
57
-	 * Mark a locally acquired lock
58
-	 *
59
-	 * @param string $path
60
-	 * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE
61
-	 */
62
-	protected function markAcquire(string $path, int $type) {
63
-		if ($type === self::LOCK_SHARED) {
64
-			if (!isset($this->acquiredLocks['shared'][$path])) {
65
-				$this->acquiredLocks['shared'][$path] = 0;
66
-			}
67
-			$this->acquiredLocks['shared'][$path]++;
68
-		} else {
69
-			$this->acquiredLocks['exclusive'][$path] = true;
70
-		}
71
-	}
56
+    /**
57
+     * Mark a locally acquired lock
58
+     *
59
+     * @param string $path
60
+     * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE
61
+     */
62
+    protected function markAcquire(string $path, int $type) {
63
+        if ($type === self::LOCK_SHARED) {
64
+            if (!isset($this->acquiredLocks['shared'][$path])) {
65
+                $this->acquiredLocks['shared'][$path] = 0;
66
+            }
67
+            $this->acquiredLocks['shared'][$path]++;
68
+        } else {
69
+            $this->acquiredLocks['exclusive'][$path] = true;
70
+        }
71
+    }
72 72
 
73
-	/**
74
-	 * Mark a release of a locally acquired lock
75
-	 *
76
-	 * @param string $path
77
-	 * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE
78
-	 */
79
-	protected function markRelease(string $path, int $type) {
80
-		if ($type === self::LOCK_SHARED) {
81
-			if (isset($this->acquiredLocks['shared'][$path]) and $this->acquiredLocks['shared'][$path] > 0) {
82
-				$this->acquiredLocks['shared'][$path]--;
83
-				if ($this->acquiredLocks['shared'][$path] === 0) {
84
-					unset($this->acquiredLocks['shared'][$path]);
85
-				}
86
-			}
87
-		} else if ($type === self::LOCK_EXCLUSIVE) {
88
-			unset($this->acquiredLocks['exclusive'][$path]);
89
-		}
90
-	}
73
+    /**
74
+     * Mark a release of a locally acquired lock
75
+     *
76
+     * @param string $path
77
+     * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE
78
+     */
79
+    protected function markRelease(string $path, int $type) {
80
+        if ($type === self::LOCK_SHARED) {
81
+            if (isset($this->acquiredLocks['shared'][$path]) and $this->acquiredLocks['shared'][$path] > 0) {
82
+                $this->acquiredLocks['shared'][$path]--;
83
+                if ($this->acquiredLocks['shared'][$path] === 0) {
84
+                    unset($this->acquiredLocks['shared'][$path]);
85
+                }
86
+            }
87
+        } else if ($type === self::LOCK_EXCLUSIVE) {
88
+            unset($this->acquiredLocks['exclusive'][$path]);
89
+        }
90
+    }
91 91
 
92
-	/**
93
-	 * Change the type of an existing tracked lock
94
-	 *
95
-	 * @param string $path
96
-	 * @param int $targetType self::LOCK_SHARED or self::LOCK_EXCLUSIVE
97
-	 */
98
-	protected function markChange(string $path, int $targetType) {
99
-		if ($targetType === self::LOCK_SHARED) {
100
-			unset($this->acquiredLocks['exclusive'][$path]);
101
-			if (!isset($this->acquiredLocks['shared'][$path])) {
102
-				$this->acquiredLocks['shared'][$path] = 0;
103
-			}
104
-			$this->acquiredLocks['shared'][$path]++;
105
-		} else if ($targetType === self::LOCK_EXCLUSIVE) {
106
-			$this->acquiredLocks['exclusive'][$path] = true;
107
-			$this->acquiredLocks['shared'][$path]--;
108
-		}
109
-	}
92
+    /**
93
+     * Change the type of an existing tracked lock
94
+     *
95
+     * @param string $path
96
+     * @param int $targetType self::LOCK_SHARED or self::LOCK_EXCLUSIVE
97
+     */
98
+    protected function markChange(string $path, int $targetType) {
99
+        if ($targetType === self::LOCK_SHARED) {
100
+            unset($this->acquiredLocks['exclusive'][$path]);
101
+            if (!isset($this->acquiredLocks['shared'][$path])) {
102
+                $this->acquiredLocks['shared'][$path] = 0;
103
+            }
104
+            $this->acquiredLocks['shared'][$path]++;
105
+        } else if ($targetType === self::LOCK_EXCLUSIVE) {
106
+            $this->acquiredLocks['exclusive'][$path] = true;
107
+            $this->acquiredLocks['shared'][$path]--;
108
+        }
109
+    }
110 110
 
111
-	/**
112
-	 * release all lock acquired by this instance which were marked using the mark* methods
113
-	 */
114
-	public function releaseAll() {
115
-		foreach ($this->acquiredLocks['shared'] as $path => $count) {
116
-			for ($i = 0; $i < $count; $i++) {
117
-				$this->releaseLock($path, self::LOCK_SHARED);
118
-			}
119
-		}
111
+    /**
112
+     * release all lock acquired by this instance which were marked using the mark* methods
113
+     */
114
+    public function releaseAll() {
115
+        foreach ($this->acquiredLocks['shared'] as $path => $count) {
116
+            for ($i = 0; $i < $count; $i++) {
117
+                $this->releaseLock($path, self::LOCK_SHARED);
118
+            }
119
+        }
120 120
 
121
-		foreach ($this->acquiredLocks['exclusive'] as $path => $hasLock) {
122
-			$this->releaseLock($path, self::LOCK_EXCLUSIVE);
123
-		}
124
-	}
121
+        foreach ($this->acquiredLocks['exclusive'] as $path => $hasLock) {
122
+            $this->releaseLock($path, self::LOCK_EXCLUSIVE);
123
+        }
124
+    }
125 125
 
126
-	protected function getOwnSharedLockCount(string $path) {
127
-		return isset($this->acquiredLocks['shared'][$path]) ? $this->acquiredLocks['shared'][$path] : 0;
128
-	}
126
+    protected function getOwnSharedLockCount(string $path) {
127
+        return isset($this->acquiredLocks['shared'][$path]) ? $this->acquiredLocks['shared'][$path] : 0;
128
+    }
129 129
 }
Please login to merge, or discard this patch.
lib/public/Lock/ILockingProvider.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -31,51 +31,51 @@
 block discarded – undo
31 31
  * @since 8.1.0
32 32
  */
33 33
 interface ILockingProvider {
34
-	/**
35
-	 * @since 8.1.0
36
-	 */
37
-	const LOCK_SHARED = 1;
38
-	/**
39
-	 * @since 8.1.0
40
-	 */
41
-	const LOCK_EXCLUSIVE = 2;
34
+    /**
35
+     * @since 8.1.0
36
+     */
37
+    const LOCK_SHARED = 1;
38
+    /**
39
+     * @since 8.1.0
40
+     */
41
+    const LOCK_EXCLUSIVE = 2;
42 42
 
43
-	/**
44
-	 * @param string $path
45
-	 * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE
46
-	 * @return bool
47
-	 * @since 8.1.0
48
-	 */
49
-	public function isLocked(string $path, int $type): bool;
43
+    /**
44
+     * @param string $path
45
+     * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE
46
+     * @return bool
47
+     * @since 8.1.0
48
+     */
49
+    public function isLocked(string $path, int $type): bool;
50 50
 
51
-	/**
52
-	 * @param string $path
53
-	 * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE
54
-	 * @throws \OCP\Lock\LockedException
55
-	 * @since 8.1.0
56
-	 */
57
-	public function acquireLock(string $path, int $type);
51
+    /**
52
+     * @param string $path
53
+     * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE
54
+     * @throws \OCP\Lock\LockedException
55
+     * @since 8.1.0
56
+     */
57
+    public function acquireLock(string $path, int $type);
58 58
 
59
-	/**
60
-	 * @param string $path
61
-	 * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE
62
-	 * @since 8.1.0
63
-	 */
64
-	public function releaseLock(string $path, int $type);
59
+    /**
60
+     * @param string $path
61
+     * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE
62
+     * @since 8.1.0
63
+     */
64
+    public function releaseLock(string $path, int $type);
65 65
 
66
-	/**
67
-	 * Change the type of an existing lock
68
-	 *
69
-	 * @param string $path
70
-	 * @param int $targetType self::LOCK_SHARED or self::LOCK_EXCLUSIVE
71
-	 * @throws \OCP\Lock\LockedException
72
-	 * @since 8.1.0
73
-	 */
74
-	public function changeLock(string $path, int $targetType);
66
+    /**
67
+     * Change the type of an existing lock
68
+     *
69
+     * @param string $path
70
+     * @param int $targetType self::LOCK_SHARED or self::LOCK_EXCLUSIVE
71
+     * @throws \OCP\Lock\LockedException
72
+     * @since 8.1.0
73
+     */
74
+    public function changeLock(string $path, int $targetType);
75 75
 
76
-	/**
77
-	 * release all lock acquired by this instance
78
-	 * @since 8.1.0
79
-	 */
80
-	public function releaseAll();
76
+    /**
77
+     * release all lock acquired by this instance
78
+     * @since 8.1.0
79
+     */
80
+    public function releaseAll();
81 81
 }
Please login to merge, or discard this patch.
apps/testing/lib/Locking/FakeDBLockingProvider.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -27,44 +27,44 @@
 block discarded – undo
27 27
 use OCP\ILogger;
28 28
 
29 29
 class FakeDBLockingProvider extends \OC\Lock\DBLockingProvider {
30
-	// Lock for 10 hours just to be sure
31
-	const TTL = 36000;
30
+    // Lock for 10 hours just to be sure
31
+    const TTL = 36000;
32 32
 
33
-	/**
34
-	 * Need a new child, because parent::connection is private instead of protected...
35
-	 * @var IDBConnection
36
-	 */
37
-	protected $db;
33
+    /**
34
+     * Need a new child, because parent::connection is private instead of protected...
35
+     * @var IDBConnection
36
+     */
37
+    protected $db;
38 38
 
39
-	/**
40
-	 * @param \OCP\IDBConnection $connection
41
-	 * @param \OCP\ILogger $logger
42
-	 * @param \OCP\AppFramework\Utility\ITimeFactory $timeFactory
43
-	 */
44
-	public function __construct(IDBConnection $connection, ILogger $logger, ITimeFactory $timeFactory) {
45
-		parent::__construct($connection, $logger, $timeFactory);
46
-		$this->db = $connection;
47
-	}
39
+    /**
40
+     * @param \OCP\IDBConnection $connection
41
+     * @param \OCP\ILogger $logger
42
+     * @param \OCP\AppFramework\Utility\ITimeFactory $timeFactory
43
+     */
44
+    public function __construct(IDBConnection $connection, ILogger $logger, ITimeFactory $timeFactory) {
45
+        parent::__construct($connection, $logger, $timeFactory);
46
+        $this->db = $connection;
47
+    }
48 48
 
49 49
 
50
-	/**
51
-	 * @param string $path
52
-	 * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE
53
-	 */
54
-	public function releaseLock(string $path, int $type) {
55
-		// we DONT keep shared locks till the end of the request
56
-		if ($type === self::LOCK_SHARED) {
57
-			$this->db->executeUpdate(
58
-				'UPDATE `*PREFIX*file_locks` SET `lock` = 0 WHERE `key` = ? AND `lock` = 1',
59
-				[$path]
60
-			);
61
-		}
50
+    /**
51
+     * @param string $path
52
+     * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE
53
+     */
54
+    public function releaseLock(string $path, int $type) {
55
+        // we DONT keep shared locks till the end of the request
56
+        if ($type === self::LOCK_SHARED) {
57
+            $this->db->executeUpdate(
58
+                'UPDATE `*PREFIX*file_locks` SET `lock` = 0 WHERE `key` = ? AND `lock` = 1',
59
+                [$path]
60
+            );
61
+        }
62 62
 
63
-		parent::releaseLock($path, $type);
64
-	}
63
+        parent::releaseLock($path, $type);
64
+    }
65 65
 
66
-	public function __destruct() {
67
-		// Prevent cleaning up at the end of the live time.
68
-		// parent::__destruct();
69
-	}
66
+    public function __destruct() {
67
+        // Prevent cleaning up at the end of the live time.
68
+        // parent::__destruct();
69
+    }
70 70
 }
Please login to merge, or discard this patch.
lib/public/Security/IHasher.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -45,23 +45,23 @@
 block discarded – undo
45 45
  * @since 8.0.0
46 46
  */
47 47
 interface IHasher {
48
-	/**
49
-	 * Hashes a message using PHP's `password_hash` functionality.
50
-	 * Please note that the size of the returned string is not guaranteed
51
-	 * and can be up to 255 characters.
52
-	 *
53
-	 * @param string $message Message to generate hash from
54
-	 * @return string Hash of the message with appended version parameter
55
-	 * @since 8.0.0
56
-	 */
57
-	public function hash(string $message): string;
48
+    /**
49
+     * Hashes a message using PHP's `password_hash` functionality.
50
+     * Please note that the size of the returned string is not guaranteed
51
+     * and can be up to 255 characters.
52
+     *
53
+     * @param string $message Message to generate hash from
54
+     * @return string Hash of the message with appended version parameter
55
+     * @since 8.0.0
56
+     */
57
+    public function hash(string $message): string;
58 58
 
59
-	/**
60
-	 * @param string $message Message to verify
61
-	 * @param string $hash Assumed hash of the message
62
-	 * @param null|string &$newHash Reference will contain the updated hash if necessary. Update the existing hash with this one.
63
-	 * @return bool Whether $hash is a valid hash of $message
64
-	 * @since 8.0.0
65
-	 */
66
-	public function verify(string $message, string $hash, &$newHash = null): bool ;
59
+    /**
60
+     * @param string $message Message to verify
61
+     * @param string $hash Assumed hash of the message
62
+     * @param null|string &$newHash Reference will contain the updated hash if necessary. Update the existing hash with this one.
63
+     * @return bool Whether $hash is a valid hash of $message
64
+     * @since 8.0.0
65
+     */
66
+    public function verify(string $message, string $hash, &$newHash = null): bool ;
67 67
 }
Please login to merge, or discard this patch.
lib/private/Lock/NoopLockingProvider.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -33,38 +33,38 @@
 block discarded – undo
33 33
  */
34 34
 class NoopLockingProvider implements ILockingProvider {
35 35
 
36
-	/**
37
-	 * {@inheritdoc}
38
-	 */
39
-	public function isLocked(string $path, int $type): bool {
40
-		return false;
41
-	}
36
+    /**
37
+     * {@inheritdoc}
38
+     */
39
+    public function isLocked(string $path, int $type): bool {
40
+        return false;
41
+    }
42 42
 
43
-	/**
44
-	 * {@inheritdoc}
45
-	 */
46
-	public function acquireLock(string $path, int $type) {
47
-		// do nothing
48
-	}
43
+    /**
44
+     * {@inheritdoc}
45
+     */
46
+    public function acquireLock(string $path, int $type) {
47
+        // do nothing
48
+    }
49 49
 
50
-	/**
51
-	 * {@inheritdoc}
52
-	 */
53
-	public function releaseLock(string $path, int $type) {
54
-		// do nothing
55
-	}
50
+    /**
51
+     * {@inheritdoc}
52
+     */
53
+    public function releaseLock(string $path, int $type) {
54
+        // do nothing
55
+    }
56 56
 
57
-	/**1
57
+    /**1
58 58
 	 * {@inheritdoc}
59 59
 	 */
60
-	public function releaseAll() {
61
-		// do nothing
62
-	}
60
+    public function releaseAll() {
61
+        // do nothing
62
+    }
63 63
 
64
-	/**
65
-	 * {@inheritdoc}
66
-	 */
67
-	public function changeLock(string $path, int $targetType) {
68
-		// do nothing
69
-	}
64
+    /**
65
+     * {@inheritdoc}
66
+     */
67
+    public function changeLock(string $path, int $targetType) {
68
+        // do nothing
69
+    }
70 70
 }
Please login to merge, or discard this patch.