Passed
Push — master ( b67ac4...89cf1c )
by Joas
15:14 queued 12s
created
lib/private/Authentication/Events/ARemoteWipeEvent.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,16 +31,16 @@
 block discarded – undo
31 31
 
32 32
 abstract class ARemoteWipeEvent extends Event {
33 33
 
34
-	/** @var IToken */
35
-	private $token;
34
+    /** @var IToken */
35
+    private $token;
36 36
 
37
-	public function __construct(IToken $token) {
38
-		parent::__construct();
39
-		$this->token = $token;
40
-	}
37
+    public function __construct(IToken $token) {
38
+        parent::__construct();
39
+        $this->token = $token;
40
+    }
41 41
 
42
-	public function getToken(): IToken {
43
-		return $this->token;
44
-	}
42
+    public function getToken(): IToken {
43
+        return $this->token;
44
+    }
45 45
 
46 46
 }
Please login to merge, or discard this patch.
lib/public/Security/IContentSecurityPolicyManager.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -31,23 +31,23 @@
 block discarded – undo
31 31
  * @deprecated 17.0.0 listen to the AddContentSecurityPolicyEvent to add a policy
32 32
  */
33 33
 interface IContentSecurityPolicyManager {
34
-	/**
35
-	 * Allows to inject something into the default content policy. This is for
36
-	 * example useful when you're injecting Javascript code into a view belonging
37
-	 * to another controller and cannot modify its Content-Security-Policy itself.
38
-	 * Note that the adjustment is only applied to applications that use AppFramework
39
-	 * controllers.
40
-	 *
41
-	 * To use this from your `app.php` use `\OC::$server->getContentSecurityPolicyManager()->addDefaultPolicy($policy)`,
42
-	 * $policy has to be of type `\OCP\AppFramework\Http\ContentSecurityPolicy`.
43
-	 *
44
-	 * WARNING: Using this API incorrectly may make the instance more insecure.
45
-	 * Do think twice before adding whitelisting resources. Please do also note
46
-	 * that it is not possible to use the `disallowXYZ` functions.
47
-	 *
48
-	 * @param EmptyContentSecurityPolicy $policy
49
-	 * @since 9.0.0
50
-	 * @deprecated 17.0.0 listen to the AddContentSecurityPolicyEvent to add a policy
51
-	 */
52
-	public function addDefaultPolicy(EmptyContentSecurityPolicy $policy);
34
+    /**
35
+     * Allows to inject something into the default content policy. This is for
36
+     * example useful when you're injecting Javascript code into a view belonging
37
+     * to another controller and cannot modify its Content-Security-Policy itself.
38
+     * Note that the adjustment is only applied to applications that use AppFramework
39
+     * controllers.
40
+     *
41
+     * To use this from your `app.php` use `\OC::$server->getContentSecurityPolicyManager()->addDefaultPolicy($policy)`,
42
+     * $policy has to be of type `\OCP\AppFramework\Http\ContentSecurityPolicy`.
43
+     *
44
+     * WARNING: Using this API incorrectly may make the instance more insecure.
45
+     * Do think twice before adding whitelisting resources. Please do also note
46
+     * that it is not possible to use the `disallowXYZ` functions.
47
+     *
48
+     * @param EmptyContentSecurityPolicy $policy
49
+     * @since 9.0.0
50
+     * @deprecated 17.0.0 listen to the AddContentSecurityPolicyEvent to add a policy
51
+     */
52
+    public function addDefaultPolicy(EmptyContentSecurityPolicy $policy);
53 53
 }
Please login to merge, or discard this patch.
lib/public/Preview/IVersionedPreviewFile.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 17.0.0
32 32
  */
33 33
 interface IVersionedPreviewFile {
34
-	/**
35
-	 * @return string
36
-	 * @since 17.0.0
37
-	 */
38
-	public function getPreviewVersion(): string;
34
+    /**
35
+     * @return string
36
+     * @since 17.0.0
37
+     */
38
+    public function getPreviewVersion(): string;
39 39
 }
Please login to merge, or discard this patch.
lib/private/Authentication/Token/IWipeableToken.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@
 block discarded – undo
26 26
 
27 27
 interface IWipeableToken extends IToken {
28 28
 
29
-	/**
30
-	 * Mark the token for remote wipe
31
-	 */
32
-	public function wipe(): void;
29
+    /**
30
+     * Mark the token for remote wipe
31
+     */
32
+    public function wipe(): void;
33 33
 
34 34
 }
Please login to merge, or discard this patch.
apps/provisioning_api/lib/Controller/AppConfigController.php 1 patch
Indentation   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -34,132 +34,132 @@
 block discarded – undo
34 34
 
