Passed
Push — master ( 11f8dc...ab3543 )
by Morris
45:21 queued 22:13
created
apps/comments/lib/Activity/Provider.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -213,18 +213,18 @@
 block discarded – undo
213 213
 					continue;
214 214
 				}
215 215
 
216
-				$pattern = '/(^|\s)(' . '@' . $mention['id'] . ')(\b)/';
216
+				$pattern = '/(^|\s)('.'@'.$mention['id'].')(\b)/';
217 217
 				if (strpos($mention['id'], ' ') !== false) {
218
-					$pattern = '/(^|\s)(' . '@"' . $mention['id'] . '"' . ')(\b)?/';
218
+					$pattern = '/(^|\s)('.'@"'.$mention['id'].'"'.')(\b)?/';
219 219
 				}
220 220
 
221 221
 				$message = preg_replace(
222 222
 					$pattern,
223 223
 					//'${1}' . $this->regexSafeUser($mention['id'], $displayName) . '${3}',
224
-					'${1}' . '{mention' . $mentionCount . '}' . '${3}',
224
+					'${1}'.'{mention'.$mentionCount.'}'.'${3}',
225 225
 					$message
226 226
 				);
227
-				$mentions['mention' . $mentionCount] = $this->generateUserParameter($mention['id']);
227
+				$mentions['mention'.$mentionCount] = $this->generateUserParameter($mention['id']);
228 228
 				$mentionCount++;
229 229
 			}
230 230
 
Please login to merge, or discard this patch.
lib/private/Comments/Comment.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 * 						the comments database scheme
53 53
 	 */
