Passed
Push — master ( 4a52d9...223a91 )
by Morris
11:47 queued 10s
created
lib/private/Notification/Action.php 1 patch
Indentation   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -27,148 +27,148 @@
 block discarded – undo
27 27
 
28 28
 class Action implements IAction {
29 29
 
30
-	/** @var string */
31
-	protected $label;
32
-
33
-	/** @var string */
34
-	protected $labelParsed;
35
-
36
-	/** @var string */
37
-	protected $link;
38
-
39
-	/** @var string */
40
-	protected $requestType;
41
-
42
-	/** @var string */
43
-	protected $icon;
44
-
45
-	/** @var bool */
46
-	protected $primary;
47
-
48
-	/**
49
-	 * Constructor
50
-	 */
51
-	public function __construct() {
52
-		$this->label = '';
53
-		$this->labelParsed = '';
54
-		$this->link = '';
55
-		$this->requestType = '';
56
-		$this->primary = false;
57
-	}
58
-
59
-	/**
60
-	 * @param string $label
61
-	 * @return $this
62
-	 * @throws \InvalidArgumentException if the label is invalid
63
-	 * @since 8.2.0
64
-	 */
65
-	public function setLabel($label) {
66
-		if (!is_string($label) || $label === '' || isset($label[32])) {
67
-			throw new \InvalidArgumentException('The given label is invalid');
68
-		}
69
-		$this->label = $label;
70
-		return $this;
71
-	}
72
-
73
-	/**
74
-	 * @return string
75
-	 * @since 8.2.0
76
-	 */
77
-	public function getLabel() {
78
-		return $this->label;
79
-	}
80
-
81
-	/**
82
-	 * @param string $label
83
-	 * @return $this
84
-	 * @throws \InvalidArgumentException if the label is invalid
85
-	 * @since 8.2.0
86
-	 */
87
-	public function setParsedLabel($label) {
88
-		if (!is_string($label) || $label === '') {
89
-			throw new \InvalidArgumentException('The given parsed label is invalid');
90
-		}
91
-		$this->labelParsed = $label;
92
-		return $this;
93
-	}
94
-
95
-	/**
96
-	 * @return string
97
-	 * @since 8.2.0
98
-	 */
99
-	public function getParsedLabel() {
100
-		return $this->labelParsed;
101
-	}
102
-
103
-	/**
104
-	 * @param $primary bool
105
-	 * @return $this
106
-	 * @throws \InvalidArgumentException if $primary is invalid
107
-	 * @since 9.0.0
108
-	 */
109
-	public function setPrimary($primary) {
110
-		if (!is_bool($primary)) {
111
-			throw new \InvalidArgumentException('The given primary option is invalid');
112
-		}
113
-
114
-		$this->primary = $primary;
115
-		return $this;
116
-	}
117
-
118
-	/**
119
-	 * @return bool
120
-	 * @since 9.0.0
121
-	 */
122
-	public function isPrimary() {
123
-		return $this->primary;
124
-	}
125
-
126
-	/**
127
-	 * @param string $link
128
-	 * @param string $requestType
129
-	 * @return $this
130
-	 * @throws \InvalidArgumentException if the link is invalid
131
-	 * @since 8.2.0
132
-	 */
133
-	public function setLink($link, $requestType) {
134
-		if (!is_string($link) || $link === '' || isset($link[256])) {
135
-			throw new \InvalidArgumentException('The given link is invalid');
136
-		}
137
-		if (!in_array($requestType, ['GET', 'POST', 'PUT', 'DELETE'], true)) {
138
-			throw new \InvalidArgumentException('The given request type is invalid');
139
-		}
140
-		$this->link = $link;
141
-		$this->requestType = $requestType;
142
-		return $this;
143
-	}
144
-
145
-	/**
146
-	 * @return string
147
-	 * @since 8.2.0
148
-	 */
149
-	public function getLink() {
150
-		return $this->link;
151
-	}
152
-
153
-	/**
154
-	 * @return string
155
-	 * @since 8.2.0
156
-	 */
157
-	public function getRequestType() {
158
-		return $this->requestType;
159
-	}
160
-
161
-	/**
162
-	 * @return bool
163
-	 */
164
-	public function isValid() {
165
-		return $this->label !== '' && $this->link !== '';
166
-	}
167
-
168
-	/**
169
-	 * @return bool
170
-	 */
171
-	public function isValidParsed() {
172
-		return $this->labelParsed !== '' && $this->link !== '';
173
-	}
30
+    /** @var string */
31
+    protected $label;
32
+
33
+    /** @var string */
34
+    protected $labelParsed;
35
+
36
+    /** @var string */
37
+    protected $link;
38
+
39
+    /** @var string */
40
+    protected $requestType;
41
+
42
+    /** @var string */
43
+    protected $icon;
44
+
45
+    /** @var bool */
46
+    protected $primary;
47
+
48
+    /**
49
+     * Constructor
50
+     */
51
+    public function __construct() {
52
+        $this->label = '';
53
+        $this->labelParsed = '';
54
+        $this->link = '';
55
+        $this->requestType = '';
56
+        $this->primary = false;
57
+    }
58
+
59
+    /**
60
+     * @param string $label
61
+     * @return $this
62
+     * @throws \InvalidArgumentException if the label is invalid
63
+     * @since 8.2.0
64
+     */
65
+    public function setLabel($label) {
66
+        if (!is_string($label) || $label === '' || isset($label[32])) {
67
+            throw new \InvalidArgumentException('The given label is invalid');
68
+        }
69
+        $this->label = $label;
70
+        return $this;
71
+    }
72
+
73
+    /**
74
+     * @return string
75
+     * @since 8.2.0
76
+     */
77
+    public function getLabel() {
78
+        return $this->label;
79
+    }
80
+
81
+    /**
82
+     * @param string $label
83
+     * @return $this
84
+     * @throws \InvalidArgumentException if the label is invalid
85
+     * @since 8.2.0
86
+     */
87
+    public function setParsedLabel($label) {
88
+        if (!is_string($label) || $label === '') {
89
+            throw new \InvalidArgumentException('The given parsed label is invalid');
90
+        }
91
+        $this->labelParsed = $label;
92
+        return $this;
93
+    }
94
+
95
+    /**
96
+     * @return string
97
+     * @since 8.2.0
98
+     */
99
+    public function getParsedLabel() {
100
+        return $this->labelParsed;
101
+    }
102
+
103
+    /**
104
+     * @param $primary bool
105
+     * @return $this
106
+     * @throws \InvalidArgumentException if $primary is invalid
107
+     * @since 9.0.0
108
+     */
109
+    public function setPrimary($primary) {
110
+        if (!is_bool($primary)) {
111
+            throw new \InvalidArgumentException('The given primary option is invalid');
112
+        }
113
+
114
+        $this->primary = $primary;
115
+        return $this;
116
+    }
117
+
118
+    /**
119
+     * @return bool
120
+     * @since 9.0.0
121
+     */
122
+    public function isPrimary() {
123
+        return $this->primary;
124
+    }
125
+
126
+    /**
127
+     * @param string $link
128
+     * @param string $requestType
129
+     * @return $this
130
+     * @throws \InvalidArgumentException if the link is invalid
131
+     * @since 8.2.0
132
+     */
133
+    public function setLink($link, $requestType) {
134
+        if (!is_string($link) || $link === '' || isset($link[256])) {
135
+            throw new \InvalidArgumentException('The given link is invalid');
136
+        }
137
+        if (!in_array($requestType, ['GET', 'POST', 'PUT', 'DELETE'], true)) {
138
+            throw new \InvalidArgumentException('The given request type is invalid');
139
+        }
140
+        $this->link = $link;
141
+        $this->requestType = $requestType;
142
+        return $this;
143
+    }
144
+
145
+    /**
146
+     * @return string
147
+     * @since 8.2.0
148
+     */
149
+    public function getLink() {
150
+        return $this->link;
151
+    }
152
+
153
+    /**
154
+     * @return string
155
+     * @since 8.2.0
156
+     */
157
+    public function getRequestType() {
158
+        return $this->requestType;
159
+    }
160
+
161
+    /**
162
+     * @return bool
163
+     */
164
+    public function isValid() {
165
+        return $this->label !== '' && $this->link !== '';
166
+    }
167
+
168
+    /**
169
+     * @return bool
170
+     */
171
+    public function isValidParsed() {
172
+        return $this->labelParsed !== '' && $this->link !== '';
173
+    }
174 174
 }