35 35
 class AppConfigController extends OCSController {
36 36
 
37
-	/** @var IConfig */
38
-	protected $config;
39
-
40
-	/** @var IAppConfig */
41
-	protected $appConfig;
42
-
43
-	/**
44
-	 * @param string $appName
45
-	 * @param IRequest $request
46
-	 * @param IConfig $config
47
-	 * @param IAppConfig $appConfig
48
-	 */
49
-	public function __construct(string $appName,
50
-								IRequest $request,
51
-								IConfig $config,
52
-								IAppConfig $appConfig) {
53
-		parent::__construct($appName, $request);
54
-		$this->config = $config;
55
-		$this->appConfig = $appConfig;
56
-	}
57
-
58
-	/**
59
-	 * @return DataResponse
60
-	 */
61
-	public function getApps(): DataResponse {
62
-		return new DataResponse([
63
-			'data' => $this->appConfig->getApps(),
64
-		]);
65
-	}
66
-
67
-	/**
68
-	 * @param string $app
69
-	 * @return DataResponse
70
-	 */
71
-	public function getKeys(string $app): DataResponse {
72
-		try {
73
-			$this->verifyAppId($app);
74
-		} catch (\InvalidArgumentException $e) {
75
-			return new DataResponse(['data' => ['message' => $e->getMessage()]], Http::STATUS_FORBIDDEN);
76
-		}
77
-		return new DataResponse([
78
-			'data' => $this->config->getAppKeys($app),
79
-		]);
80
-	}
81
-
82
-	/**
83
-	 * @param string $app
84
-	 * @param string $key
85
-	 * @param string $defaultValue
86
-	 * @return DataResponse
87
-	 */
88
-	public function getValue(string $app, string $key, string $defaultValue = ''): DataResponse {
89
-		try {
90
-			$this->verifyAppId($app);
91
-		} catch (\InvalidArgumentException $e) {
92
-			return new DataResponse(['data' => ['message' => $e->getMessage()]], Http::STATUS_FORBIDDEN);
93
-		}
94
-		return new DataResponse([
95
-			'data' => $this->config->getAppValue($app, $key, $defaultValue),
96
-		]);
97
-	}
98
-
99
-	/**
100
-	 * @PasswordConfirmationRequired
101
-	 * @param string $app
102
-	 * @param string $key
103
-	 * @param string $value
104
-	 * @return DataResponse
105
-	 */
106
-	public function setValue(string $app, string $key, string $value): DataResponse {
107
-		try {
108
-			$this->verifyAppId($app);
109
-			$this->verifyConfigKey($app, $key, $value);
110
-		} catch (\InvalidArgumentException $e) {
111
-			return new DataResponse(['data' => ['message' => $e->getMessage()]], Http::STATUS_FORBIDDEN);
112
-		}
113
-
114
-		$this->config->setAppValue($app, $key, $value);
115
-		return new DataResponse();
116
-	}
117
-
118
-	/**
119
-	 * @PasswordConfirmationRequired
120
-	 * @param string $app
121
-	 * @param string $key
122
-	 * @return DataResponse
123
-	 */
124
-	public function deleteKey(string $app, string $key): DataResponse {
125
-		try {
126
-			$this->verifyAppId($app);
127
-			$this->verifyConfigKey($app, $key, '');
128
-		} catch (\InvalidArgumentException $e) {
129
-			return new DataResponse(['data' => ['message' => $e->getMessage()]], Http::STATUS_FORBIDDEN);
130
-		}
131
-
132
-		$this->config->deleteAppValue($app, $key);
133
-		return new DataResponse();
134
-	}
135
-
136
-	/**
137
-	 * @param string $app
138
-	 * @throws \InvalidArgumentException
139
-	 */
140
-	protected function verifyAppId(string $app) {
141
-		if (\OC_App::cleanAppId($app) !== $app) {
142
-			throw new \InvalidArgumentException('Invalid app id given');
143
-		}
144
-	}
145
-
146
-	/**
147
-	 * @param string $app
148
-	 * @param string $key
149
-	 * @param string $value
150
-	 * @throws \InvalidArgumentException
151
-	 */
152
-	protected function verifyConfigKey(string $app, string $key, string $value) {
153
-		if (in_array($key, ['installed_version', 'enabled', 'types'])) {
154
-			throw new \InvalidArgumentException('The given key can not be set');
155
-		}
156
-
157
-		if ($app === 'core' && $key === 'encryption_enabled' && $value !== 'yes') {
158
-			throw new \InvalidArgumentException('The given key can not be set');
159
-		}
160
-
161
-		if ($app === 'core' && (strpos($key, 'public_') === 0 || strpos($key, 'remote_') === 0)) {
162
-			throw new \InvalidArgumentException('The given key can not be set');
163
-		}
164
-	}
37
+    /** @var IConfig */
38
+    protected $config;
39
+
40
+    /** @var IAppConfig */
41
+    protected $appConfig;
42
+
43
+    /**
44
+     * @param string $appName
45
+     * @param IRequest $request
46
+     * @param IConfig $config
47
+     * @param IAppConfig $appConfig
48
+     */
49
+    public function __construct(string $appName,
50
+                                IRequest $request,
51
+                                IConfig $config,
52
+                                IAppConfig $appConfig) {
53
+        parent::__construct($appName, $request);
54
+        $this->config = $config;
55
+        $this->appConfig = $appConfig;
56
+    }
57
+
58
+    /**
59
+     * @return DataResponse
60
+     */
61
+    public function getApps(): DataResponse {
62
+        return new DataResponse([
63
+            'data' => $this->appConfig->getApps(),
64
+        ]);
65
+    }
66
+
67
+    /**
68
+     * @param string $app
69
+     * @return DataResponse
70
+     */
71
+    public function getKeys(string $app): DataResponse {
72
+        try {
73
+            $this->verifyAppId($app);
74
+        } catch (\InvalidArgumentException $e) {
75
+            return new DataResponse(['data' => ['message' => $e->getMessage()]], Http::STATUS_FORBIDDEN);
76
+        }
77
+        return new DataResponse([
78
+            'data' => $this->config->getAppKeys($app),
79
+        ]);
80
+    }
81
+
82
+    /**
83
+     * @param string $app
84
+     * @param string $key
85
+     * @param string $defaultValue
86
+     * @return DataResponse
87
+     */
88
+    public function getValue(string $app, string $key, string $defaultValue = ''): DataResponse {
89
+        try {
90
+            $this->verifyAppId($app);
91
+        } catch (\InvalidArgumentException $e) {
92
+            return new DataResponse(['data' => ['message' => $e->getMessage()]], Http::STATUS_FORBIDDEN);
93
+        }
94
+        return new DataResponse([
95
+            'data' => $this->config->getAppValue($app, $key, $defaultValue),
96
+        ]);
97
+    }
98
+
99
+    /**
100
+     * @PasswordConfirmationRequired
101
+     * @param string $app
102
+     * @param string $key
103
+     * @param string $value
104
+     * @return DataResponse
105
+     */
106
+    public function setValue(string $app, string $key, string $value): DataResponse {
107
+        try {
108
+            $this->verifyAppId($app);
109
+            $this->verifyConfigKey($app, $key, $value);
110
+        } catch (\InvalidArgumentException $e) {
111
+            return new DataResponse(['data' => ['message' => $e->getMessage()]], Http::STATUS_FORBIDDEN);
112
+        }
113
+
114
+        $this->config->setAppValue($app, $key, $value);
115
+        return new DataResponse();
116
+    }
117
+
118
+    /**
119
+     * @PasswordConfirmationRequired
120
+     * @param string $app
121
+     * @param string $key
122
+     * @return DataResponse
123
+     */
124
+    public function deleteKey(string $app, string $key): DataResponse {
125
+        try {
126
+            $this->verifyAppId($app);
127
+            $this->verifyConfigKey($app, $key, '');
128
+        } catch (\InvalidArgumentException $e) {
129
+            return new DataResponse(['data' => ['message' => $e->getMessage()]], Http::STATUS_FORBIDDEN);
130
+        }
131
+
132
+        $this->config->deleteAppValue($app, $key);
133
+        return new DataResponse();
134
+    }
135
+
136
+    /**
137
+     * @param string $app
138
+     * @throws \InvalidArgumentException
139
+     */
140
+    protected function verifyAppId(string $app) {
141
+        if (\OC_App::cleanAppId($app) !== $app) {
142
+            throw new \InvalidArgumentException('Invalid app id given');
143
+        }
144
+    }
145
+
146
+    /**
147
+     * @param string $app
148
+     * @param string $key
149
+     * @param string $value
150
+     * @throws \InvalidArgumentException
151
+     */
152
+    protected function verifyConfigKey(string $app, string $key, string $value) {
153
+        if (in_array($key, ['installed_version', 'enabled', 'types'])) {
154
+            throw new \InvalidArgumentException('The given key can not be set');
155
+        }
156
+
157
+        if ($app === 'core' && $key === 'encryption_enabled' && $value !== 'yes') {
158
+            throw new \InvalidArgumentException('The given key can not be set');
159
+        }
160
+
161
+        if ($app === 'core' && (strpos($key, 'public_') === 0 || strpos($key, 'remote_') === 0)) {
162
+            throw new \InvalidArgumentException('The given key can not be set');
163
+        }
164
+    }
165 165
 }