54 54
 	public function __construct(array $data = null) {
55
-		if(is_array($data)) {
55
+		if (is_array($data)) {
56 56
 			$this->fromArray($data);
57 57
 		}
58 58
 	}
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
 	 * @since 9.0.0
86 86
 	 */
87 87
 	public function setId($id) {
88
-		if(!is_string($id)) {
88
+		if (!is_string($id)) {
89 89
 			throw new \InvalidArgumentException('String expected.');
90 90
 		}
91 91
 
92 92
 		$id = trim($id);
93
-		if($this->data['id'] === '' || ($this->data['id'] !== '' && $id === '')) {
93
+		if ($this->data['id'] === '' || ($this->data['id'] !== '' && $id === '')) {
94 94
 			$this->data['id'] = $id;
95 95
 			return $this;
96 96
 		}
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 * @since 9.0.0
117 117
 	 */
118 118
 	public function setParentId($parentId) {
119
-		if(!is_string($parentId)) {
119
+		if (!is_string($parentId)) {
120 120
 			throw new \InvalidArgumentException('String expected.');
121 121
 		}
122 122
 		$this->data['parentId'] = trim($parentId);
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @since 9.0.0
143 143
 	 */
144 144
 	public function setTopmostParentId($id) {
145
-		if(!is_string($id)) {
145
+		if (!is_string($id)) {
146 146
 			throw new \InvalidArgumentException('String expected.');
147 147
 		}
148 148
 		$this->data['topmostParentId'] = trim($id);
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 * @since 9.0.0
168 168
 	 */
169 169
 	public function setChildrenCount($count) {
170
-		if(!is_int($count)) {
170
+		if (!is_int($count)) {
171 171
 			throw new \InvalidArgumentException('Integer expected.');
172 172
 		}
173 173
 		$this->data['childrenCount'] = $count;
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
 	 * @since 9.0.0
194 194
 	 */
195 195
 	public function setMessage($message) {
196
-		if(!is_string($message)) {
196
+		if (!is_string($message)) {
197 197
 			throw new \InvalidArgumentException('String expected.');
198 198
 		}
199 199
 		$message = trim($message);
200
-		if(mb_strlen($message, 'UTF-8') > IComment::MAX_MESSAGE_LENGTH) {
201
-			throw new MessageTooLongException('Comment message must not exceed ' . IComment::MAX_MESSAGE_LENGTH . ' characters');
200
+		if (mb_strlen($message, 'UTF-8') > IComment::MAX_MESSAGE_LENGTH) {
201
+			throw new MessageTooLongException('Comment message must not exceed '.IComment::MAX_MESSAGE_LENGTH.' characters');
202 202
 		}
203 203
 		$this->data['message'] = $message;
204 204
 		return $this;
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	 */
227 227
 	public function getMentions() {
228 228
 		$ok = preg_match_all("/\B(?<![^a-z0-9_\-@\.\'\s])@(\"[a-z0-9_\-@\.\' ]+\"|[a-z0-9_\-@\.\']+)/i", $this->getMessage(), $mentions);
229
-		if(!$ok || !isset($mentions[0]) || !is_array($mentions[0])) {
229
+		if (!$ok || !isset($mentions[0]) || !is_array($mentions[0])) {
230 230
 			return [];
231 231
 		}
232 232
 		$uids = array_unique($mentions[0]);
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 	 * @since 9.0.0
256 256
 	 */
257 257
 	public function setVerb($verb) {
258
-		if(!is_string($verb) || !trim($verb)) {
258
+		if (!is_string($verb) || !trim($verb)) {
259 259
 			throw new \InvalidArgumentException('Non-empty String expected.');
260 260
 		}
261 261
 		$this->data['verb'] = trim($verb);
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
 	 * @since 9.0.0
292 292
 	 */
293 293
 	public function setActor($actorType, $actorId) {
294
-		if(
294
+		if (
295 295
 		       !is_string($actorType) || !trim($actorType)
296
-		    || !is_string($actorId)   || !trim($actorId)
296
+		    || !is_string($actorId) || !trim($actorId)
297 297
 		) {
298 298
 			throw new \InvalidArgumentException('String expected.');
299 299
 		}
@@ -377,9 +377,9 @@  discard block
 block discarded – undo
377 377
 	 * @since 9.0.0
378 378
 	 */
379 379
 	public function setObject($objectType, $objectId) {
380
-		if(
380
+		if (
381 381
 		       !is_string($objectType) || !trim($objectType)
382
-		    || !is_string($objectId)   || !trim($objectId)
382
+		    || !is_string($objectId) || !trim($objectId)
383 383
 		) {
384 384
 			throw new \InvalidArgumentException('String expected.');
385 385
 		}
@@ -396,20 +396,20 @@  discard block
 block discarded – undo
396 396
 	 * @return IComment
397 397
 	 */
398 398
 	protected function fromArray($data) {
399
-		foreach(array_keys($data) as $key) {
399
+		foreach (array_keys($data) as $key) {
400 400
 			// translate DB keys to internal setter names
401
-			$setter = 'set' . implode('', array_map('ucfirst', explode('_', $key)));
401
+			$setter = 'set'.implode('', array_map('ucfirst', explode('_', $key)));
402 402
 			$setter = str_replace('Timestamp', 'DateTime', $setter);
403 403
 
404
-			if(method_exists($this, $setter)) {
404
+			if (method_exists($this, $setter)) {
405 405
 				$this->$setter($data[$key]);
406 406
 			}
407 407
 		}
408 408
 
409
-		foreach(['actor', 'object'] as $role) {
410
-			if(isset($data[$role . '_type']) && isset($data[$role . '_id'])) {
411
-				$setter = 'set' . ucfirst($role);
412
-				$this->$setter($data[$role . '_type'], $data[$role . '_id']);
409
+		foreach (['actor', 'object'] as $role) {
410
+			if (isset($data[$role.'_type']) && isset($data[$role.'_id'])) {
411
+				$setter = 'set'.ucfirst($role);
412
+				$this->$setter($data[$role.'_type'], $data[$role.'_id']);
413 413
 			}
414 414
 		}
415 415
 
Please login to merge, or discard this patch.