Please login to merge, or discard this patch.
lib/private/Notification/Manager.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@
 block discarded – undo
146 146
 				throw new \InvalidArgumentException('The given notifier information is invalid');
147 147
 			}
148 148
 			if (isset($this->notifiersInfo[$notifier['id']])) {
149
-				throw new \InvalidArgumentException('The given notifier ID ' . $notifier['id'] . ' is already in use');
149
+				throw new \InvalidArgumentException('The given notifier ID '.$notifier['id'].' is already in use');
150 150
 			}
151 151
 			$this->notifiersInfo[$notifier['id']] = $notifier['name'];
152 152
 		}
Please login to merge, or discard this patch.
Indentation   +233 added lines, -233 removed lines patch added patch discarded remove patch
@@ -32,237 +32,237 @@
 block discarded – undo
32 32
 use OCP\RichObjectStrings\IValidator;
33 33
 
34 34
 class Manager implements IManager {
35
-	/** @var IValidator */
36
-	protected $validator;
37
-
38
-	/** @var IApp[] */
39
-	protected $apps;
40
-
41
-	/** @var INotifier[] */
42
-	protected $notifiers;
43
-
44
-	/** @var array[] */
45
-	protected $notifiersInfo;
46
-
47
-	/** @var \Closure[] */
48
-	protected $appsClosures;
49
-
50
-	/** @var \Closure[] */
51
-	protected $notifiersClosures;
52
-
53
-	/** @var \Closure[] */
54
-	protected $notifiersInfoClosures;
55
-
56
-	/** @var bool */
57
-	protected $preparingPushNotification;
58
-
59
-	/**
60
-	 * Manager constructor.
61
-	 *
62
-	 * @param IValidator $validator
63
-	 */
64
-	public function __construct(IValidator $validator) {
65
-		$this->validator = $validator;
66
-		$this->apps = [];
67
-		$this->notifiers = [];
68
-		$this->notifiersInfo = [];
69
-		$this->appsClosures = [];
70
-		$this->notifiersClosures = [];
71
-		$this->notifiersInfoClosures = [];
72
-		$this->preparingPushNotification = false;
73
-	}
74
-
75
-	/**
76
-	 * @param \Closure $service The service must implement IApp, otherwise a
77
-	 *                          \InvalidArgumentException is thrown later
78
-	 * @since 8.2.0
79
-	 */
80
-	public function registerApp(\Closure $service) {
81
-		$this->appsClosures[] = $service;
82
-		$this->apps = [];
83
-	}
84
-
85
-	/**
86
-	 * @param \Closure $service The service must implement INotifier, otherwise a
87
-	 *                          \InvalidArgumentException is thrown later
88
-	 * @param \Closure $info    An array with the keys 'id' and 'name' containing
89
-	 *                          the app id and the app name
90
-	 * @since 8.2.0 - Parameter $info was added in 9.0.0
91
-	 */
92
-	public function registerNotifier(\Closure $service, \Closure $info) {
93
-		$this->notifiersClosures[] = $service;
94
-		$this->notifiersInfoClosures[] = $info;
95
-		$this->notifiers = [];
96
-		$this->notifiersInfo = [];
97
-	}
98
-
99
-	/**
100
-	 * @return IApp[]
101
-	 */
102
-	protected function getApps(): array {
103
-		if (!empty($this->apps)) {
104
-			return $this->apps;
105
-		}
106
-
107
-		$this->apps = [];
108
-		foreach ($this->appsClosures as $closure) {
109
-			$app = $closure();
110
-			if (!($app instanceof IApp)) {
111
-				throw new \InvalidArgumentException('The given notification app does not implement the IApp interface');
112
-			}
113
-			$this->apps[] = $app;
114
-		}
115
-
116
-		return $this->apps;
117
-	}
118
-
119
-	/**
120
-	 * @return INotifier[]
121
-	 */
122
-	protected function getNotifiers(): array {
123
-		if (!empty($this->notifiers)) {
124
-			return $this->notifiers;
125
-		}
126
-
127
-		$this->notifiers = [];
128
-		foreach ($this->notifiersClosures as $closure) {
129
-			$notifier = $closure();
130
-			if (!($notifier instanceof INotifier)) {
131
-				throw new \InvalidArgumentException('The given notifier does not implement the INotifier interface');
132
-			}
133
-			$this->notifiers[] = $notifier;
134
-		}
135
-
136
-		return $this->notifiers;
137
-	}
138
-
139
-	/**
140
-	 * @return array[]
141
-	 */
142
-	public function listNotifiers(): array {
143
-		if (!empty($this->notifiersInfo)) {
144
-			return $this->notifiersInfo;
145
-		}
146
-
147
-		$this->notifiersInfo = [];
148
-		foreach ($this->notifiersInfoClosures as $closure) {
149
-			$notifier = $closure();
150
-			if (!\is_array($notifier) || \count($notifier) !== 2 || !isset($notifier['id'], $notifier['name'])) {
151
-				throw new \InvalidArgumentException('The given notifier information is invalid');
152
-			}
153
-			if (isset($this->notifiersInfo[$notifier['id']])) {
154
-				throw new \InvalidArgumentException('The given notifier ID ' . $notifier['id'] . ' is already in use');
155
-			}
156
-			$this->notifiersInfo[$notifier['id']] = $notifier['name'];
157
-		}
158
-
159
-		return $this->notifiersInfo;
160
-	}
161
-
162
-	/**
163
-	 * @return INotification
164
-	 * @since 8.2.0
165
-	 */
166
-	public function createNotification(): INotification {
167
-		return new Notification($this->validator);
168
-	}
169
-
170
-	/**
171
-	 * @return bool
172
-	 * @since 8.2.0
173
-	 */
174
-	public function hasNotifiers(): bool {
175
-		return !empty($this->notifiersClosures);
176
-	}
177
-
178
-	/**
179
-	 * @param bool $preparingPushNotification
180
-	 * @since 14.0.0
181
-	 */
182
-	public function setPreparingPushNotification($preparingPushNotification) {
183
-		$this->preparingPushNotification = $preparingPushNotification;
184
-	}
185
-
186
-	/**
187
-	 * @return bool
188
-	 * @since 14.0.0
189
-	 */
190
-	public function isPreparingPushNotification(): bool {
191
-		return $this->preparingPushNotification;
192
-	}
193
-
194
-	/**
195
-	 * @param INotification $notification
196
-	 * @throws \InvalidArgumentException When the notification is not valid
197
-	 * @since 8.2.0
198
-	 */
199
-	public function notify(INotification $notification) {
200
-		if (!$notification->isValid()) {
201
-			throw new \InvalidArgumentException('The given notification is invalid');
202
-		}
203
-
204
-		$apps = $this->getApps();
205
-
206
-		foreach ($apps as $app) {
207
-			try {
208
-				$app->notify($notification);
209
-			} catch (\InvalidArgumentException $e) {
210
-			}
211
-		}
212
-	}
213
-
214
-	/**
215
-	 * @param INotification $notification
216
-	 * @param string $languageCode The code of the language that should be used to prepare the notification
217
-	 * @return INotification
218
-	 * @throws \InvalidArgumentException When the notification was not prepared by a notifier
219
-	 * @since 8.2.0
220
-	 */
221
-	public function prepare(INotification $notification, $languageCode): INotification {
222
-		$notifiers = $this->getNotifiers();
223
-
224
-		foreach ($notifiers as $notifier) {
225
-			try {
226
-				$notification = $notifier->prepare($notification, $languageCode);
227
-			} catch (\InvalidArgumentException $e) {
228
-				continue;
229
-			}
230
-
231
-			if (!($notification instanceof INotification) || !$notification->isValidParsed()) {
232
-				throw new \InvalidArgumentException('The given notification has not been handled');
233
-			}
234
-		}
235
-
236
-		if (!($notification instanceof INotification) || !$notification->isValidParsed()) {
237
-			throw new \InvalidArgumentException('The given notification has not been handled');
238
-		}
239
-
240
-		return $notification;
241
-	}
242
-
243
-	/**
244
-	 * @param INotification $notification
245
-	 */
246
-	public function markProcessed(INotification $notification) {
247
-		$apps = $this->getApps();
248
-
249
-		foreach ($apps as $app) {
250
-			$app->markProcessed($notification);
251
-		}
252
-	}
253
-
254
-	/**
255
-	 * @param INotification $notification
256
-	 * @return int
257
-	 */
258
-	public function getCount(INotification $notification): int {
259
-		$apps = $this->getApps();
260
-
261
-		$count = 0;
262
-		foreach ($apps as $app) {
263
-			$count += $app->getCount($notification);
264
-		}
265
-
266
-		return $count;
267
-	}
35
+    /** @var IValidator */
36
+    protected $validator;
37
+
38
+    /** @var IApp[] */
39
+    protected $apps;
40
+
41
+    /** @var INotifier[] */
42
+    protected $notifiers;
43
+
44
+    /** @var array[] */
45
+    protected $notifiersInfo;
46
+
47
+    /** @var \Closure[] */
48
+    protected $appsClosures;
49
+
50
+    /** @var \Closure[] */
51
+    protected $notifiersClosures;
52
+
53
+    /** @var \Closure[] */
54
+    protected $notifiersInfoClosures;
55
+
56
+    /** @var bool */
57
+    protected $preparingPushNotification;
58
+
59
+    /**
60
+     * Manager constructor.
61
+     *
62
+     * @param IValidator $validator
63
+     */
64
+    public function __construct(IValidator $validator) {
65
+        $this->validator = $validator;
66
+        $this->apps = [];
67
+        $this->notifiers = [];
68
+        $this->notifiersInfo = [];
69
+        $this->appsClosures = [];
70
+        $this->notifiersClosures = [];
71
+        $this->notifiersInfoClosures = [];
72
+        $this->preparingPushNotification = false;
73
+    }
74
+
75
+    /**
76
+     * @param \Closure $service The service must implement IApp, otherwise a
77
+     *                          \InvalidArgumentException is thrown later
78
+     * @since 8.2.0
79
+     */
80
+    public function registerApp(\Closure $service) {
81
+        $this->appsClosures[] = $service;
82
+        $this->apps = [];
83
+    }
84
+
85
+    /**
86
+     * @param \Closure $service The service must implement INotifier, otherwise a
87
+     *                          \InvalidArgumentException is thrown later
88
+     * @param \Closure $info    An array with the keys 'id' and 'name' containing
89
+     *                          the app id and the app name
90
+     * @since 8.2.0 - Parameter $info was added in 9.0.0
91
+     */
92
+    public function registerNotifier(\Closure $service, \Closure $info) {
93
+        $this->notifiersClosures[] = $service;
94
+        $this->notifiersInfoClosures[] = $info;
95
+        $this->notifiers = [];
96
+        $this->notifiersInfo = [];
97
+    }
98
+
99
+    /**
100
+     * @return IApp[]
101
+     */
102
+    protected function getApps(): array {
103
+        if (!empty($this->apps)) {
104
+            return $this->apps;
105
+        }
106
+
107
+        $this->apps = [];
108
+        foreach ($this->appsClosures as $closure) {
109
+            $app = $closure();
110
+            if (!($app instanceof IApp)) {
111
+                throw new \InvalidArgumentException('The given notification app does not implement the IApp interface');
112
+            }
113
+            $this->apps[] = $app;
114
+        }
115
+
116
+        return $this->apps;
117
+    }
118
+
119
+    /**
120
+     * @return INotifier[]
121
+     */
122
+    protected function getNotifiers(): array {
123
+        if (!empty($this->notifiers)) {
124
+            return $this->notifiers;
125
+        }
126
+
127
+        $this->notifiers = [];
128
+        foreach ($this->notifiersClosures as $closure) {
129
+            $notifier = $closure();
130
+            if (!($notifier instanceof INotifier)) {
131
+                throw new \InvalidArgumentException('The given notifier does not implement the INotifier interface');
132
+            }
133
+            $this->notifiers[] = $notifier;
134
+        }
135
+
136
+        return $this->notifiers;
137
+    }
138
+
139
+    /**
140
+     * @return array[]
141
+     */
142
+    public function listNotifiers(): array {
143
+        if (!empty($this->notifiersInfo)) {
144
+            return $this->notifiersInfo;
145
+        }
146
+
147
+        $this->notifiersInfo = [];
148
+        foreach ($this->notifiersInfoClosures as $closure) {
149
+            $notifier = $closure();
150
+            if (!\is_array($notifier) || \count($notifier) !== 2 || !isset($notifier['id'], $notifier['name'])) {
151
+                throw new \InvalidArgumentException('The given notifier information is invalid');
152
+            }
153
+            if (isset($this->notifiersInfo[$notifier['id']])) {
154
+                throw new \InvalidArgumentException('The given notifier ID ' . $notifier['id'] . ' is already in use');
155
+            }
156
+            $this->notifiersInfo[$notifier['id']] = $notifier['name'];
157
+        }
158
+
159
+        return $this->notifiersInfo;
160
+    }
161
+
162
+    /**
163
+     * @return INotification
164
+     * @since 8.2.0
165
+     */
166
+    public function createNotification(): INotification {
167
+        return new Notification($this->validator);
168
+    }
169
+
170
+    /**
171
+     * @return bool
172
+     * @since 8.2.0
173
+     */
174
+    public function hasNotifiers(): bool {
175
+        return !empty($this->notifiersClosures);
176
+    }
177
+
178
+    /**
179
+     * @param bool $preparingPushNotification
180
+     * @since 14.0.0
181
+     */
182
+    public function setPreparingPushNotification($preparingPushNotification) {
183
+        $this->preparingPushNotification = $preparingPushNotification;
184
+    }
185
+
186
+    /**
187
+     * @return bool
188
+     * @since 14.0.0
189
+     */
190
+    public function isPreparingPushNotification(): bool {
191
+        return $this->preparingPushNotification;
192
+    }
193
+
194
+    /**
195
+     * @param INotification $notification
196
+     * @throws \InvalidArgumentException When the notification is not valid
197
+     * @since 8.2.0
198
+     */
199
+    public function notify(INotification $notification) {
200
+        if (!$notification->isValid()) {
201
+            throw new \InvalidArgumentException('The given notification is invalid');
202
+        }
203
+
204
+        $apps = $this->getApps();
205
+
206
+        foreach ($apps as $app) {
207
+            try {
208
+                $app->notify($notification);
209
+            } catch (\InvalidArgumentException $e) {
210
+            }
211
+        }
212
+    }
213
+
214
+    /**
215
+     * @param INotification $notification
216
+     * @param string $languageCode The code of the language that should be used to prepare the notification
217
+     * @return INotification
218
+     * @throws \InvalidArgumentException When the notification was not prepared by a notifier
219
+     * @since 8.2.0
220
+     */
221
+    public function prepare(INotification $notification, $languageCode): INotification {
222
+        $notifiers = $this->getNotifiers();
223
+
224
+        foreach ($notifiers as $notifier) {
225
+            try {
226
+                $notification = $notifier->prepare($notification, $languageCode);
227
+            } catch (\InvalidArgumentException $e) {
228
+                continue;
229
+            }
230
+
231
+            if (!($notification instanceof INotification) || !$notification->isValidParsed()) {
232
+                throw new \InvalidArgumentException('The given notification has not been handled');
233
+            }
234
+        }
235
+
236
+        if (!($notification instanceof INotification) || !$notification->isValidParsed()) {
237
+            throw new \InvalidArgumentException('The given notification has not been handled');
238
+        }
239
+
240
+        return $notification;
241
+    }
242
+
243
+    /**
244
+     * @param INotification $notification
245
+     */
246
+    public function markProcessed(INotification $notification) {
247
+        $apps = $this->getApps();
248
+
249
+        foreach ($apps as $app) {
250
+            $app->markProcessed($notification);
251
+        }
252
+    }
253
+
254
+    /**
255
+     * @param INotification $notification
256
+     * @return int
257
+     */
258
+    public function getCount(INotification $notification): int {
259
+        $apps = $this->getApps();
260
+
261
+        $count = 0;
262
+        foreach ($apps as $app) {
263
+            $count += $app->getCount($notification);
264
+        }
265
+
266
+        return $count;
267
+    }
268 268
 }