Please login to merge, or discard this patch.
lib/public/FullTextSearch/Model/ISearchRequest.php 1 patch
Indentation   +311 added lines, -311 removed lines patch added patch discarded remove patch
@@ -52,317 +52,317 @@
 block discarded – undo
52 52
 interface ISearchRequest {
53 53
 
54 54
 
55
-	/**
56
-	 * Get the maximum number of results to be returns by the Search Platform.
57
-	 *
58
-	 * @since 15.0.0
59
-	 *
60
-	 * @return int
61
-	 */
62
-	public function getSize(): int;
63
-
64
-
65
-	/**
66
-	 * Get the current page.
67
-	 * Used by pagination.
68
-	 *
69
-	 * @since 15.0.0
70
-	 *
71
-	 * @return int
72
-	 */
73
-	public function getPage(): int;
74
-
75
-
76
-	/**
77
-	 * Get the author of the request.
78
-	 *
79
-	 * @since 15.0.0
80
-	 *
81
-	 * @return string
82
-	 */
83
-	public function getAuthor(): string;
84
-
85
-	/**
86
-	 * Get the searched string.
87
-	 *
88
-	 * @since 15.0.0
89
-	 *
90
-	 * @return string
91
-	 */
92
-	public function getSearch(): string;
93
-
94
-	/**
95
-	 * Set the searched string.
96
-	 *
97
-	 * @param string $search
98
-	 *
99
-	 * @since 17.0.0
100
-	 *
101
-	 * @return ISearchRequest
102
-	 */
103
-	public function setSearch(string $search): ISearchRequest;
104
-
105
-	/**
106
-	 * Extends the searched string.
107
-	 *
108
-	 * @since 17.0.0
109
-	 *
110
-	 * @param string $search
111
-	 *
112
-	 * @return ISearchRequest
113
-	 */
114
-	public function addSearch(string $search): ISearchRequest;
115
-
116
-
117
-	/**
118
-	 * Get the value of an option (as string).
119
-	 *
120
-	 * @since 15.0.0
121
-	 *
122
-	 * @param string $option
123
-	 * @param string $default
124
-	 *
125
-	 * @return string
126
-	 */
127
-	public function getOption(string $option, string $default = ''): string;
128
-
129
-	/**
130
-	 * Get the value of an option (as array).
131
-	 *
132
-	 * @since 15.0.0
133
-	 *
134
-	 * @param string $option
135
-	 * @param array $default
136
-	 *
137
-	 * @return array
138
-	 */
139
-	public function getOptionArray(string $option, array $default = []): array;
140
-
141
-
142
-	/**
143
-	 * Limit the search to a part of the document.
144
-	 *
145
-	 * @since 15.0.0
146
-	 *
147
-	 * @param string $part
148
-	 *
149
-	 * @return ISearchRequest
150
-	 */
151
-	public function addPart(string $part): ISearchRequest;
152
-
153
-	/**
154
-	 * Limit the search to an array of parts of the document.
155
-	 *
156
-	 * @since 15.0.0
157
-	 *
158
-	 * @param array $parts
159
-	 *
160
-	 * @return ISearchRequest
161
-	 */
162
-	public function setParts(array $parts): ISearchRequest;
163
-
164
-	/**
165
-	 * Get the parts the search is limited to.
166
-	 *
167
-	 * @since 15.0.0
168
-	 *
169
-	 * @return array
170
-	 */
171
-	public function getParts(): array;
172
-
173
-
174
-	/**
175
-	 * Limit the search to a specific meta tag.
176
-	 *
177
-	 * @since 15.0.0
178
-	 *
179
-	 * @param string $tag
180
-	 *
181
-	 * @return ISearchRequest
182
-	 */
183
-	public function addMetaTag(string $tag): ISearchRequest;
184
-
185
-	/**
186
-	 * Get the meta tags the search is limited to.
187
-	 *
188
-	 * @since 15.0.0
189
-	 *
190
-	 * @return array
191
-	 */
192
-	public function getMetaTags(): array;
193
-
194
-	/**
195
-	 * Limit the search to an array of meta tags.
196
-	 *
197
-	 * @since 15.0.0
198
-	 *
199
-	 * @param array $tags
200
-	 *
201
-	 * @return ISearchRequest
202
-	 */
203
-	public function setMetaTags(array $tags): IsearchRequest;
204
-
205
-
206
-	/**
207
-	 * Limit the search to a specific sub tag.
208
-	 *
209
-	 * @since 15.0.0
210
-	 *
211
-	 * @param string $source
212
-	 * @param string $tag
213
-	 *
214
-	 * @return ISearchRequest
215
-	 */
216
-	public function addSubTag(string $source, string $tag): ISearchRequest;
217
-
218
-	/**
219
-	 * Get the sub tags the search is limited to.
220
-	 *
221
-	 * @since 15.0.0
222
-	 *
223
-	 * @param bool $formatted
224
-	 *
225
-	 * @return array
226
-	 */
227
-	public function getSubTags(bool $formatted): array;
228
-
229
-	/**
230
-	 * Limit the search to an array of sub tags.
231
-	 *
232
-	 * @since 15.0.0
233
-	 *
234
-	 * @param array $tags
235
-	 *
236
-	 * @return ISearchRequest
237
-	 */
238
-	public function setSubTags(array $tags): ISearchRequest;
239
-
240
-
241
-	/**
242
-	 * Limit the search to a specific field of the mapping, using a full string.
243
-	 *
244
-	 * @since 15.0.0
245
-	 *
246
-	 * @param string $field
247
-	 *
248
-	 * @return ISearchRequest
249
-	 */
250
-	public function addLimitField(string $field): ISearchRequest;
251
-
252
-	/**
253
-	 * Get the fields the search is limited to.
254
-	 *
255
-	 * @since 15.0.0
256
-	 *
257
-	 * @return array
258
-	 */
259
-	public function getLimitFields(): array;
260
-
261
-
262
-	/**
263
-	 * Limit the search to a specific field of the mapping, using a wildcard on
264
-	 * the search string.
265
-	 *
266
-	 * @since 15.0.0
267
-	 *
268
-	 * @param string $field
269
-	 *
270
-	 * @return ISearchRequest
271
-	 */
272
-	public function addWildcardField(string $field): ISearchRequest;
273
-
274
-	/**
275
-	 * Get the limit to field of the mapping.
276
-	 *
277
-	 * @since 15.0.0
278
-	 *
279
-	 * @return array
280
-	 */
281
-	public function getWildcardFields(): array;
282
-
283
-
284
-	/**
285
-	 * Filter the results, based on a group of field, using regex
286
-	 *
287
-	 * @since 15.0.0
288
-	 *
289
-	 * @param array $filters
290
-	 *
291
-	 * @return ISearchRequest
292
-	 */
293
-	public function addRegexFilters(array $filters): ISearchRequest;
294
-
295
-	/**
296
-	 * Get the regex filters the search is limit to.
297
-	 *
298
-	 * @since 15.0.0
299
-	 *
300
-	 * @return array
301
-	 */
302
-	public function getRegexFilters(): array;
303
-
304
-
305
-	/**
306
-	 * Filter the results, based on a group of field, using wildcard
307
-	 *
308
-	 * @since 15.0.0
309
-	 *
310
-	 * @param array $filter
311
-	 *
312
-	 * @return ISearchRequest
313
-	 */
314
-	public function addWildcardFilter(array $filter): ISearchRequest;
315
-
316
-	/**
317
-	 * Get the wildcard filters the search is limit to.
318
-	 *
319
-	 * @since 15.0.0
320
-	 *
321
-	 * @return array
322
-	 */
323
-	public function getWildcardFilters(): array;
324
-
325
-
326
-	/**
327
-	 * Add an extra field to the search.
328
-	 *
329
-	 * @since 15.0.0
330
-	 *
331
-	 * @param string $field
332
-	 *
333
-	 * @return ISearchRequest
334
-	 */
335
-	public function addField(string $field): ISearchRequest;
336
-
337
-	/**
338
-	 * Get the list of extra field to search into.
339
-	 *
340
-	 * @since 15.0.0
341
-	 *
342
-	 * @return array
343
-	 */
344
-	public function getFields(): array;
345
-
346
-
347
-
348
-	/**
349
-	 * Add a MUST search on an extra field
350
-	 *
351
-	 * @param ISearchRequestSimpleQuery $query
352
-	 *
353
-	 * @return ISearchRequest
354
-	 * @since 17.0.0
355
-	 */
356
-	public function addSimpleQuery(ISearchRequestSimpleQuery $query): ISearchRequest;
357
-
358
-
359
-	/**
360
-	 * Get the list of queries on extra field.
361
-	 *
362
-	 * @return ISearchRequestSimpleQuery[]
363
-	 * @since 17.0.0
364
-	 */
365
-	public function getSimpleQueries(): array;
55
+    /**
56
+     * Get the maximum number of results to be returns by the Search Platform.
57
+     *
58
+     * @since 15.0.0
59
+     *
60
+     * @return int
61
+     */
62
+    public function getSize(): int;
63
+
64
+
65
+    /**
66
+     * Get the current page.
67
+     * Used by pagination.
68
+     *
69
+     * @since 15.0.0
70
+     *
71
+     * @return int
72
+     */
73
+    public function getPage(): int;
74
+
75
+
76
+    /**
77
+     * Get the author of the request.
78
+     *
79
+     * @since 15.0.0
80
+     *
81
+     * @return string
82
+     */
83
+    public function getAuthor(): string;
84
+
85
+    /**
86
+     * Get the searched string.
87
+     *
88
+     * @since 15.0.0
89
+     *
90
+     * @return string
91
+     */
92
+    public function getSearch(): string;
93
+
94
+    /**
95
+     * Set the searched string.
96
+     *
97
+     * @param string $search
98
+     *
99
+     * @since 17.0.0
100
+     *
101
+     * @return ISearchRequest
102
+     */
103
+    public function setSearch(string $search): ISearchRequest;
104
+
105
+    /**
106
+     * Extends the searched string.
107
+     *
108
+     * @since 17.0.0
109
+     *
110
+     * @param string $search
111
+     *
112
+     * @return ISearchRequest
113
+     */
114
+    public function addSearch(string $search): ISearchRequest;
115
+
116
+
117
+    /**
118
+     * Get the value of an option (as string).
119
+     *
120
+     * @since 15.0.0
121
+     *
122
+     * @param string $option
123
+     * @param string $default
124
+     *
125
+     * @return string
126
+     */
127
+    public function getOption(string $option, string $default = ''): string;
128
+
129
+    /**
130
+     * Get the value of an option (as array).
131
+     *
132
+     * @since 15.0.0
133
+     *
134
+     * @param string $option
135
+     * @param array $default
136
+     *
137
+     * @return array
138
+     */
139
+    public function getOptionArray(string $option, array $default = []): array;
140
+
141
+
142
+    /**
143
+     * Limit the search to a part of the document.
144
+     *
145
+     * @since 15.0.0
146
+     *
147
+     * @param string $part
148
+     *
149
+     * @return ISearchRequest
150
+     */
151
+    public function addPart(string $part): ISearchRequest;
152
+
153
+    /**
154
+     * Limit the search to an array of parts of the document.
155
+     *
156
+     * @since 15.0.0
157
+     *
158
+     * @param array $parts
159
+     *
160
+     * @return ISearchRequest
161
+     */
162
+    public function setParts(array $parts): ISearchRequest;
163
+
164
+    /**
165
+     * Get the parts the search is limited to.
166
+     *
167
+     * @since 15.0.0
168
+     *
169
+     * @return array
170
+     */
171
+    public function getParts(): array;
172
+
173
+
174
+    /**
175
+     * Limit the search to a specific meta tag.
176
+     *
177
+     * @since 15.0.0
178
+     *
179
+     * @param string $tag
180
+     *
181
+     * @return ISearchRequest
182
+     */
183
+    public function addMetaTag(string $tag): ISearchRequest;
184
+
185
+    /**
186
+     * Get the meta tags the search is limited to.
187
+     *
188
+     * @since 15.0.0
189
+     *
190
+     * @return array
191
+     */
192
+    public function getMetaTags(): array;
193
+
194
+    /**
195
+     * Limit the search to an array of meta tags.
196
+     *
197
+     * @since 15.0.0
198
+     *
199
+     * @param array $tags
200
+     *
201
+     * @return ISearchRequest
202
+     */
203
+    public function setMetaTags(array $tags): IsearchRequest;
204
+
205
+
206
+    /**
207
+     * Limit the search to a specific sub tag.
208
+     *
209
+     * @since 15.0.0
210
+     *
211
+     * @param string $source
212
+     * @param string $tag
213
+     *
214
+     * @return ISearchRequest
215
+     */
216
+    public function addSubTag(string $source, string $tag): ISearchRequest;
217
+
218
+    /**
219
+     * Get the sub tags the search is limited to.
220
+     *
221
+     * @since 15.0.0
222
+     *
223
+     * @param bool $formatted
224
+     *
225
+     * @return array
226
+     */
227
+    public function getSubTags(bool $formatted): array;
228
+
229
+    /**
230
+     * Limit the search to an array of sub tags.
231
+     *
232
+     * @since 15.0.0
233
+     *
234
+     * @param array $tags
235
+     *
236
+     * @return ISearchRequest
237
+     */
238
+    public function setSubTags(array $tags): ISearchRequest;
239
+
240
+
241
+    /**
242
+     * Limit the search to a specific field of the mapping, using a full string.
243
+     *
244
+     * @since 15.0.0
245
+     *
246
+     * @param string $field
247
+     *
248
+     * @return ISearchRequest
249
+     */
250
+    public function addLimitField(string $field): ISearchRequest;
251
+
252
+    /**
253
+     * Get the fields the search is limited to.
254
+     *
255
+     * @since 15.0.0
256
+     *
257
+     * @return array
258
+     */
259
+    public function getLimitFields(): array;
260
+
261
+
262
+    /**
263
+     * Limit the search to a specific field of the mapping, using a wildcard on
264
+     * the search string.
265
+     *
266
+     * @since 15.0.0
267
+     *
268
+     * @param string $field
269
+     *
270
+     * @return ISearchRequest
271
+     */
272
+    public function addWildcardField(string $field): ISearchRequest;
273
+
274
+    /**
275
+     * Get the limit to field of the mapping.
276
+     *
277
+     * @since 15.0.0
278
+     *
279
+     * @return array
280
+     */
281
+    public function getWildcardFields(): array;
282
+
283
+
284
+    /**
285
+     * Filter the results, based on a group of field, using regex
286
+     *
287
+     * @since 15.0.0
288
+     *
289
+     * @param array $filters
290
+     *
291
+     * @return ISearchRequest
292
+     */
293
+    public function addRegexFilters(array $filters): ISearchRequest;
294
+
295
+    /**
296
+     * Get the regex filters the search is limit to.
297
+     *
298
+     * @since 15.0.0
299
+     *
300
+     * @return array
301
+     */
302
+    public function getRegexFilters(): array;
303
+
304
+
305
+    /**
306
+     * Filter the results, based on a group of field, using wildcard
307
+     *
308
+     * @since 15.0.0
309
+     *
310
+     * @param array $filter
311
+     *
312
+     * @return ISearchRequest
313
+     */
314
+    public function addWildcardFilter(array $filter): ISearchRequest;
315
+
316
+    /**
317
+     * Get the wildcard filters the search is limit to.
318
+     *
319
+     * @since 15.0.0
320
+     *
321
+     * @return array
322
+     */
323
+    public function getWildcardFilters(): array;
324
+
325
+
326
+    /**
327
+     * Add an extra field to the search.
328
+     *
329
+     * @since 15.0.0
330
+     *
331
+     * @param string $field
332
+     *
333
+     * @return ISearchRequest
334
+     */
335
+    public function addField(string $field): ISearchRequest;
336
+
337
+    /**
338
+     * Get the list of extra field to search into.
339
+     *
340
+     * @since 15.0.0
341
+     *
342
+     * @return array
343
+     */
344
+    public function getFields(): array;
345
+
346
+
347
+
348
+    /**
349
+     * Add a MUST search on an extra field
350
+     *
351
+     * @param ISearchRequestSimpleQuery $query
352
+     *
353
+     * @return ISearchRequest
354
+     * @since 17.0.0
355
+     */
356
+    public function addSimpleQuery(ISearchRequestSimpleQuery $query): ISearchRequest;
357
+
358
+
359
+    /**
360
+     * Get the list of queries on extra field.
361
+     *
362
+     * @return ISearchRequestSimpleQuery[]
363
+     * @since 17.0.0
364
+     */
365
+    public function getSimpleQueries(): array;
366 366
 
367 367
 }
