Completed
Pull Request — master (#551)
by Maxence
02:35
created
lib/Model/Circle.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -78,22 +78,22 @@  discard block
 block discarded – undo
78 78
 
79 79
 
80 80
 	// specific value
81
-	const CFG_CIRCLE = 0;        // only for code readability. Circle is locked by default.
82
-	const CFG_SINGLE = 1;        // Circle with only one single member.
83
-	const CFG_PERSONAL = 2;      // Personal circle, only the owner can see it.
81
+	const CFG_CIRCLE = 0; // only for code readability. Circle is locked by default.
82
+	const CFG_SINGLE = 1; // Circle with only one single member.
83
+	const CFG_PERSONAL = 2; // Personal circle, only the owner can see it.
84 84
 
85 85
 	// bitwise
86
-	const CFG_VISIBLE = 8;        // Visible to everyone, if not visible, people have to know its name to be able to find it
87
-	const CFG_OPEN = 16;          // Circle is open, people can join
88
-	const CFG_INVITE = 32;        // Adding a member generate an invitation that needs to be accepted
89
-	const CFG_REQUEST = 64;       // Request to join Circles needs to be confirmed by a moderator
90
-	const CFG_FRIEND = 128;       // Members of the circle can invite their friends
91
-	const CFG_PROTECTED = 256;    // Password protected to join/request
92
-	const CFG_NO_OWNER = 512;     // no owner, only members
93
-	const CFG_HIDDEN = 1024;      // hidden from listing, but available as a share entity
94
-	const CFG_BACKEND = 2048;     // Fully hidden, only backend Circles
95
-	const CFG_ROOT = 4096;        // Circle cannot be inside another Circle
96
-	const CFG_FEDERATED = 8192;   // Federated
86
+	const CFG_VISIBLE = 8; // Visible to everyone, if not visible, people have to know its name to be able to find it
87
+	const CFG_OPEN = 16; // Circle is open, people can join
88
+	const CFG_INVITE = 32; // Adding a member generate an invitation that needs to be accepted
89
+	const CFG_REQUEST = 64; // Request to join Circles needs to be confirmed by a moderator
90
+	const CFG_FRIEND = 128; // Members of the circle can invite their friends
91
+	const CFG_PROTECTED = 256; // Password protected to join/request
92
+	const CFG_NO_OWNER = 512; // no owner, only members
93
+	const CFG_HIDDEN = 1024; // hidden from listing, but available as a share entity
94
+	const CFG_BACKEND = 2048; // Fully hidden, only backend Circles
95
+	const CFG_ROOT = 4096; // Circle cannot be inside another Circle
96
+	const CFG_FEDERATED = 8192; // Federated
97 97
 
98 98
 	static $DEF = [
99 99
 		1 => 'S|Single',
@@ -583,21 +583,21 @@  discard block
 block discarded – undo
583 583
 	 * @throws CircleNotFoundException
584 584
 	 */
585 585
 	public function importFromDatabase(array $data, string $prefix = ''): INC21QueryRow {
586
-		if (!array_key_exists($prefix . 'unique_id', $data)) {
586
+		if (!array_key_exists($prefix.'unique_id', $data)) {
587 587
 			throw new CircleNotFoundException();
588 588
 		}
589 589
 
590
-		$this->setId($this->get($prefix . 'unique_id', $data))
591
-			 ->setName($this->get($prefix . 'name', $data))
592
-			 ->setAltName($this->get($prefix . 'alt_name', $data))
593
-			 ->setConfig($this->getInt($prefix . 'config', $data))
594
-			 ->setInstance($this->get($prefix . 'instance', $data))
595
-			 ->setSettings($this->getArray($prefix . 'settings', $data))
596
-			 ->setContactAddressBook($this->getInt($prefix . 'contact_addressbook', $data))
597
-			 ->setContactGroupName($this->get($prefix . 'contact_groupname', $data))
598
-			 ->setDescription($this->get($prefix . 'description', $data));
599
-
600
-		$creation = $this->get($prefix . 'creation', $data);
590
+		$this->setId($this->get($prefix.'unique_id', $data))
591
+			 ->setName($this->get($prefix.'name', $data))
592
+			 ->setAltName($this->get($prefix.'alt_name', $data))
593
+			 ->setConfig($this->getInt($prefix.'config', $data))
594
+			 ->setInstance($this->get($prefix.'instance', $data))
595
+			 ->setSettings($this->getArray($prefix.'settings', $data))
596
+			 ->setContactAddressBook($this->getInt($prefix.'contact_addressbook', $data))
597
+			 ->setContactGroupName($this->get($prefix.'contact_groupname', $data))
598
+			 ->setDescription($this->get($prefix.'description', $data));
599
+
600
+		$creation = $this->get($prefix.'creation', $data);
601 601
 		$this->setCreation(DateTime::createFromFormat('Y-m-d H:i:s', $creation)->getTimestamp());
602 602
 
603 603
 		$this->getManager()->importOwnerFromDatabase($this, $data);
Please login to merge, or discard this patch.
lib/Model/Helpers/MemberHelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 		try {
105 105
 			$level = Member::parseLevelString($levelString);
106 106
 		} catch (MemberLevelException $e) {
107
-			throw new MemberHelperException('method ' . $levelString . ' not found');
107
+			throw new MemberHelperException('method '.$levelString.' not found');
108 108
 		}
109 109
 
110 110
 		$this->mustHaveLevelEqualOrAbove($level);
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
122 122
 		try {
123 123
 			$level = Member::parseLevelString($levelString);
124 124
 		} catch (MemberLevelException $e) {
125
-			throw new MemberHelperException('method ' . $levelString . ' not found');
125
+			throw new MemberHelperException('method '.$levelString.' not found');
126 126
 		}
127 127
 
128 128
 		if ($this->member->getLevel() >= $level) {
129
-			throw new MemberLevelException('Member cannot be ' . $levelString);
129
+			throw new MemberLevelException('Member cannot be '.$levelString);
130 130
 		}
131 131
 	}
132 132
 
Please login to merge, or discard this patch.
lib/Command/MembersLevel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@
 block discarded – undo
108 108
 		$level = Member::parseLevelString($input->getArgument('level'));
109 109
 		$outcome = $this->memberService->memberLevel($memberId, $level);
110 110
 
111
-		echo json_encode($outcome, JSON_PRETTY_PRINT) . "\n";
111
+		echo json_encode($outcome, JSON_PRETTY_PRINT)."\n";
112 112
 
113 113
 		return 0;
114 114
 	}
Please login to merge, or discard this patch.
lib/Command/MembersRemove.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@
 block discarded – undo
106 106
 
107 107
 		$outcome = $this->memberService->removeMember($memberId);
108 108
 
109
-		echo json_encode($outcome, JSON_PRETTY_PRINT) . "\n";
109
+		echo json_encode($outcome, JSON_PRETTY_PRINT)."\n";
110 110
 
111 111
 		return 0;
112 112
 	}
Please login to merge, or discard this patch.
lib/Service/RemoteService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -189,7 +189,7 @@
 block discarded – undo
189 189
 			$loop++;
190 190
 			if ($loop > 10 || in_array($instance, $knownInstance)) {
191 191
 				throw new CircleNotFoundException(
192
-					'circle not found after browsing ' . implode(', ', $knownInstance)
192
+					'circle not found after browsing '.implode(', ', $knownInstance)
193 193
 				);
194 194
 			}
195 195
 			$knownInstance[] = $instance;
Please login to merge, or discard this patch.
lib/Service/RemoteStreamService.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 
262 262
 		$request = new NC21Request('', $type);
263 263
 		if ($this->configService->isLocalInstance($instance)) {
264
-			$this->configService->configureRequest($request, 'circles.Remote.' . $item, $params);
264
+			$this->configService->configureRequest($request, 'circles.Remote.'.$item, $params);
265 265
 		} else {
266 266
 			$this->configService->configureRequest($request);
267 267
 			$link = $this->getRemoteInstanceEntry($instance, $item, $params);
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 	public function getCachedRemoteInstance(string $instance): RemoteInstance {
318 318
 		$remoteInstance = $this->remoteRequest->getFromInstance($instance);
319 319
 		if ($remoteInstance->getType() === RemoteInstance::TYPE_UNKNOWN) {
320
-			throw new UnknownRemoteException($instance . ' is set as \'unknown\' in database');
320
+			throw new UnknownRemoteException($instance.' is set as \'unknown\' in database');
321 321
 		}
322 322
 
323 323
 		return $remoteInstance;
Please login to merge, or discard this patch.
lib/Command/CirclesRemote.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -162,19 +162,19 @@  discard block
 block discarded – undo
162 162
 	private function requestInstance(string $host): void {
163 163
 		$webfinger = $this->getWebfinger($host, Application::APP_SUBJECT);
164 164
 		if ($this->input->getOption('all')) {
165
-			$this->output->writeln('- Webfinger on <info>' . $host . '</info>');
165
+			$this->output->writeln('- Webfinger on <info>'.$host.'</info>');
166 166
 			$this->output->writeln(json_encode($webfinger, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
167 167
 			$this->output->writeln('');
168 168
 		}
169 169
 
170 170
 		if ($this->input->getOption('all')) {
171 171
 			$circleLink = $this->extractLink(Application::APP_REL, $webfinger);
172
-			$this->output->writeln('- Information about Circles app on <info>' . $host . '</info>');
172
+			$this->output->writeln('- Information about Circles app on <info>'.$host.'</info>');
173 173
 			$this->output->writeln(json_encode($circleLink, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
174 174
 			$this->output->writeln('');
175 175
 		}
176 176
 
177
-		$this->output->writeln('- Available services on <info>' . $host . '</info>');
177
+		$this->output->writeln('- Available services on <info>'.$host.'</info>');
178 178
 		foreach ($webfinger->getLinks() as $link) {
179 179
 			$app = $link->getProperty('name');
180 180
 			$ver = $link->getProperty('version');
@@ -182,14 +182,14 @@  discard block
 block discarded – undo
182 182
 				$app .= ' ';
183 183
 			}
184 184
 			if ($ver !== '') {
185
-				$ver = 'v' . $ver;
185
+				$ver = 'v'.$ver;
186 186
 			}
187 187
 
188
-			$this->output->writeln(' * ' . $link->getRel() . ' ' . $app . $ver);
188
+			$this->output->writeln(' * '.$link->getRel().' '.$app.$ver);
189 189
 		}
190 190
 		$this->output->writeln('');
191 191
 
192
-		$this->output->writeln('- Resources related to Circles on <info>' . $host . '</info>');
192
+		$this->output->writeln('- Resources related to Circles on <info>'.$host.'</info>');
193 193
 		$resource = $this->getResourceData($host, Application::APP_SUBJECT, Application::APP_REL);
194 194
 		$this->output->writeln(json_encode($resource, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
195 195
 		$this->output->writeln('');
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 
198 198
 		$tempUid = $resource->g('uid');
199 199
 		$this->output->writeln(
200
-			'- Confirming UID=' . $tempUid . ' from parsed Signatory at <info>' . $host . '</info>'
200
+			'- Confirming UID='.$tempUid.' from parsed Signatory at <info>'.$host.'</info>'
201 201
 		);
202 202
 
203 203
 		try {
@@ -205,15 +205,15 @@  discard block
 block discarded – undo
205 205
 			$this->output->writeln(' * No SignatureException: <info>Identity authed</info>');
206 206
 		} catch (SignatureException $e) {
207 207
 			$this->output->writeln(
208
-				'<error>' . $host . ' cannot auth its identity: ' . $e->getMessage() . '</error>'
208
+				'<error>'.$host.' cannot auth its identity: '.$e->getMessage().'</error>'
209 209
 			);
210 210
 
211 211
 			return;
212 212
 		}
213 213
 
214
-		$this->output->writeln(' * Found <info>' . $remoteSignatory->getUid() . '</info>');
214
+		$this->output->writeln(' * Found <info>'.$remoteSignatory->getUid().'</info>');
215 215
 		if ($remoteSignatory->getUid(true) !== $tempUid) {
216
-			$this->output->writeln('<error>looks like ' . $host . ' is faking its identity');
216
+			$this->output->writeln('<error>looks like '.$host.' is faking its identity');
217 217
 
218 218
 			return;
219 219
 		}
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 		$this->output->writeln('');
222 222
 
223 223
 		$testUrl = $resource->g('test');
224
-		$this->output->writeln('- Testing signed payload on <info>' . $testUrl . '</info>');
224
+		$this->output->writeln('- Testing signed payload on <info>'.$testUrl.'</info>');
225 225
 
226 226
 		try {
227 227
 			$localSignatory = $this->remoteStreamService->getAppSignatory();
@@ -243,18 +243,18 @@  discard block
 block discarded – undo
243 243
 		$this->output->writeln('');
244 244
 
245 245
 		$this->output->writeln(' * Clear Signature: ');
246
-		$this->output->writeln('<comment>' . $signedRequest->getClearSignature() . '</comment>');
246
+		$this->output->writeln('<comment>'.$signedRequest->getClearSignature().'</comment>');
247 247
 		$this->output->writeln('');
248 248
 
249 249
 		$this->output->writeln(' * Signed Signature (base64 encoded): ');
250 250
 		$this->output->writeln(
251
-			'<comment>' . base64_encode($signedRequest->getSignedSignature()) . '</comment>'
251
+			'<comment>'.base64_encode($signedRequest->getSignedSignature()).'</comment>'
252 252
 		);
253 253
 		$this->output->writeln('');
254 254
 
255 255
 		$result = $signedRequest->getOutgoingRequest()->getResult();
256 256
 		$code = $result->getStatusCode();
257
-		$this->output->writeln(' * Result: ' . (($code === 200) ? '<info>' . $code . '</info>' : $code));
257
+		$this->output->writeln(' * Result: '.(($code === 200) ? '<info>'.$code.'</info>' : $code));
258 258
 		$this->output->writeln(
259 259
 			json_encode(json_decode($result->getContent(), true), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)
260 260
 		);
@@ -273,20 +273,20 @@  discard block
 block discarded – undo
273 273
 				$stored = new RemoteInstance();
274 274
 				$this->remoteStreamService->confirmValidRemote($remoteSignatory, $stored);
275 275
 				$this->output->writeln(
276
-					'<info>The remote instance ' . $host
276
+					'<info>The remote instance '.$host
277 277
 					. ' is already known with this current identity</info>'
278 278
 				);
279 279
 
280 280
 				if ($remoteSignatory->getInstance() !== $stored->getInstance()) {
281 281
 					$this->output->writeln(
282
-						'- updating host from ' . $stored->getInstance() . ' to '
282
+						'- updating host from '.$stored->getInstance().' to '
283 283
 						. $remoteSignatory->getInstance()
284 284
 					);
285 285
 					$this->remoteStreamService->update($remoteSignatory, RemoteStreamService::UPDATE_INSTANCE);
286 286
 				}
287 287
 				if ($remoteSignatory->getId() !== $stored->getId()) {
288 288
 					$this->output->writeln(
289
-						'- updating href/Id from ' . $stored->getId() . ' to '
289
+						'- updating href/Id from '.$stored->getId().' to '
290 290
 						. $remoteSignatory->getId()
291 291
 					);
292 292
 					$this->remoteStreamService->update($remoteSignatory, RemoteStreamService::UPDATE_HREF);
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 		$helper = $this->getHelper('question');
313 313
 
314 314
 		$this->output->writeln(
315
-			'The remote instance <info>' . $remoteSignatory->getInstance() . '</info> looks good.'
315
+			'The remote instance <info>'.$remoteSignatory->getInstance().'</info> looks good.'
316 316
 		);
317 317
 		$question = new ConfirmationQuestion(
318 318
 			'Would you like to allow the sharing of your circles with this remote instance ? (y/N) ',
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 		$helper = $this->getHelper('question');
338 338
 
339 339
 		$this->output->writeln(
340
-			'The remote instance <info>' . $remoteSignatory->getInstance()
340
+			'The remote instance <info>'.$remoteSignatory->getInstance()
341 341
 			. '</info> is known but <error>its identity has changed.</error>'
342 342
 		);
343 343
 		$this->output->writeln(
@@ -414,13 +414,13 @@  discard block
 block discarded – undo
414 414
 		if ($this->configService->isLocalInstance($instance)) {
415 415
 			return;
416 416
 		}
417
-		$this->output->write('Adding <comment>' . $instance . '</comment>: ');
417
+		$this->output->write('Adding <comment>'.$instance.'</comment>: ');
418 418
 		try {
419 419
 			$this->remoteStreamService->addRemoteInstance($instance, RemoteInstance::TYPE_GLOBAL_SCALE, true);
420 420
 			$this->output->writeln('<info>ok</info>');
421 421
 		} catch (Exception $e) {
422
-			$msg = ($e->getMessage() === '') ? '' : ' (' . $e->getMessage() . ')';
423
-			$this->output->writeln('<error>' . get_class($e) . $msg . '</error>');
422
+			$msg = ($e->getMessage() === '') ? '' : ' ('.$e->getMessage().')';
423
+			$this->output->writeln('<error>'.get_class($e).$msg.'</error>');
424 424
 		}
425 425
 	}
426 426
 
@@ -438,12 +438,12 @@  discard block
 block discarded – undo
438 438
 			try {
439 439
 				$current = $this->remoteStreamService->retrieveRemoteInstance($instance->getInstance());
440 440
 				if ($current->getUid(true) === $instance->getUid(true)) {
441
-					$currentUid = '<info>' . $current->getUid(true) . '</info>';
441
+					$currentUid = '<info>'.$current->getUid(true).'</info>';
442 442
 				} else {
443
-					$currentUid = '<error>' . $current->getUid(true) . '</error>';
443
+					$currentUid = '<error>'.$current->getUid(true).'</error>';
444 444
 				}
445 445
 			} catch (Exception $e) {
446
-				$currentUid = '<error>' . $e->getMessage() . '</error>';
446
+				$currentUid = '<error>'.$e->getMessage().'</error>';
447 447
 			}
448 448
 
449 449
 			$table->appendRow(
Please login to merge, or discard this patch.
lib/Command/CirclesList.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@
 block discarded – undo
166 166
 		}
167 167
 
168 168
 		if ($input->getOption('json')) {
169
-			echo json_encode($circles, JSON_PRETTY_PRINT) . "\n";
169
+			echo json_encode($circles, JSON_PRETTY_PRINT)."\n";
170 170
 
171 171
 			return 0;
172 172
 		}
Please login to merge, or discard this patch.
lib/Command/CirclesDetails.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@
 block discarded – undo
157 157
 			}
158 158
 		}
159 159
 
160
-		echo json_encode($circle, JSON_PRETTY_PRINT) . "\n";
160
+		echo json_encode($circle, JSON_PRETTY_PRINT)."\n";
161 161
 
162 162
 		return 0;
163 163
 	}
Please login to merge, or discard this patch.