Please login to merge, or discard this patch.
lib/private/IntegrityCheck/Iterator/ExcludeFoldersByPathFilterIterator.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -30,25 +30,25 @@
 block discarded – undo
30 30
 		parent::__construct($iterator);
31 31
 
32 32
 		$appFolders = \OC::$APPSROOTS;
33
-		foreach($appFolders as $key => $appFolder) {
33
+		foreach ($appFolders as $key => $appFolder) {
34 34
 			$appFolders[$key] = rtrim($appFolder['path'], '/');
35 35
 		}
36 36
 
37 37
 		$excludedFolders = [
38
-			rtrim($root . '/data', '/'),
39
-			rtrim($root . '/themes', '/'),
40
-			rtrim($root . '/config', '/'),
41
-			rtrim($root . '/apps', '/'),
42
-			rtrim($root . '/assets', '/'),
43
-			rtrim($root . '/lost+found', '/'),
38
+			rtrim($root.'/data', '/'),
39
+			rtrim($root.'/themes', '/'),
40
+			rtrim($root.'/config', '/'),
41
+			rtrim($root.'/apps', '/'),
42
+			rtrim($root.'/assets', '/'),
43
+			rtrim($root.'/lost+found', '/'),
44 44
 			// Ignore folders generated by updater since the updater is replaced
45 45
 			// after the integrity check is run.
46 46
 			// See https://github.com/owncloud/updater/issues/318#issuecomment-212497846
47
-			rtrim($root . '/updater', '/'),
48
-			rtrim($root . '/_oc_upgrade', '/'),
47
+			rtrim($root.'/updater', '/'),
48
+			rtrim($root.'/_oc_upgrade', '/'),
49 49
 		];
50 50
 		$customDataDir = \OC::$server->getConfig()->getSystemValue('datadirectory', '');
51
-		if($customDataDir !== '') {
51
+		if ($customDataDir !== '') {
52 52
 			$excludedFolders[] = rtrim($customDataDir, '/');
53 53
 		}
54 54
 
Please login to merge, or discard this patch.
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -25,45 +25,45 @@
 block discarded – undo
25 25
 namespace OC\IntegrityCheck\Iterator;
26 26
 
27 27
 class ExcludeFoldersByPathFilterIterator extends \RecursiveFilterIterator {
28
-	private $excludedFolders;
28
+    private $excludedFolders;
29 29
 
30
-	public function __construct(\RecursiveIterator $iterator, $root = '') {
31
-		parent::__construct($iterator);
30
+    public function __construct(\RecursiveIterator $iterator, $root = '') {
31
+        parent::__construct($iterator);
32 32
 
33
-		$appFolders = \OC::$APPSROOTS;
34
-		foreach($appFolders as $key => $appFolder) {
35
-			$appFolders[$key] = rtrim($appFolder['path'], '/');
36
-		}
33
+        $appFolders = \OC::$APPSROOTS;
34
+        foreach($appFolders as $key => $appFolder) {
35
+            $appFolders[$key] = rtrim($appFolder['path'], '/');
36
+        }
37 37
 
38
-		$excludedFolders = [
39
-			rtrim($root . '/data', '/'),
40
-			rtrim($root . '/themes', '/'),
41
-			rtrim($root . '/config', '/'),
42
-			rtrim($root . '/apps', '/'),
43
-			rtrim($root . '/assets', '/'),
44
-			rtrim($root . '/lost+found', '/'),
45
-			// Ignore folders generated by updater since the updater is replaced
46
-			// after the integrity check is run.
47
-			// See https://github.com/owncloud/updater/issues/318#issuecomment-212497846
48
-			rtrim($root . '/updater', '/'),
49
-			rtrim($root . '/_oc_upgrade', '/'),
50
-		];
51
-		$customDataDir = \OC::$server->getConfig()->getSystemValue('datadirectory', '');
52
-		if($customDataDir !== '') {
53
-			$excludedFolders[] = rtrim($customDataDir, '/');
54
-		}
38
+        $excludedFolders = [
39
+            rtrim($root . '/data', '/'),
40
+            rtrim($root . '/themes', '/'),
41
+            rtrim($root . '/config', '/'),
42
+            rtrim($root . '/apps', '/'),
43
+            rtrim($root . '/assets', '/'),
44
+            rtrim($root . '/lost+found', '/'),
45
+            // Ignore folders generated by updater since the updater is replaced
46
+            // after the integrity check is run.
47
+            // See https://github.com/owncloud/updater/issues/318#issuecomment-212497846
48
+            rtrim($root . '/updater', '/'),
49
+            rtrim($root . '/_oc_upgrade', '/'),
50
+        ];
51
+        $customDataDir = \OC::$server->getConfig()->getSystemValue('datadirectory', '');
52
+        if($customDataDir !== '') {
53
+            $excludedFolders[] = rtrim($customDataDir, '/');
54
+        }
55 55
 
56
-		$this->excludedFolders = array_merge($excludedFolders, $appFolders);
57
-	}
56
+        $this->excludedFolders = array_merge($excludedFolders, $appFolders);
57
+    }
58 58
 
59
-	/**
60
-	 * @return bool
61
-	 */
62
-	public function accept() {
63
-		return !\in_array(
64
-			$this->current()->getPathName(),
65
-			$this->excludedFolders,
66
-			true
67
-		);
68
-	}
59
+    /**
60
+     * @return bool
61
+     */
62
+    public function accept() {
63
+        return !\in_array(
64
+            $this->current()->getPathName(),
65
+            $this->excludedFolders,
66
+            true
67
+        );
68
+    }
69 69
 }
Please login to merge, or discard this patch.
lib/private/HintException.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -35,46 +35,46 @@
 block discarded – undo
35 35
  */
36 36
 class HintException extends \Exception {
37 37
 
38
-	private $hint;
38
+    private $hint;
39 39
 
40
-	/**
41
-	 * HintException constructor.
42
-	 *
43
-	 * @param string $message  The error message. It will be not revealed to the
44
-	 *                         the user (unless the hint is empty) and thus
45
-	 *                         should be not translated.
46
-	 * @param string $hint     A useful message that is presented to the end
47
-	 *                         user. It should be translated, but must not
48
-	 *                         contain sensitive data.
49
-	 * @param int $code
50
-	 * @param \Exception|null $previous
51
-	 */
52
-	public function __construct($message, $hint = '', $code = 0, \Exception $previous = null) {
53
-		$this->hint = $hint;
54
-		parent::__construct($message, $code, $previous);
55
-	}
40
+    /**
41
+     * HintException constructor.
42
+     *
43
+     * @param string $message  The error message. It will be not revealed to the
44
+     *                         the user (unless the hint is empty) and thus
45
+     *                         should be not translated.
46
+     * @param string $hint     A useful message that is presented to the end
47
+     *                         user. It should be translated, but must not
48
+     *                         contain sensitive data.
49
+     * @param int $code
50
+     * @param \Exception|null $previous
51
+     */
52
+    public function __construct($message, $hint = '', $code = 0, \Exception $previous = null) {
53
+        $this->hint = $hint;
54
+        parent::__construct($message, $code, $previous);
55
+    }
56 56
 
57
-	/**
58
-	 * Returns a string representation of this Exception that includes the error
59
-	 * code, the message and the hint.
60
-	 *
61
-	 * @return string
62
-	 */
63
-	public function __toString() {
64
-		return __CLASS__ . ": [{$this->code}]: {$this->message} ({$this->hint})\n";
65
-	}
57
+    /**
58
+     * Returns a string representation of this Exception that includes the error
59
+     * code, the message and the hint.
60
+     *
61
+     * @return string
62
+     */
63
+    public function __toString() {
64
+        return __CLASS__ . ": [{$this->code}]: {$this->message} ({$this->hint})\n";
65
+    }
66 66
 
67
-	/**
68
-	 * Returns the hint with the intention to be presented to the end user. If
69
-	 * an empty hint was specified upon instatiation, the message is returned
70
-	 * instead.
71
-	 *
72
-	 * @return string
73
-	 */
74
-	public function getHint() {
75
-		if (empty($this->hint)) {
76
-			return $this->message;
77
-		}
78
-		return $this->hint;
79
-	}
67
+    /**
68
+     * Returns the hint with the intention to be presented to the end user. If
69
+     * an empty hint was specified upon instatiation, the message is returned
70
+     * instead.
71
+     *
72
+     * @return string
73
+     */
74
+    public function getHint() {
75
+        if (empty($this->hint)) {
76
+            return $this->message;
77
+        }
78
+        return $this->hint;
79
+    }
80 80
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
 	 * @return string
62 62
 	 */
63 63
 	public function __toString() {
64
-		return __CLASS__ . ": [{$this->code}]: {$this->message} ({$this->hint})\n";
64
+		return __CLASS__.": [{$this->code}]: {$this->message} ({$this->hint})\n";
65 65
 	}
66 66
 
67 67
 	/**
Please login to merge, or discard this patch.
lib/private/User/Backend.php 2 patches
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -29,136 +29,136 @@
 block discarded – undo
29 29
  * capabilities.
30 30
  */
31 31
 abstract class Backend implements UserInterface {
32
-	/**
33
-	 * error code for functions not provided by the user backend
34
-	 */
35
-	const NOT_IMPLEMENTED = -501;
32
+    /**
33
+     * error code for functions not provided by the user backend
34
+     */
35
+    const NOT_IMPLEMENTED = -501;
36 36
 
37
-	/**
38
-	 * actions that user backends can define
39
-	 */
40
-	const CREATE_USER		= 1;			// 1 << 0
41
-	const SET_PASSWORD		= 16;			// 1 << 4
42
-	const CHECK_PASSWORD	= 256;			// 1 << 8
43
-	const GET_HOME			= 4096;			// 1 << 12
44
-	const GET_DISPLAYNAME	= 65536;		// 1 << 16
45
-	const SET_DISPLAYNAME	= 1048576;		// 1 << 20
46
-	const PROVIDE_AVATAR	= 16777216;		// 1 << 24
47
-	const COUNT_USERS		= 268435456;	// 1 << 28
37
+    /**
38
+     * actions that user backends can define
39
+     */
40
+    const CREATE_USER		= 1;			// 1 << 0
41
+    const SET_PASSWORD		= 16;			// 1 << 4
42
+    const CHECK_PASSWORD	= 256;			// 1 << 8
43
+    const GET_HOME			= 4096;			// 1 << 12
44
+    const GET_DISPLAYNAME	= 65536;		// 1 << 16
45
+    const SET_DISPLAYNAME	= 1048576;		// 1 << 20
46
+    const PROVIDE_AVATAR	= 16777216;		// 1 << 24
47
+    const COUNT_USERS		= 268435456;	// 1 << 28
48 48
 
49
-	protected $possibleActions = array(
50
-		self::CREATE_USER => 'createUser',
51
-		self::SET_PASSWORD => 'setPassword',
52
-		self::CHECK_PASSWORD => 'checkPassword',
53
-		self::GET_HOME => 'getHome',
54
-		self::GET_DISPLAYNAME => 'getDisplayName',
55
-		self::SET_DISPLAYNAME => 'setDisplayName',
56
-		self::PROVIDE_AVATAR => 'canChangeAvatar',
57
-		self::COUNT_USERS => 'countUsers',
58
-	);
49
+    protected $possibleActions = array(
50
+        self::CREATE_USER => 'createUser',
51
+        self::SET_PASSWORD => 'setPassword',
52
+        self::CHECK_PASSWORD => 'checkPassword',
53
+        self::GET_HOME => 'getHome',
54
+        self::GET_DISPLAYNAME => 'getDisplayName',
55
+        self::SET_DISPLAYNAME => 'setDisplayName',
56
+        self::PROVIDE_AVATAR => 'canChangeAvatar',
57
+        self::COUNT_USERS => 'countUsers',
58
+    );
59 59
 
60
-	/**
61
-	* Get all supported actions
62
-	* @return int bitwise-or'ed actions
63
-	*
64
-	* Returns the supported actions as int to be
65
-	* compared with self::CREATE_USER etc.
66
-	*/
67
-	public function getSupportedActions() {
68
-		$actions = 0;
69
-		foreach($this->possibleActions AS $action => $methodName) {
70
-			if(method_exists($this, $methodName)) {
71
-				$actions |= $action;
72
-			}
73
-		}
60
+    /**
61
+     * Get all supported actions
62
+     * @return int bitwise-or'ed actions
63
+     *
64
+     * Returns the supported actions as int to be
65
+     * compared with self::CREATE_USER etc.
66
+     */
67
+    public function getSupportedActions() {
68
+        $actions = 0;
69
+        foreach($this->possibleActions AS $action => $methodName) {
70
+            if(method_exists($this, $methodName)) {
71
+                $actions |= $action;
72
+            }
73
+        }
74 74
 
75
-		return $actions;
76
-	}
75
+        return $actions;
76
+    }
77 77
 
78
-	/**
79
-	* Check if backend implements actions
80
-	* @param int $actions bitwise-or'ed actions
81
-	* @return boolean
82
-	*
83
-	* Returns the supported actions as int to be
84
-	* compared with self::CREATE_USER etc.
85
-	*/
86
-	public function implementsActions($actions) {
87
-		return (bool)($this->getSupportedActions() & $actions);
88
-	}
78
+    /**
79
+     * Check if backend implements actions
80
+     * @param int $actions bitwise-or'ed actions
81
+     * @return boolean
82
+     *
83
+     * Returns the supported actions as int to be
84
+     * compared with self::CREATE_USER etc.
85
+     */
86
+    public function implementsActions($actions) {
87
+        return (bool)($this->getSupportedActions() & $actions);
88
+    }
89 89
 
90
-	/**
91
-	 * delete a user
92
-	 * @param string $uid The username of the user to delete
93
-	 * @return bool
94
-	 *
95
-	 * Deletes a user
96
-	 */
97
-	public function deleteUser( $uid ) {
98
-		return false;
99
-	}
90
+    /**
91
+     * delete a user
92
+     * @param string $uid The username of the user to delete
93
+     * @return bool
94
+     *
95
+     * Deletes a user
96
+     */
97
+    public function deleteUser( $uid ) {
98
+        return false;
99
+    }
100 100
 
101
-	/**
102
-	 * Get a list of all users
103
-	 *
104
-	 * @param string $search
105
-	 * @param null|int $limit
106
-	 * @param null|int $offset
107
-	 * @return string[] an array of all uids
108
-	 */
109
-	public function getUsers($search = '', $limit = null, $offset = null) {
110
-		return array();
111
-	}
101
+    /**
102
+     * Get a list of all users
103
+     *
104
+     * @param string $search
105
+     * @param null|int $limit
106
+     * @param null|int $offset
107
+     * @return string[] an array of all uids
108
+     */
109
+    public function getUsers($search = '', $limit = null, $offset = null) {
110
+        return array();
111
+    }
112 112
 
113
-	/**
114
-	* check if a user exists
115
-	* @param string $uid the username
116
-	* @return boolean
117
-	*/
118
-	public function userExists($uid) {
119
-		return false;
120
-	}
113
+    /**
114
+     * check if a user exists
115
+     * @param string $uid the username
116
+     * @return boolean
117
+     */
118
+    public function userExists($uid) {
119
+        return false;
120
+    }
121 121
 
122
-	/**
123
-	* get the user's home directory
124
-	* @param string $uid the username
125
-	* @return boolean
126
-	*/
127
-	public function getHome($uid) {
128
-		return false;
129
-	}
122
+    /**
123
+     * get the user's home directory
124
+     * @param string $uid the username
125
+     * @return boolean
126
+     */
127
+    public function getHome($uid) {
128
+        return false;
129
+    }
130 130
 
131
-	/**
132
-	 * get display name of the user
133
-	 * @param string $uid user ID of the user
134
-	 * @return string display name
135
-	 */
136
-	public function getDisplayName($uid) {
137
-		return $uid;
138
-	}
131
+    /**
132
+     * get display name of the user
133
+     * @param string $uid user ID of the user
134
+     * @return string display name
135
+     */
136
+    public function getDisplayName($uid) {
137
+        return $uid;
138
+    }
139 139
 
140
-	/**
141
-	 * Get a list of all display names and user ids.
142
-	 *
143
-	 * @param string $search
144
-	 * @param string|null $limit
145
-	 * @param string|null $offset
146
-	 * @return array an array of all displayNames (value) and the corresponding uids (key)
147
-	 */
148
-	public function getDisplayNames($search = '', $limit = null, $offset = null) {
149
-		$displayNames = array();
150
-		$users = $this->getUsers($search, $limit, $offset);
151
-		foreach ( $users as $user) {
152
-			$displayNames[$user] = $user;
153
-		}
154
-		return $displayNames;
155
-	}
140
+    /**
141
+     * Get a list of all display names and user ids.
142
+     *
143
+     * @param string $search
144
+     * @param string|null $limit
145
+     * @param string|null $offset
146
+     * @return array an array of all displayNames (value) and the corresponding uids (key)
147
+     */
148
+    public function getDisplayNames($search = '', $limit = null, $offset = null) {
149
+        $displayNames = array();
150
+        $users = $this->getUsers($search, $limit, $offset);
151
+        foreach ( $users as $user) {
152
+            $displayNames[$user] = $user;
153
+        }
154
+        return $displayNames;
155
+    }
156 156
 
157
-	/**
158
-	 * Check if a user list is available or not
159
-	 * @return boolean if users can be listed or not
160
-	 */
161
-	public function hasUserListings() {
162
-		return false;
163
-	}
157
+    /**
158
+     * Check if a user list is available or not
159
+     * @return boolean if users can be listed or not
160
+     */
161
+    public function hasUserListings() {
162
+        return false;
163
+    }
164 164
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
 	/**
38 38
 	 * actions that user backends can define
39 39
 	 */
40
-	const CREATE_USER		= 1;			// 1 << 0
41
-	const SET_PASSWORD		= 16;			// 1 << 4
42
-	const CHECK_PASSWORD	= 256;			// 1 << 8
43
-	const GET_HOME			= 4096;			// 1 << 12
44
-	const GET_DISPLAYNAME	= 65536;		// 1 << 16
45
-	const SET_DISPLAYNAME	= 1048576;		// 1 << 20
46
-	const PROVIDE_AVATAR	= 16777216;		// 1 << 24
47
-	const COUNT_USERS		= 268435456;	// 1 << 28
40
+	const CREATE_USER = 1; // 1 << 0
41
+	const SET_PASSWORD = 16; // 1 << 4
42
+	const CHECK_PASSWORD = 256; // 1 << 8
43
+	const GET_HOME = 4096; // 1 << 12
44
+	const GET_DISPLAYNAME	= 65536; // 1 << 16
45
+	const SET_DISPLAYNAME	= 1048576; // 1 << 20
46
+	const PROVIDE_AVATAR = 16777216; // 1 << 24
47
+	const COUNT_USERS = 268435456; // 1 << 28
48 48
 
49 49
 	protected $possibleActions = array(
50 50
 		self::CREATE_USER => 'createUser',
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 	*/
67 67
 	public function getSupportedActions() {
68 68
 		$actions = 0;
69
-		foreach($this->possibleActions AS $action => $methodName) {
70
-			if(method_exists($this, $methodName)) {
69
+		foreach ($this->possibleActions AS $action => $methodName) {
70
+			if (method_exists($this, $methodName)) {
71 71
 				$actions |= $action;
72 72
 			}
73 73
 		}
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	* compared with self::CREATE_USER etc.
85 85
 	*/
86 86
 	public function implementsActions($actions) {
87
-		return (bool)($this->getSupportedActions() & $actions);
87
+		return (bool) ($this->getSupportedActions() & $actions);
88 88
 	}
89 89
 
90 90
 	/**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 *
95 95
 	 * Deletes a user
96 96
 	 */
97
-	public function deleteUser( $uid ) {
97
+	public function deleteUser($uid) {
98 98
 		return false;
99 99
 	}
100 100
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	public function getDisplayNames($search = '', $limit = null, $offset = null) {
149 149
 		$displayNames = array();
150 150
 		$users = $this->getUsers($search, $limit, $offset);
151
-		foreach ( $users as $user) {
151
+		foreach ($users as $user) {
152 152
 			$displayNames[$user] = $user;
153 153
 		}
154 154
 		return $displayNames;
Please login to merge, or discard this patch.
lib/private/Diagnostics/Event.php 1 patch
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -26,79 +26,79 @@
 block discarded – undo
26 26
 use OCP\Diagnostics\IEvent;
27 27
 
28 28
 class Event implements IEvent {
29
-	/**
30
-	 * @var string
31
-	 */
32
-	protected $id;
29
+    /**
30
+     * @var string
31
+     */
32
+    protected $id;
33 33
 
34
-	/**
35
-	 * @var float
36
-	 */
37
-	protected $start;
34
+    /**
35
+     * @var float
36
+     */
37
+    protected $start;
38 38
 
39
-	/**
40
-	 * @var float
41
-	 */
42
-	protected $end;
39
+    /**
40
+     * @var float
41
+     */
42
+    protected $end;
43 43
 
44
-	/**
45
-	 * @var string
46
-	 */
47
-	protected $description;
44
+    /**
45
+     * @var string
46
+     */
47
+    protected $description;
48 48
 
49
-	/**
50
-	 * @param string $id
51
-	 * @param string $description
52
-	 * @param float $start
53
-	 */
54
-	public function __construct($id, $description, $start) {
55
-		$this->id = $id;
56
-		$this->description = $description;
57
-		$this->start = $start;
58
-	}
49
+    /**
50
+     * @param string $id
51
+     * @param string $description
52
+     * @param float $start
53
+     */
54
+    public function __construct($id, $description, $start) {
55
+        $this->id = $id;
56
+        $this->description = $description;
57
+        $this->start = $start;
58
+    }
59 59
 
60
-	/**
61
-	 * @param float $time
62
-	 */
63
-	public function end($time) {
64
-		$this->end = $time;
65
-	}
60
+    /**
61
+     * @param float $time
62
+     */
63
+    public function end($time) {
64
+        $this->end = $time;
65
+    }
66 66
 
67
-	/**
68
-	 * @return float
69
-	 */
70
-	public function getStart() {
71
-		return $this->start;
72
-	}
67
+    /**
68
+     * @return float
69
+     */
70
+    public function getStart() {
71
+        return $this->start;
72
+    }
73 73
 
74
-	/**
75
-	 * @return string
76
-	 */
77
-	public function getId() {
78
-		return $this->id;
79
-	}
74
+    /**
75
+     * @return string
76
+     */
77
+    public function getId() {
78
+        return $this->id;
79
+    }
80 80
 
81
-	/**
82
-	 * @return string
83
-	 */
84
-	public function getDescription() {
85
-		return $this->description;
86
-	}
81
+    /**
82
+     * @return string
83
+     */
84
+    public function getDescription() {
85
+        return $this->description;
86
+    }
87 87
 
88
-	/**
89
-	 * @return float
90
-	 */
91
-	public function getEnd() {
92
-		return $this->end;
93
-	}
88
+    /**
89
+     * @return float
90
+     */
91
+    public function getEnd() {
92
+        return $this->end;
93
+    }
94 94
 
95
-	/**
96
-	 * @return float
97
-	 */
98
-	public function getDuration() {
99
-		if (!$this->end) {
100
-			$this->end = microtime(true);
101
-		}
102
-		return $this->end - $this->start;
103
-	}
95
+    /**
96
+     * @return float
97
+     */
98
+    public function getDuration() {
99
+        if (!$this->end) {
100
+            $this->end = microtime(true);
101
+        }
102
+        return $this->end - $this->start;
103
+    }
104 104
 }
Please login to merge, or discard this patch.
lib/private/Tagging/TagMapper.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
 	* @return array An array of Tag objects.
51 51
 	*/
52 52
 	public function loadTags($owners, $type) {
53
-		if(!is_array($owners)) {
53
+		if (!is_array($owners)) {
54 54
 			$owners = array($owners);
55 55
 		}
56 56
 
57
-		$sql = 'SELECT `id`, `uid`, `type`, `category` FROM `' . $this->getTableName() . '` '
58
-			. 'WHERE `uid` IN (' . str_repeat('?,', count($owners)-1) . '?) AND `type` = ? ORDER BY `category`';
57
+		$sql = 'SELECT `id`, `uid`, `type`, `category` FROM `'.$this->getTableName().'` '
58
+			. 'WHERE `uid` IN ('.str_repeat('?,', count($owners) - 1).'?) AND `type` = ? ORDER BY `category`';
59 59
 		return $this->findEntities($sql, array_merge($owners, array($type)));
60 60
 	}
61 61
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	* @return bool
67 67
 	*/
68 68
 	public function tagExists($tag) {
69
-		$sql = 'SELECT `id`, `uid`, `type`, `category` FROM `' . $this->getTableName() . '` '
69
+		$sql = 'SELECT `id`, `uid`, `type`, `category` FROM `'.$this->getTableName().'` '
70 70
 			. 'WHERE `uid` = ? AND `type` = ? AND `category` = ?';
71 71
 		try {
72 72
 			$this->findEntity($sql, array($tag->getOwner(), $tag->getType(), $tag->getName()));
Please login to merge, or discard this patch.
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -33,47 +33,47 @@
 block discarded – undo
33 33
  */
34 34
 class TagMapper extends Mapper {
35 35
 
36
-	/**
37
-	* Constructor.
38
-	*
39
-	* @param IDBConnection $db Instance of the Db abstraction layer.
40
-	*/
41
-	public function __construct(IDBConnection $db) {
42
-		parent::__construct($db, 'vcategory', Tag::class);
43
-	}
36
+    /**
37
+     * Constructor.
38
+     *
39
+     * @param IDBConnection $db Instance of the Db abstraction layer.
40
+     */
41
+    public function __construct(IDBConnection $db) {
42
+        parent::__construct($db, 'vcategory', Tag::class);
43
+    }
44 44
 
45
-	/**
46
-	* Load tags from the database.
47
-	*
48
-	* @param array|string $owners The user(s) whose tags we are going to load.
49
-	* @param string $type The type of item for which we are loading tags.
50
-	* @return array An array of Tag objects.
51
-	*/
52
-	public function loadTags($owners, $type) {
53
-		if(!is_array($owners)) {
54
-			$owners = array($owners);
55
-		}
45
+    /**
46
+     * Load tags from the database.
47
+     *
48
+     * @param array|string $owners The user(s) whose tags we are going to load.
49
+     * @param string $type The type of item for which we are loading tags.
50
+     * @return array An array of Tag objects.
51
+     */
52
+    public function loadTags($owners, $type) {
53
+        if(!is_array($owners)) {
54
+            $owners = array($owners);
55
+        }
56 56
 
57
-		$sql = 'SELECT `id`, `uid`, `type`, `category` FROM `' . $this->getTableName() . '` '
58
-			. 'WHERE `uid` IN (' . str_repeat('?,', count($owners)-1) . '?) AND `type` = ? ORDER BY `category`';
59
-		return $this->findEntities($sql, array_merge($owners, array($type)));
60
-	}
57
+        $sql = 'SELECT `id`, `uid`, `type`, `category` FROM `' . $this->getTableName() . '` '
58
+            . 'WHERE `uid` IN (' . str_repeat('?,', count($owners)-1) . '?) AND `type` = ? ORDER BY `category`';
59
+        return $this->findEntities($sql, array_merge($owners, array($type)));
60
+    }
61 61
 
62
-	/**
63
-	* Check if a given Tag object already exists in the database.
64
-	*
65
-	* @param Tag $tag The tag to look for in the database.
66
-	* @return bool
67
-	*/
68
-	public function tagExists($tag) {
69
-		$sql = 'SELECT `id`, `uid`, `type`, `category` FROM `' . $this->getTableName() . '` '
70
-			. 'WHERE `uid` = ? AND `type` = ? AND `category` = ?';
71
-		try {
72
-			$this->findEntity($sql, array($tag->getOwner(), $tag->getType(), $tag->getName()));
73
-		} catch (DoesNotExistException $e) {
74
-			return false;
75
-		}
76
-		return true;
77
-	}
62
+    /**
63
+     * Check if a given Tag object already exists in the database.
64
+     *
65
+     * @param Tag $tag The tag to look for in the database.
66
+     * @return bool
67
+     */
68
+    public function tagExists($tag) {
69
+        $sql = 'SELECT `id`, `uid`, `type`, `category` FROM `' . $this->getTableName() . '` '
70
+            . 'WHERE `uid` = ? AND `type` = ? AND `category` = ?';
71
+        try {
72
+            $this->findEntity($sql, array($tag->getOwner(), $tag->getType(), $tag->getName()));
73
+        } catch (DoesNotExistException $e) {
74
+            return false;
75
+        }
76
+        return true;
77
+    }
78 78
 }
79 79
 
Please login to merge, or discard this patch.
lib/private/Tagging/Tag.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -37,54 +37,54 @@
 block discarded – undo
37 37
  */
38 38
 class Tag extends Entity {
39 39
 
40
-	protected $owner;
41
-	protected $type;
42
-	protected $name;
40
+    protected $owner;
41
+    protected $type;
42
+    protected $name;
43 43
 
44
-	/**
45
-	* Constructor.
46
-	*
47
-	* @param string $owner The tag's owner
48
-	* @param string $type The type of item this tag is used for
49
-	* @param string $name The tag's name
50
-	*/
51
-	public function __construct($owner = null, $type = null, $name = null) {
52
-		$this->setOwner($owner);
53
-		$this->setType($type);
54
-		$this->setName($name);
55
-	}
44
+    /**
45
+     * Constructor.
46
+     *
47
+     * @param string $owner The tag's owner
48
+     * @param string $type The type of item this tag is used for
49
+     * @param string $name The tag's name
50
+     */
51
+    public function __construct($owner = null, $type = null, $name = null) {
52
+        $this->setOwner($owner);
53
+        $this->setType($type);
54
+        $this->setName($name);
55
+    }
56 56
 
57
-	/**
58
-	 * Transform a database columnname to a property
59
-	 *
60
-	 * @param string $columnName the name of the column
61
-	 * @return string the property name
62
-	 * @todo migrate existing database columns to the correct names
63
-	 * to be able to drop this direct mapping
64
-	 */
65
-	public function columnToProperty($columnName){
66
-		if ($columnName === 'category') {
67
-		    return 'name';
68
-		} elseif ($columnName === 'uid') {
69
-		    return 'owner';
70
-		} else {
71
-		    return parent::columnToProperty($columnName);
72
-		}
73
-	}
57
+    /**
58
+     * Transform a database columnname to a property
59
+     *
60
+     * @param string $columnName the name of the column
61
+     * @return string the property name
62
+     * @todo migrate existing database columns to the correct names
63
+     * to be able to drop this direct mapping
64
+     */
65
+    public function columnToProperty($columnName){
66
+        if ($columnName === 'category') {
67
+            return 'name';
68
+        } elseif ($columnName === 'uid') {
69
+            return 'owner';
70
+        } else {
71
+            return parent::columnToProperty($columnName);
72
+        }
73
+    }
74 74
 
75
-	/**
76
-	 * Transform a property to a database column name
77
-	 *
78
-	 * @param string $property the name of the property
79
-	 * @return string the column name
80
-	 */
81
-	public function propertyToColumn($property){
82
-		if ($property === 'name') {
83
-		    return 'category';
84
-		} elseif ($property === 'owner') {
85
-		    return 'uid';
86
-		} else {
87
-		    return parent::propertyToColumn($property);
88
-		}
89
-	}
75
+    /**
76
+     * Transform a property to a database column name
77
+     *
78
+     * @param string $property the name of the property
79
+     * @return string the column name
80
+     */
81
+    public function propertyToColumn($property){
82
+        if ($property === 'name') {
83
+            return 'category';
84
+        } elseif ($property === 'owner') {
85
+            return 'uid';
86
+        } else {
87
+            return parent::propertyToColumn($property);
88
+        }
89
+    }
90 90
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 * @todo migrate existing database columns to the correct names
63 63
 	 * to be able to drop this direct mapping
64 64
 	 */
65
-	public function columnToProperty($columnName){
65
+	public function columnToProperty($columnName) {
66 66
 		if ($columnName === 'category') {
67 67
 		    return 'name';
68 68
 		} elseif ($columnName === 'uid') {
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @param string $property the name of the property
79 79
 	 * @return string the column name
80 80
 	 */
81
-	public function propertyToColumn($property){
81
+	public function propertyToColumn($property) {
82 82
 		if ($property === 'name') {
83 83
 		    return 'category';
84 84
 		} elseif ($property === 'owner') {
Please login to merge, or discard this patch.
lib/private/TagManager.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -40,53 +40,53 @@
 block discarded – undo
40 40
 
41 41
 class TagManager implements \OCP\ITagManager {
42 42
 
43
-	/**
44
-	 * User session
45
-	 *
46
-	 * @var \OCP\IUserSession
47
-	 */
48
-	private $userSession;
43
+    /**
44
+     * User session
45
+     *
46
+     * @var \OCP\IUserSession
47
+     */
48
+    private $userSession;
49 49
 
50
-	/**
51
-	 * TagMapper
52
-	 *
53
-	 * @var TagMapper
54
-	 */
55
-	private $mapper;
50
+    /**
51
+     * TagMapper
52
+     *
53
+     * @var TagMapper
54
+     */
55
+    private $mapper;
56 56
 
57
-	/**
58
-	* Constructor.
59
-	*
60
-	* @param TagMapper $mapper Instance of the TagMapper abstraction layer.
61
-	* @param \OCP\IUserSession $userSession the user session
62
-	*/
63
-	public function __construct(TagMapper $mapper, \OCP\IUserSession $userSession) {
64
-		$this->mapper = $mapper;
65
-		$this->userSession = $userSession;
57
+    /**
58
+     * Constructor.
59
+     *
60
+     * @param TagMapper $mapper Instance of the TagMapper abstraction layer.
61
+     * @param \OCP\IUserSession $userSession the user session
62
+     */
63
+    public function __construct(TagMapper $mapper, \OCP\IUserSession $userSession) {
64
+        $this->mapper = $mapper;
65
+        $this->userSession = $userSession;
66 66
 
67
-	}
67
+    }
68 68
 
69
-	/**
70
-	* Create a new \OCP\ITags instance and load tags from db.
71
-	*
72
-	* @see \OCP\ITags
73
-	* @param string $type The type identifier e.g. 'contact' or 'event'.
74
-	* @param array $defaultTags An array of default tags to be used if none are stored.
75
-	* @param boolean $includeShared Whether to include tags for items shared with this user by others.
76
-	* @param string $userId user for which to retrieve the tags, defaults to the currently
77
-	* logged in user
78
-	* @return \OCP\ITags
79
-	*/
80
-	public function load($type, $defaultTags = array(), $includeShared = false, $userId = null) {
81
-		if (is_null($userId)) {
82
-			$user = $this->userSession->getUser();
83
-			if ($user === null) {
84
-				// nothing we can do without a user
85
-				return null;
86
-			}
87
-			$userId = $this->userSession->getUser()->getUId();
88
-		}
89
-		return new Tags($this->mapper, $userId, $type, $defaultTags, $includeShared);
90
-	}
69
+    /**
70
+     * Create a new \OCP\ITags instance and load tags from db.
71
+     *
72
+     * @see \OCP\ITags
73
+     * @param string $type The type identifier e.g. 'contact' or 'event'.
74
+     * @param array $defaultTags An array of default tags to be used if none are stored.
75
+     * @param boolean $includeShared Whether to include tags for items shared with this user by others.
76
+     * @param string $userId user for which to retrieve the tags, defaults to the currently
77
+     * logged in user
78
+     * @return \OCP\ITags
79
+     */
80
+    public function load($type, $defaultTags = array(), $includeShared = false, $userId = null) {
81
+        if (is_null($userId)) {
82
+            $user = $this->userSession->getUser();
83
+            if ($user === null) {
84
+                // nothing we can do without a user
85
+                return null;
86
+            }
87
+            $userId = $this->userSession->getUser()->getUId();
88
+        }
89
+        return new Tags($this->mapper, $userId, $type, $defaultTags, $includeShared);
90
+    }
91 91
 
92 92
 }
Please login to merge, or discard this patch.