368 368
 
Please login to merge, or discard this patch.
apps/updatenotification/lib/Notification/Notifier.php 1 patch
Indentation   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -39,161 +39,161 @@
 block discarded – undo
39 39
 
40 40
 class Notifier implements INotifier {
41 41
 
42
-	/** @var IURLGenerator */
43
-	protected $url;
44
-
45
-	/** @var IConfig */
46
-	protected $config;
47
-
48
-	/** @var IManager */
49
-	protected $notificationManager;
50
-
51
-	/** @var IFactory */
52
-	protected $l10NFactory;
53
-
54
-	/** @var IUserSession */
55
-	protected $userSession;
56
-
57
-	/** @var IGroupManager */
58
-	protected $groupManager;
59
-
60
-	/** @var string[] */
61
-	protected $appVersions;
62
-
63
-	/**
64
-	 * Notifier constructor.
65
-	 *
66
-	 * @param IURLGenerator $url
67
-	 * @param IConfig $config
68
-	 * @param IManager $notificationManager
69
-	 * @param IFactory $l10NFactory
70
-	 * @param IUserSession $userSession
71
-	 * @param IGroupManager $groupManager
72
-	 */
73
-	public function __construct(IURLGenerator $url, IConfig $config, IManager $notificationManager, IFactory $l10NFactory, IUserSession $userSession, IGroupManager $groupManager) {
74
-		$this->url = $url;
75
-		$this->notificationManager = $notificationManager;
76
-		$this->config = $config;
77
-		$this->l10NFactory = $l10NFactory;
78
-		$this->userSession = $userSession;
79
-		$this->groupManager = $groupManager;
80
-		$this->appVersions = $this->getAppVersions();
81
-	}
82
-
83
-	/**
84
-	 * Identifier of the notifier, only use [a-z0-9_]
85
-	 *
86
-	 * @return string
87
-	 * @since 17.0.0
88
-	 */
89
-	public function getID(): string {
90
-		return 'updatenotification';
91
-	}
92
-
93
-	/**
94
-	 * Human readable name describing the notifier
95
-	 *
96
-	 * @return string
97
-	 * @since 17.0.0
98
-	 */
99
-	public function getName(): string {
100
-		return $this->l10NFactory->get('updatenotification')->t('Update notifications');
101
-	}
102
-
103
-	/**
104
-	 * @param INotification $notification
105
-	 * @param string $languageCode The code of the language that should be used to prepare the notification
106
-	 * @return INotification
107
-	 * @throws \InvalidArgumentException When the notification was not prepared by a notifier
108
-	 * @throws AlreadyProcessedException When the notification is not needed anymore and should be deleted
109
-	 * @since 9.0.0
110
-	 */
111
-	public function prepare(INotification $notification, string $languageCode): INotification {
112
-		if ($notification->getApp() !== 'updatenotification') {
113
-			throw new \InvalidArgumentException('Unknown app id');
114
-		}
115
-
116
-		$l = $this->l10NFactory->get('updatenotification', $languageCode);
117
-		if ($notification->getSubject() === 'connection_error') {
118
-			$errors = (int) $this->config->getAppValue('updatenotification', 'update_check_errors', 0);
119
-			if ($errors === 0) {
120
-				$this->notificationManager->markProcessed($notification);
121
-				throw new \InvalidArgumentException('Update checked worked again');
122
-			}
123
-
124
-			$notification->setParsedSubject($l->t('The update server could not be reached since %d days to check for new updates.', [$errors]))
125
-				->setParsedMessage($l->t('Please check the Nextcloud and server log files for errors.'));
126
-		} elseif ($notification->getObjectType() === 'core') {
127
-			$this->updateAlreadyInstalledCheck($notification, $this->getCoreVersions());
128
-
129
-			$parameters = $notification->getSubjectParameters();
130
-			$notification->setParsedSubject($l->t('Update to %1$s is available.', [$parameters['version']]));
131
-
132
-			if ($this->isAdmin()) {
133
-				$notification->setLink($this->url->linkToRouteAbsolute('settings.AdminSettings.index', ['section' => 'overview']) . '#version');
134
-			}
135
-		} else {
136
-			$appInfo = $this->getAppInfo($notification->getObjectType());
137
-			$appName = ($appInfo === null) ? $notification->getObjectType() : $appInfo['name'];
138
-
139
-			if (isset($this->appVersions[$notification->getObjectType()])) {
140
-				$this->updateAlreadyInstalledCheck($notification, $this->appVersions[$notification->getObjectType()]);
141
-			}
142
-
143
-			$notification->setParsedSubject($l->t('Update for %1$s to version %2$s is available.', [$appName, $notification->getObjectId()]))
144
-				->setRichSubject($l->t('Update for {app} to version %s is available.', [$notification->getObjectId()]), [
145
-					'app' => [
146
-						'type' => 'app',
147
-						'id' => $notification->getObjectType(),
148
-						'name' => $appName,
149
-					]
150
-				]);
151
-
152
-			if ($this->isAdmin()) {
153
-				$notification->setLink($this->url->linkToRouteAbsolute('settings.AppSettings.viewApps', ['category' => 'updates']) . '#app-' . $notification->getObjectType());
154
-			}
155
-		}
156
-
157
-		$notification->setIcon($this->url->getAbsoluteURL($this->url->imagePath('updatenotification', 'notification.svg')));
158
-
159
-		return $notification;
160
-	}
161
-
162
-	/**
163
-	 * Remove the notification and prevent rendering, when the update is installed
164
-	 *
165
-	 * @param INotification $notification
166
-	 * @param string $installedVersion
167
-	 * @throws AlreadyProcessedException When the update is already installed
168
-	 */
169
-	protected function updateAlreadyInstalledCheck(INotification $notification, $installedVersion) {
170
-		if (version_compare($notification->getObjectId(), $installedVersion, '<=')) {
171
-			throw new AlreadyProcessedException();
172
-		}
173
-	}
174
-
175
-	/**
176
-	 * @return bool
177
-	 */
178
-	protected function isAdmin(): bool {
179
-		$user = $this->userSession->getUser();
180
-
181
-		if ($user instanceof IUser) {
182
-			return $this->groupManager->isAdmin($user->getUID());
183
-		}
184
-
185
-		return false;
186
-	}
187
-
188
-	protected function getCoreVersions(): string {
189
-		return implode('.', Util::getVersion());
190
-	}
191
-
192
-	protected function getAppVersions(): array {
193
-		return \OC_App::getAppVersions();
194
-	}
195
-
196
-	protected function getAppInfo($appId) {
197
-		return \OC_App::getAppInfo($appId);
198
-	}
42
+    /** @var IURLGenerator */
43
+    protected $url;
44
+
45
+    /** @var IConfig */
46
+    protected $config;
47
+
48
+    /** @var IManager */
49
+    protected $notificationManager;
50
+
51
+    /** @var IFactory */
52
+    protected $l10NFactory;
53
+
54
+    /** @var IUserSession */
55
+    protected $userSession;
56
+
57
+    /** @var IGroupManager */
58
+    protected $groupManager;
59
+
60
+    /** @var string[] */
61
+    protected $appVersions;
62
+
63
+    /**
64
+     * Notifier constructor.
65
+     *
66
+     * @param IURLGenerator $url
67
+     * @param IConfig $config
68
+     * @param IManager $notificationManager
69
+     * @param IFactory $l10NFactory
70
+     * @param IUserSession $userSession
71
+     * @param IGroupManager $groupManager
72
+     */
73
+    public function __construct(IURLGenerator $url, IConfig $config, IManager $notificationManager, IFactory $l10NFactory, IUserSession $userSession, IGroupManager $groupManager) {
74
+        $this->url = $url;
75
+        $this->notificationManager = $notificationManager;
76
+        $this->config = $config;
77
+        $this->l10NFactory = $l10NFactory;
78
+        $this->userSession = $userSession;
79
+        $this->groupManager = $groupManager;
80
+        $this->appVersions = $this->getAppVersions();
81
+    }
82
+
83
+    /**
84
+     * Identifier of the notifier, only use [a-z0-9_]
85
+     *
86
+     * @return string
87
+     * @since 17.0.0
88
+     */
89
+    public function getID(): string {
90
+        return 'updatenotification';
91
+    }
92
+
93
+    /**
94
+     * Human readable name describing the notifier
95
+     *
96
+     * @return string
97
+     * @since 17.0.0
98
+     */
99
+    public function getName(): string {
100
+        return $this->l10NFactory->get('updatenotification')->t('Update notifications');
101
+    }
102
+
103
+    /**
104
+     * @param INotification $notification
105
+     * @param string $languageCode The code of the language that should be used to prepare the notification
106
+     * @return INotification
107
+     * @throws \InvalidArgumentException When the notification was not prepared by a notifier
108
+     * @throws AlreadyProcessedException When the notification is not needed anymore and should be deleted
109
+     * @since 9.0.0
110
+     */
111
+    public function prepare(INotification $notification, string $languageCode): INotification {
112
+        if ($notification->getApp() !== 'updatenotification') {
113
+            throw new \InvalidArgumentException('Unknown app id');
114
+        }
115
+
116
+        $l = $this->l10NFactory->get('updatenotification', $languageCode);
117
+        if ($notification->getSubject() === 'connection_error') {
118
+            $errors = (int) $this->config->getAppValue('updatenotification', 'update_check_errors', 0);
119
+            if ($errors === 0) {
120
+                $this->notificationManager->markProcessed($notification);
121
+                throw new \InvalidArgumentException('Update checked worked again');
122
+            }
123
+
124
+            $notification->setParsedSubject($l->t('The update server could not be reached since %d days to check for new updates.', [$errors]))
125
+                ->setParsedMessage($l->t('Please check the Nextcloud and server log files for errors.'));
126
+        } elseif ($notification->getObjectType() === 'core') {
127
+            $this->updateAlreadyInstalledCheck($notification, $this->getCoreVersions());
128
+
129
+            $parameters = $notification->getSubjectParameters();
130
+            $notification->setParsedSubject($l->t('Update to %1$s is available.', [$parameters['version']]));
131
+
132
+            if ($this->isAdmin()) {
133
+                $notification->setLink($this->url->linkToRouteAbsolute('settings.AdminSettings.index', ['section' => 'overview']) . '#version');
134
+            }
135
+        } else {
136
+            $appInfo = $this->getAppInfo($notification->getObjectType());
137
+            $appName = ($appInfo === null) ? $notification->getObjectType() : $appInfo['name'];
138
+
139
+            if (isset($this->appVersions[$notification->getObjectType()])) {
140
+                $this->updateAlreadyInstalledCheck($notification, $this->appVersions[$notification->getObjectType()]);
141
+            }
142
+
143
+            $notification->setParsedSubject($l->t('Update for %1$s to version %2$s is available.', [$appName, $notification->getObjectId()]))
144
+                ->setRichSubject($l->t('Update for {app} to version %s is available.', [$notification->getObjectId()]), [
145
+                    'app' => [
146
+                        'type' => 'app',
147
+                        'id' => $notification->getObjectType(),
148
+                        'name' => $appName,
149
+                    ]
150
+                ]);
151
+
152
+            if ($this->isAdmin()) {
153
+                $notification->setLink($this->url->linkToRouteAbsolute('settings.AppSettings.viewApps', ['category' => 'updates']) . '#app-' . $notification->getObjectType());
154
+            }
155
+        }
156
+
157
+        $notification->setIcon($this->url->getAbsoluteURL($this->url->imagePath('updatenotification', 'notification.svg')));
158
+
159
+        return $notification;
160
+    }
161
+
162
+    /**
163
+     * Remove the notification and prevent rendering, when the update is installed
164
+     *
165
+     * @param INotification $notification
166
+     * @param string $installedVersion
167
+     * @throws AlreadyProcessedException When the update is already installed
168
+     */
169
+    protected function updateAlreadyInstalledCheck(INotification $notification, $installedVersion) {
170
+        if (version_compare($notification->getObjectId(), $installedVersion, '<=')) {
171
+            throw new AlreadyProcessedException();
172
+        }
173
+    }
174
+
175
+    /**
176
+     * @return bool
177
+     */
178
+    protected function isAdmin(): bool {
179
+        $user = $this->userSession->getUser();
180
+
181
+        if ($user instanceof IUser) {
182
+            return $this->groupManager->isAdmin($user->getUID());
183
+        }
184
+
185
+        return false;
186
+    }
187
+
188
+    protected function getCoreVersions(): string {
189
+        return implode('.', Util::getVersion());
190
+    }
191
+
192
+    protected function getAppVersions(): array {
193
+        return \OC_App::getAppVersions();
194
+    }
195
+
196
+    protected function getAppInfo($appId) {
197
+        return \OC_App::getAppInfo($appId);
198
+    }
199 199
 }
Please login to merge, or discard this patch.
lib/private/Authentication/Notifications/Notifier.php 1 patch
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -32,65 +32,65 @@
 block discarded – undo
32 32
 
33 33
 class Notifier implements INotifier {
34 34
 
35
-	/** @var IL10nFactory */
36
-	private $factory;
35
+    /** @var IL10nFactory */
36
+    private $factory;
37 37
 
38
-	public function __construct(IL10nFactory $l10nFactory) {
39
-		$this->factory = $l10nFactory;
40
-	}
38
+    public function __construct(IL10nFactory $l10nFactory) {
39
+        $this->factory = $l10nFactory;
40
+    }
41 41
 
42
-	/**
43
-	 * @inheritDoc
44
-	 */
45
-	public function prepare(INotification $notification, string $languageCode): INotification {
46
-		if ($notification->getApp() !== 'auth') {
47
-			// Not my app => throw
48
-			throw new InvalidArgumentException();
49
-		}
42
+    /**
43
+     * @inheritDoc
44
+     */
45
+    public function prepare(INotification $notification, string $languageCode): INotification {
46
+        if ($notification->getApp() !== 'auth') {
47
+            // Not my app => throw
48
+            throw new InvalidArgumentException();
49
+        }
50 50
 
51
-		// Read the language from the notification
52
-		$l = $this->factory->get('lib', $languageCode);
51
+        // Read the language from the notification
52
+        $l = $this->factory->get('lib', $languageCode);
53 53
 
54
-		switch ($notification->getSubject()) {
55
-			case 'remote_wipe_start':
56
-				$notification->setParsedSubject(
57
-					$l->t('Remote wipe started')
58
-				)->setParsedMessage(
59
-					$l->t('A remote wipe was started on device %s', $notification->getSubjectParameters())
60
-				);
54
+        switch ($notification->getSubject()) {
55
+            case 'remote_wipe_start':
56
+                $notification->setParsedSubject(
57
+                    $l->t('Remote wipe started')
58
+                )->setParsedMessage(
59
+                    $l->t('A remote wipe was started on device %s', $notification->getSubjectParameters())
60
+                );
61 61
 
62
-				return $notification;
63
-			case 'remote_wipe_finish':
64
-				$notification->setParsedSubject(
65
-					$l->t('Remote wipe finished')
66
-				)->setParsedMessage(
67
-					$l->t('The remote wipe on %s has finished', $notification->getSubjectParameters())
68
-				);
62
+                return $notification;
63
+            case 'remote_wipe_finish':
64
+                $notification->setParsedSubject(
65
+                    $l->t('Remote wipe finished')
66
+                )->setParsedMessage(
67
+                    $l->t('The remote wipe on %s has finished', $notification->getSubjectParameters())
68
+                );
69 69
 
70
-				return $notification;
71
-			default:
72
-				// Unknown subject => Unknown notification => throw
73
-				throw new InvalidArgumentException();
74
-		}
75
-	}
70
+                return $notification;
71
+            default:
72
+                // Unknown subject => Unknown notification => throw
73
+                throw new InvalidArgumentException();
74
+        }
75
+    }
76 76
 
77
-	/**
78
-	 * Identifier of the notifier, only use [a-z0-9_]
79
-	 *
80
-	 * @return string
81
-	 * @since 17.0.0
82
-	 */
83
-	public function getID(): string {
84
-		return 'auth';
85
-	}
77
+    /**
78
+     * Identifier of the notifier, only use [a-z0-9_]
79
+     *
80
+     * @return string
81
+     * @since 17.0.0
82
+     */
83
+    public function getID(): string {
84
+        return 'auth';
85
+    }
86 86
 
87
-	/**
88
-	 * Human readable name describing the notifier
89
-	 *
90
-	 * @return string
91
-	 * @since 17.0.0
92
-	 */
93
-	public function getName(): string {
94
-		return $this->factory->get('lib')->t('Authentication');
95
-	}
87
+    /**
88
+     * Human readable name describing the notifier
89
+     *
90
+     * @return string
91
+     * @since 17.0.0
92
+     */
93
+    public function getName(): string {
94
+        return $this->factory->get('lib')->t('Authentication');
95
+    }
96 96
 }
Please login to merge, or discard this patch.
lib/private/Notification/Action.php 1 patch
Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -28,146 +28,146 @@
 block discarded – undo
28 28
 
29 29
 class Action implements IAction {
30 30
 
31
-	/** @var string */
32
-	protected $label;
33
-
34
-	/** @var string */
35
-	protected $labelParsed;
36
-
37
-	/** @var string */
38
-	protected $link;
39
-
40
-	/** @var string */
41
-	protected $requestType;
42
-
43
-	/** @var string */
44
-	protected $icon;
45
-
46
-	/** @var bool */
47
-	protected $primary;
48
-
49
-	public function __construct() {
50
-		$this->label = '';
51
-		$this->labelParsed = '';
52
-		$this->link = '';
53
-		$this->requestType = '';
54
-		$this->primary = false;
55
-	}
56
-
57
-	/**
58
-	 * @param string $label
59
-	 * @return $this
60
-	 * @throws \InvalidArgumentException if the label is invalid
61
-	 * @since 8.2.0
62
-	 */
63
-	public function setLabel(string $label): IAction {
64
-		if ($label === '' || isset($label[32])) {
65
-			throw new \InvalidArgumentException('The given label is invalid');
66
-		}
67
-		$this->label = $label;
68
-		return $this;
69
-	}
70
-
71
-	/**
72
-	 * @return string
73
-	 * @since 8.2.0
74
-	 */
75
-	public function getLabel(): string {
76
-		return $this->label;
77
-	}
78
-
79
-	/**
80
-	 * @param string $label
81
-	 * @return $this
82
-	 * @throws \InvalidArgumentException if the label is invalid
83
-	 * @since 8.2.0
84
-	 */
85
-	public function setParsedLabel(string $label): IAction {
86
-		if ($label === '') {
87
-			throw new \InvalidArgumentException('The given parsed label is invalid');
88
-		}
89
-		$this->labelParsed = $label;
90
-		return $this;
91
-	}
92
-
93
-	/**
94
-	 * @return string
95
-	 * @since 8.2.0
96
-	 */
97
-	public function getParsedLabel(): string {
98
-		return $this->labelParsed;
99
-	}
100
-
101
-	/**
102
-	 * @param $primary bool
103
-	 * @return $this
104
-	 * @since 9.0.0
105
-	 */
106
-	public function setPrimary(bool $primary): IAction {
107
-		$this->primary = $primary;
108
-		return $this;
109
-	}
110
-
111
-	/**
112
-	 * @return bool
113
-	 * @since 9.0.0
114
-	 */
115
-	public function isPrimary(): bool {
116
-		return $this->primary;
117
-	}
118
-
119
-	/**
120
-	 * @param string $link
121
-	 * @param string $requestType
122
-	 * @return $this
123
-	 * @throws \InvalidArgumentException if the link is invalid
124
-	 * @since 8.2.0
125
-	 */
126
-	public function setLink(string $link, string $requestType): IAction {
127
-		if ($link === '' || isset($link[256])) {
128
-			throw new \InvalidArgumentException('The given link is invalid');
129
-		}
130
-		if (!in_array($requestType, [
131
-			self::TYPE_GET,
132
-			self::TYPE_POST,
133
-			self::TYPE_PUT,
134
-			self::TYPE_DELETE,
135
-			self::TYPE_WEB,
136
-		], true)) {
137
-			throw new \InvalidArgumentException('The given request type is invalid');
138
-		}
139
-		$this->link = $link;
140
-		$this->requestType = $requestType;
141
-		return $this;
142
-	}
143
-
144
-	/**
145
-	 * @return string
146
-	 * @since 8.2.0
147
-	 */
148
-	public function getLink(): string {
149
-		return $this->link;
150
-	}
151
-
152
-	/**
153
-	 * @return string
154
-	 * @since 8.2.0
155
-	 */
156
-	public function getRequestType(): string {
157
-		return $this->requestType;
158
-	}
159
-
160
-	/**
161
-	 * @return bool
162
-	 */
163
-	public function isValid(): bool {
164
-		return $this->label !== '' && $this->link !== '';
165
-	}
166
-
167
-	/**
168
-	 * @return bool
169
-	 */
170
-	public function isValidParsed(): bool {
171
-		return $this->labelParsed !== '' && $this->link !== '';
172
-	}
31
+    /** @var string */
32
+    protected $label;
33
+
34
+    /** @var string */
35
+    protected $labelParsed;
36
+
37
+    /** @var string */
38
+    protected $link;
39
+
40
+    /** @var string */
41
+    protected $requestType;
42
+
43
+    /** @var string */
44
+    protected $icon;
45
+
46
+    /** @var bool */
47
+    protected $primary;
48
+
49
+    public function __construct() {
50
+        $this->label = '';
51
+        $this->labelParsed = '';
52
+        $this->link = '';
53
+        $this->requestType = '';
54
+        $this->primary = false;
55
+    }
56
+
57
+    /**
58
+     * @param string $label
59
+     * @return $this
60
+     * @throws \InvalidArgumentException if the label is invalid
61
+     * @since 8.2.0
62
+     */
63
+    public function setLabel(string $label): IAction {
64
+        if ($label === '' || isset($label[32])) {
65
+            throw new \InvalidArgumentException('The given label is invalid');
66
+        }
67
+        $this->label = $label;
68
+        return $this;
69
+    }
70
+
71
+    /**
72
+     * @return string
73
+     * @since 8.2.0
74
+     */
75
+    public function getLabel(): string {
76
+        return $this->label;
77
+    }
78
+
79
+    /**
80
+     * @param string $label
81
+     * @return $this
82
+     * @throws \InvalidArgumentException if the label is invalid
83
+     * @since 8.2.0
84
+     */
85
+    public function setParsedLabel(string $label): IAction {
86
+        if ($label === '') {
87
+            throw new \InvalidArgumentException('The given parsed label is invalid');
88
+        }
89
+        $this->labelParsed = $label;
90
+        return $this;
91
+    }
92
+
93
+    /**
94
+     * @return string
95
+     * @since 8.2.0
96
+     */
97
+    public function getParsedLabel(): string {
98
+        return $this->labelParsed;
99
+    }
100
+
101
+    /**
102
+     * @param $primary bool
103
+     * @return $this
104
+     * @since 9.0.0
105
+     */
106
+    public function setPrimary(bool $primary): IAction {
107
+        $this->primary = $primary;
108
+        return $this;
109
+    }
110
+
111
+    /**
112
+     * @return bool
113
+     * @since 9.0.0
114
+     */
115
+    public function isPrimary(): bool {
116
+        return $this->primary;
117
+    }
118
+
119
+    /**
120
+     * @param string $link
121
+     * @param string $requestType
122
+     * @return $this
123
+     * @throws \InvalidArgumentException if the link is invalid
124
+     * @since 8.2.0
125
+     */
126
+    public function setLink(string $link, string $requestType): IAction {
127
+        if ($link === '' || isset($link[256])) {
128
+            throw new \InvalidArgumentException('The given link is invalid');
129
+        }
130
+        if (!in_array($requestType, [
131
+            self::TYPE_GET,
132
+            self::TYPE_POST,
133
+            self::TYPE_PUT,
134
+            self::TYPE_DELETE,
135
+            self::TYPE_WEB,
136
+        ], true)) {
137
+            throw new \InvalidArgumentException('The given request type is invalid');
138
+        }
139
+        $this->link = $link;
140
+        $this->requestType = $requestType;
141
+        return $this;
142
+    }
143
+
144
+    /**
145
+     * @return string
146
+     * @since 8.2.0
147
+     */
148
+    public function getLink(): string {
149
+        return $this->link;
150
+    }
151
+
152
+    /**
153
+     * @return string
154
+     * @since 8.2.0
155
+     */
156
+    public function getRequestType(): string {
157
+        return $this->requestType;
158
+    }
159
+
160
+    /**
161
+     * @return bool
162
+     */
163
+    public function isValid(): bool {
164
+        return $this->label !== '' && $this->link !== '';
165
+    }
166
+
167
+    /**
168
+     * @return bool
169
+     */
170
+    public function isValidParsed(): bool {
171
+        return $this->labelParsed !== '' && $this->link !== '';
172
+    }
173 173
 }
Please login to merge, or discard this patch.