@@ -178,7 +178,7 @@ |
||
178 | 178 | |
179 | 179 | /** |
180 | 180 | * @param array $arr |
181 | - * @param $key |
|
181 | + * @param string $key |
|
182 | 182 | * @param int $type |
183 | 183 | * |
184 | 184 | * @return null|DeprecatedMember |
@@ -292,7 +292,7 @@ |
||
292 | 292 | * @return int |
293 | 293 | */ |
294 | 294 | public static function convertTypeToConfig(int $type): int { |
295 | - switch($type) { |
|
295 | + switch ($type) { |
|
296 | 296 | case DeprecatedCircle::CIRCLES_PERSONAL: |
297 | 297 | return 2; |
298 | 298 | case DeprecatedCircle::CIRCLES_SECRET: |
@@ -41,6 +41,9 @@ |
||
41 | 41 | class DeprecatedMember extends BaseMember { |
42 | 42 | |
43 | 43 | |
44 | + /** |
|
45 | + * @param integer $circleType |
|
46 | + */ |
|
44 | 47 | public function inviteToCircle($circleType) { |
45 | 48 | |
46 | 49 | if ($circleType === 0) { |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @param string $circleUniqueId |
110 | 110 | * @param string $groupId |
111 | 111 | * |
112 | - * @return array |
|
112 | + * @return DeprecatedMember[] |
|
113 | 113 | * @throws \Exception |
114 | 114 | */ |
115 | 115 | public function linkGroup($circleUniqueId, $groupId) { |
@@ -165,8 +165,8 @@ discard block |
||
165 | 165 | /** |
166 | 166 | * Check if a fresh member can be generated (by linkGroup) |
167 | 167 | * |
168 | - * @param $circleId |
|
169 | - * @param $groupId |
|
168 | + * @param string $circleId |
|
169 | + * @param string $groupId |
|
170 | 170 | * |
171 | 171 | * @return null|DeprecatedMember |
172 | 172 | * @throws MemberAlreadyExistsException |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @param string $groupId |
203 | 203 | * @param int $level |
204 | 204 | * |
205 | - * @return array |
|
205 | + * @return DeprecatedMember[] |
|
206 | 206 | * @throws \Exception |
207 | 207 | */ |
208 | 208 | public function levelGroup($circleUniqueId, $groupId, $level) { |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | /** |
244 | 244 | * @param DeprecatedCircle $circle |
245 | 245 | * @param DeprecatedMember $group |
246 | - * @param $level |
|
246 | + * @param integer $level |
|
247 | 247 | * |
248 | 248 | * @throws \Exception |
249 | 249 | */ |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * @param string $circleUniqueId |
271 | 271 | * @param string $groupId |
272 | 272 | * |
273 | - * @return array |
|
273 | + * @return DeprecatedMember[] |
|
274 | 274 | * @throws \Exception |
275 | 275 | */ |
276 | 276 | public function unlinkGroup($circleUniqueId, $groupId) { |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | public function onDeleteCard(GenericEvent $event) { |
165 | 165 | $davCard = $this->generateDavCard($event, true); |
166 | 166 | |
167 | - $this->miscService->log('Deleting Card: ' . json_encode($davCard), 1); |
|
167 | + $this->miscService->log('Deleting Card: '.json_encode($davCard), 1); |
|
168 | 168 | $this->membersRequest->removeMembersByContactId($davCard->getUniqueId(), DeprecatedMember::TYPE_USER); |
169 | 169 | $this->manageDeprecatedCircles($davCard->getAddressBookId()); |
170 | 170 | $this->manageDeprecatedMembers($davCard); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | private function generateDavCardFromCard(int $bookId, array $card): DavCard { |
207 | 207 | $this->miscService->log( |
208 | - 'generating DavCard Model from book=' . $bookId . ' from ' . json_encode($card), 0 |
|
208 | + 'generating DavCard Model from book='.$bookId.' from '.json_encode($card), 0 |
|
209 | 209 | ); |
210 | 210 | |
211 | 211 | $davCard = new DavCard(); |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $davCard->setOwner($this->getOwnerFromAddressBook($bookId)); |
216 | 216 | $davCard->importFromDav($card['carddata']); |
217 | 217 | |
218 | - $this->miscService->log('generated DavCard Model: ' . json_encode($davCard), 0); |
|
218 | + $this->miscService->log('generated DavCard Model: '.json_encode($davCard), 0); |
|
219 | 219 | |
220 | 220 | return $davCard; |
221 | 221 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | * |
227 | 227 | */ |
228 | 228 | private function manageDavCard(DavCard $davCard) { |
229 | - $this->miscService->log('Updating Card: ' . json_encode($davCard), 1); |
|
229 | + $this->miscService->log('Updating Card: '.json_encode($davCard), 1); |
|
230 | 230 | $this->manageCircles($davCard); |
231 | 231 | $this->manageContact($davCard); |
232 | 232 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | */ |
261 | 261 | private function manageDeprecatedMembers(DavCard $davCard) { |
262 | 262 | $this->miscService->log( |
263 | - 'Managing deprecated circles memberships from DavCard Model: ' . json_encode($davCard), 0 |
|
263 | + 'Managing deprecated circles memberships from DavCard Model: '.json_encode($davCard), 0 |
|
264 | 264 | ); |
265 | 265 | |
266 | 266 | $circles = array_map( |
@@ -271,13 +271,13 @@ discard block |
||
271 | 271 | |
272 | 272 | $members = $this->membersRequest->getMembersByContactId($davCard->getUniqueId()); |
273 | 273 | $this->miscService->log( |
274 | - 'Found ' . sizeof($members) . ' memberships with contactId=' . $davCard->getUniqueId(), 0 |
|
274 | + 'Found '.sizeof($members).' memberships with contactId='.$davCard->getUniqueId(), 0 |
|
275 | 275 | ); |
276 | 276 | |
277 | 277 | foreach ($members as $member) { |
278 | 278 | if (!in_array($member->getCircleId(), $circles)) { |
279 | 279 | $this->miscService->log( |
280 | - 'Removing membership ' . $member->getMemberId() . ' from ' . $member->getCircleId(), 0 |
|
280 | + 'Removing membership '.$member->getMemberId().' from '.$member->getCircleId(), 0 |
|
281 | 281 | ); |
282 | 282 | $this->membersRequest->removeMember($member); |
283 | 283 | } |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | } |
358 | 358 | } |
359 | 359 | |
360 | - $davCard->setUserId($davCard->getOwner() . ':' . $davCard->getContactId()); |
|
360 | + $davCard->setUserId($davCard->getOwner().':'.$davCard->getContactId()); |
|
361 | 361 | |
362 | 362 | return DavCard::TYPE_CONTACT; |
363 | 363 | } |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | ); |
403 | 403 | |
404 | 404 | $this->miscService->log( |
405 | - 'manage Circles from DavCard: ' . json_encode($fromCard) . ' - current: ' . json_encode($current) |
|
405 | + 'manage Circles from DavCard: '.json_encode($fromCard).' - current: '.json_encode($current) |
|
406 | 406 | ); |
407 | 407 | |
408 | 408 | $this->manageNewCircles($davCard, $fromCard, $current); |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | |
426 | 426 | $user = $this->userManager->get($davCard->getOwner()); |
427 | 427 | $circle = new DeprecatedCircle( |
428 | - $this->configService->contactsBackendType(), $group . ' - ' . $user->getDisplayName() |
|
428 | + $this->configService->contactsBackendType(), $group.' - '.$user->getDisplayName() |
|
429 | 429 | ); |
430 | 430 | $circle->setAltName($group); |
431 | 431 | $circle->generateUniqueId(); |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $circle->setContactGroupName($group); |
434 | 434 | |
435 | 435 | $this->miscService->log( |
436 | - 'creating new Circle: ' . json_encode($circle) . ', with owner=' . $davCard->getOwner(), 0 |
|
436 | + 'creating new Circle: '.json_encode($circle).', with owner='.$davCard->getOwner(), 0 |
|
437 | 437 | ); |
438 | 438 | try { |
439 | 439 | $this->circlesRequest->createCircle($circle); |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | $owner->setStatus(DeprecatedMember::STATUS_MEMBER); |
443 | 443 | $this->membersService->updateCachedName($owner); |
444 | 444 | |
445 | - $this->miscService->log('creating new Member: ' . json_encode($owner), 0); |
|
445 | + $this->miscService->log('creating new Member: '.json_encode($owner), 0); |
|
446 | 446 | try { |
447 | 447 | $this->membersRequest->createMember($owner); |
448 | 448 | } catch (MemberAlreadyExistsException $e) { |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | * @param DavCard $davCard |
458 | 458 | */ |
459 | 459 | private function assignCirclesToCard(DavCard $davCard) { |
460 | - $this->miscService->log('assigning Circles to DavCard Model: ' . json_encode($davCard), 0); |
|
460 | + $this->miscService->log('assigning Circles to DavCard Model: '.json_encode($davCard), 0); |
|
461 | 461 | foreach ($davCard->getGroups() as $group) { |
462 | 462 | try { |
463 | 463 | $davCard->addCircle( |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | } |
468 | 468 | } |
469 | 469 | |
470 | - $this->miscService->log('assigned Circles to DavCard Model: ' . json_encode($davCard), 0); |
|
470 | + $this->miscService->log('assigned Circles to DavCard Model: '.json_encode($davCard), 0); |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | |
@@ -512,12 +512,12 @@ discard block |
||
512 | 512 | * @return string |
513 | 513 | */ |
514 | 514 | public function getOwnerFromAddressBook(int $bookId): string { |
515 | - $this->miscService->log('Retrieving Owner from book:' . $bookId, 0); |
|
515 | + $this->miscService->log('Retrieving Owner from book:'.$bookId, 0); |
|
516 | 516 | $data = $this->cardDavBackend->getAddressBookById($bookId); |
517 | 517 | |
518 | 518 | // let's assume the format is principals/users/OWNER |
519 | 519 | $owner = substr($data['principaluri'], 17); |
520 | - $this->miscService->log('Retrieved Owner:' . $owner, 0); |
|
520 | + $this->miscService->log('Retrieved Owner:'.$owner, 0); |
|
521 | 521 | |
522 | 522 | return $owner; |
523 | 523 | } |
@@ -534,12 +534,12 @@ discard block |
||
534 | 534 | $this->manageDeprecatedContacts(); |
535 | 535 | $this->manageDeprecatedCircles(); |
536 | 536 | $users = $this->userManager->search(''); |
537 | - $this->miscService->log('initiating migration for ' . sizeof($users) . ' users', 0); |
|
537 | + $this->miscService->log('initiating migration for '.sizeof($users).' users', 0); |
|
538 | 538 | foreach ($users as $user) { |
539 | - $this->miscService->log('retrieving books for user=' . $user->getUID(), 0); |
|
540 | - $books = $this->cardDavBackend->getAddressBooksForUser('principals/users/' . $user->getUID()); |
|
539 | + $this->miscService->log('retrieving books for user='.$user->getUID(), 0); |
|
540 | + $books = $this->cardDavBackend->getAddressBooksForUser('principals/users/'.$user->getUID()); |
|
541 | 541 | |
542 | - $this->miscService->log('initiating migration for user=' . $user->getUID(), 0); |
|
542 | + $this->miscService->log('initiating migration for user='.$user->getUID(), 0); |
|
543 | 543 | foreach ($books as $book) { |
544 | 544 | $this->migrateBook($book['id']); |
545 | 545 | } |
@@ -552,16 +552,16 @@ discard block |
||
552 | 552 | private function manageDeprecatedContacts() { |
553 | 553 | $contacts = $this->membersRequest->getMembersByContactId(); |
554 | 554 | $this->miscService->log( |
555 | - 'Managing Deprecated Contacts, checking ' . sizeof($contacts) . ' known contacts in database', 0 |
|
555 | + 'Managing Deprecated Contacts, checking '.sizeof($contacts).' known contacts in database', 0 |
|
556 | 556 | ); |
557 | 557 | |
558 | 558 | foreach ($contacts as $contact) { |
559 | 559 | try { |
560 | 560 | $this->getDavCardFromMember($contact); |
561 | - $this->miscService->log('Contact is not deprecated: ' . json_encode($contact)); |
|
561 | + $this->miscService->log('Contact is not deprecated: '.json_encode($contact)); |
|
562 | 562 | } catch (MemberDoesNotExistException $e) { |
563 | 563 | $this->miscService->log( |
564 | - 'Contact is deprecated and will be removed: ' . json_encode($contact) |
|
564 | + 'Contact is deprecated and will be removed: '.json_encode($contact) |
|
565 | 565 | ); |
566 | 566 | $this->membersRequest->removeMember($contact); |
567 | 567 | } |
@@ -576,12 +576,12 @@ discard block |
||
576 | 576 | */ |
577 | 577 | private function manageDeprecatedCircles(int $bookId = 0) { |
578 | 578 | $knownBooks = [$bookId]; |
579 | - $this->miscService->log('Managing Deprecated Circles, using bookId: ' . $bookId, 0); |
|
579 | + $this->miscService->log('Managing Deprecated Circles, using bookId: '.$bookId, 0); |
|
580 | 580 | |
581 | 581 | if ($bookId > 0) { |
582 | 582 | $knownBooks = []; |
583 | 583 | $contacts = $this->membersRequest->getMembersByContactId(); |
584 | - $this->miscService->log(sizeof($contacts) . ' known members as contacts in Circles DB', 0); |
|
584 | + $this->miscService->log(sizeof($contacts).' known members as contacts in Circles DB', 0); |
|
585 | 585 | |
586 | 586 | foreach ($contacts as $contact) { |
587 | 587 | list($bookId,) = explode('/', $contact->getContactId(), 2); |
@@ -593,17 +593,17 @@ discard block |
||
593 | 593 | } |
594 | 594 | } |
595 | 595 | |
596 | - $this->miscService->log('Known books: ' . json_encode($knownBooks), 0); |
|
596 | + $this->miscService->log('Known books: '.json_encode($knownBooks), 0); |
|
597 | 597 | foreach ($knownBooks as $bookId) { |
598 | - $this->miscService->log('retrieving local Circles data for bookId=' . $bookId, 0); |
|
598 | + $this->miscService->log('retrieving local Circles data for bookId='.$bookId, 0); |
|
599 | 599 | $circles = $this->circlesRequest->getFromContactBook($bookId); |
600 | 600 | $this->miscService->log( |
601 | - 'Known circles for bookId=' . $bookId . ': ' . json_encode($circles), 0 |
|
601 | + 'Known circles for bookId='.$bookId.': '.json_encode($circles), 0 |
|
602 | 602 | ); |
603 | 603 | |
604 | 604 | $fromBook = $this->getExistingCirclesFromBook($bookId); |
605 | 605 | $this->miscService->log( |
606 | - 'Generated circles from bookId=' . $bookId . ': ' . json_encode($fromBook), 0 |
|
606 | + 'Generated circles from bookId='.$bookId.': '.json_encode($fromBook), 0 |
|
607 | 607 | ); |
608 | 608 | |
609 | 609 | foreach ($circles as $circle) { |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | } |
613 | 613 | |
614 | 614 | $this->miscService->log( |
615 | - $circle->getUniqueId() . ' is a deprecated Circle and will be destroyed', 0 |
|
615 | + $circle->getUniqueId().' is a deprecated Circle and will be destroyed', 0 |
|
616 | 616 | ); |
617 | 617 | |
618 | 618 | $this->membersRequest->removeAllFromCircle($circle->getUniqueId()); |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | $cards = $this->cardDavBackend->getCards($bookId); |
635 | 635 | |
636 | 636 | $this->miscService->log( |
637 | - 'retrieving existing circles from bookId=' . $bookId . ' in ' . sizeof($cards) . ' cards', 0 |
|
637 | + 'retrieving existing circles from bookId='.$bookId.' in '.sizeof($cards).' cards', 0 |
|
638 | 638 | ); |
639 | 639 | foreach ($cards as $card) { |
640 | 640 | $davCard = $this->generateDavCardFromCard($bookId, $card); |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | $circles = array_merge($circles, $davCard->getCircles()); |
643 | 643 | } |
644 | 644 | |
645 | - $this->miscService->log('Found ' . sizeof($circles) . ' Circles from book=' . $bookId, 0); |
|
645 | + $this->miscService->log('Found '.sizeof($circles).' Circles from book='.$bookId, 0); |
|
646 | 646 | $existing = array_unique( |
647 | 647 | array_map( |
648 | 648 | function(DeprecatedCircle $circle) { |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | ); |
653 | 653 | |
654 | 654 | $this->miscService->log( |
655 | - 'retrieved existing circles from book=' . $bookId . ': ' . json_encode($existing), 0 |
|
655 | + 'retrieved existing circles from book='.$bookId.': '.json_encode($existing), 0 |
|
656 | 656 | ); |
657 | 657 | |
658 | 658 | return $existing; |
@@ -667,14 +667,14 @@ discard block |
||
667 | 667 | */ |
668 | 668 | public function getDavCardFromMember(DeprecatedMember $contact): DavCard { |
669 | 669 | list($bookId, $cardUri) = explode('/', $contact->getContactId(), 2); |
670 | - $this->miscService->log('Retrieving DavCard from book:' . $bookId . ', uri:' . $cardUri, 0); |
|
670 | + $this->miscService->log('Retrieving DavCard from book:'.$bookId.', uri:'.$cardUri, 0); |
|
671 | 671 | |
672 | 672 | $cards = $this->cardDavBackend->getCards($bookId); |
673 | - $this->miscService->log('Book contains ' . sizeof($cards) . ' cards', 0); |
|
673 | + $this->miscService->log('Book contains '.sizeof($cards).' cards', 0); |
|
674 | 674 | foreach ($cards as $card) { |
675 | 675 | if ($card['uri'] === $cardUri) { |
676 | 676 | $davCard = $this->generateDavCardFromCard($bookId, $card); |
677 | - $this->miscService->log('Retrieved DavCard: ' . json_encode($card)); |
|
677 | + $this->miscService->log('Retrieved DavCard: '.json_encode($card)); |
|
678 | 678 | |
679 | 679 | return $davCard; |
680 | 680 | } |
@@ -692,11 +692,11 @@ discard block |
||
692 | 692 | return; |
693 | 693 | } |
694 | 694 | |
695 | - $this->miscService->log('migrating book: ' . $bookId, 0); |
|
695 | + $this->miscService->log('migrating book: '.$bookId, 0); |
|
696 | 696 | $owner = $this->getOwnerFromAddressBook($bookId); |
697 | 697 | |
698 | 698 | $cards = $this->cardDavBackend->getCards($bookId); |
699 | - $this->miscService->log('found ' . sizeof($cards) . 'cards from book=' . $bookId, 0); |
|
699 | + $this->miscService->log('found '.sizeof($cards).'cards from book='.$bookId, 0); |
|
700 | 700 | |
701 | 701 | foreach ($cards as $card) { |
702 | 702 | $davCard = new DavCard(); |
@@ -148,7 +148,7 @@ |
||
148 | 148 | continue; |
149 | 149 | } |
150 | 150 | |
151 | - $level = (int) $row['role'] === 1 ? DeprecatedMember::LEVEL_OWNER : DeprecatedMember::LEVEL_MEMBER; |
|
151 | + $level = (int)$row['role'] === 1 ? DeprecatedMember::LEVEL_OWNER : DeprecatedMember::LEVEL_MEMBER; |
|
152 | 152 | |
153 | 153 | if ($level === DeprecatedMember::LEVEL_OWNER) { |
154 | 154 | if (isset($this->circleHasAdmin[$this->circlesById[$row['group_id']]])) { |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | } |
246 | 246 | |
247 | 247 | $expr = $qb->expr(); |
248 | - $pf = '' . $this->default_select_alias . '.'; |
|
248 | + $pf = ''.$this->default_select_alias.'.'; |
|
249 | 249 | |
250 | 250 | /** @noinspection PhpMethodParametersCountMismatchInspection */ |
251 | 251 | $qb->selectAlias('u.user_id', 'viewer_userid') |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | ->leftJoin( |
260 | 260 | $this->default_select_alias, DeprecatedRequestBuilder::TABLE_MEMBERS, 'u', |
261 | 261 | $expr->andX( |
262 | - $expr->eq('u.circle_id', $pf . 'unique_id'), |
|
262 | + $expr->eq('u.circle_id', $pf.'unique_id'), |
|
263 | 263 | $expr->eq('u.user_id', $qb->createNamedParameter($userId)), |
264 | 264 | $expr->eq('u.instance', $qb->createNamedParameter($instanceId)), |
265 | 265 | $expr->eq('u.user_type', $qb->createNamedParameter($type)) |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | } |
282 | 282 | |
283 | 283 | $expr = $qb->expr(); |
284 | - $pf = $this->default_select_alias . '.'; |
|
284 | + $pf = $this->default_select_alias.'.'; |
|
285 | 285 | |
286 | 286 | /** @noinspection PhpMethodParametersCountMismatchInspection */ |
287 | 287 | $qb->selectAlias('o.user_id', 'owner_userid') |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | ->leftJoin( |
295 | 295 | $this->default_select_alias, DeprecatedRequestBuilder::TABLE_MEMBERS, 'o', |
296 | 296 | $expr->andX( |
297 | - $expr->eq('o.circle_id', $pf . 'unique_id'), |
|
297 | + $expr->eq('o.circle_id', $pf.'unique_id'), |
|
298 | 298 | $expr->eq('o.level', $qb->createNamedParameter(DeprecatedMember::LEVEL_OWNER)), |
299 | 299 | $expr->eq('o.user_type', $qb->createNamedParameter(DeprecatedMember::TYPE_USER)) |
300 | 300 | ) |
@@ -203,7 +203,7 @@ |
||
203 | 203 | $cursor->closeCursor(); |
204 | 204 | |
205 | 205 | if ($data === false) { |
206 | - throw new CircleDoesNotExistException($this->l10n->t('Circle not found ' . $circleUniqueId)); |
|
206 | + throw new CircleDoesNotExistException($this->l10n->t('Circle not found '.$circleUniqueId)); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | $circle = $this->parseCirclesSelectSql($data); |
@@ -348,8 +348,8 @@ discard block |
||
348 | 348 | $expr = $qb->expr(); |
349 | 349 | |
350 | 350 | if ($pf === '') { |
351 | - $p = ($qb->getType() === QueryBuilder::SELECT) ? $this->default_select_alias . '.' : ''; |
|
352 | - $qb->andWhere($expr->gte($p . 'level', $qb->createNamedParameter($level))); |
|
351 | + $p = ($qb->getType() === QueryBuilder::SELECT) ? $this->default_select_alias.'.' : ''; |
|
352 | + $qb->andWhere($expr->gte($p.'level', $qb->createNamedParameter($level))); |
|
353 | 353 | |
354 | 354 | return; |
355 | 355 | } |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | if ($p === 'g' && !$this->leftJoinedNCGroupAndUser) { |
379 | 379 | continue; |
380 | 380 | } |
381 | - $orX->add($expr->gte($p . '.level', $qb->createNamedParameter($level))); |
|
381 | + $orX->add($expr->gte($p.'.level', $qb->createNamedParameter($level))); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | return $orX; |
@@ -393,12 +393,12 @@ discard block |
||
393 | 393 | protected function limitToMembersAndAlmost(IQueryBuilder $qb) { |
394 | 394 | $expr = $qb->expr(); |
395 | 395 | |
396 | - $pf = ($qb->getType() === QueryBuilder::SELECT) ? $this->default_select_alias . '.' : ''; |
|
396 | + $pf = ($qb->getType() === QueryBuilder::SELECT) ? $this->default_select_alias.'.' : ''; |
|
397 | 397 | |
398 | 398 | $orX = $expr->orX(); |
399 | - $orX->add($expr->eq($pf . 'status', $qb->createNamedParameter(DeprecatedMember::STATUS_MEMBER))); |
|
400 | - $orX->add($expr->eq($pf . 'status', $qb->createNamedParameter(DeprecatedMember::STATUS_INVITED))); |
|
401 | - $orX->add($expr->eq($pf . 'status', $qb->createNamedParameter(DeprecatedMember::STATUS_REQUEST))); |
|
399 | + $orX->add($expr->eq($pf.'status', $qb->createNamedParameter(DeprecatedMember::STATUS_MEMBER))); |
|
400 | + $orX->add($expr->eq($pf.'status', $qb->createNamedParameter(DeprecatedMember::STATUS_INVITED))); |
|
401 | + $orX->add($expr->eq($pf.'status', $qb->createNamedParameter(DeprecatedMember::STATUS_REQUEST))); |
|
402 | 402 | |
403 | 403 | $qb->andWhere($orX); |
404 | 404 | } |
@@ -411,8 +411,8 @@ discard block |
||
411 | 411 | */ |
412 | 412 | public function limitToDBField(IQueryBuilder $qb, $field, $value) { |
413 | 413 | $expr = $qb->expr(); |
414 | - $pf = ($qb->getType() === QueryBuilder::SELECT) ? $this->default_select_alias . '.' : ''; |
|
415 | - $qb->andWhere($expr->eq($pf . $field, $qb->createNamedParameter($value))); |
|
414 | + $pf = ($qb->getType() === QueryBuilder::SELECT) ? $this->default_select_alias.'.' : ''; |
|
415 | + $qb->andWhere($expr->eq($pf.$field, $qb->createNamedParameter($value))); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | |
@@ -423,8 +423,8 @@ discard block |
||
423 | 423 | */ |
424 | 424 | private function limitToDBFieldOrGreater(IQueryBuilder $qb, $field, $value) { |
425 | 425 | $expr = $qb->expr(); |
426 | - $pf = ($qb->getType() === QueryBuilder::SELECT) ? $this->default_select_alias . '.' : ''; |
|
427 | - $qb->andWhere($expr->gte($pf . $field, $qb->createNamedParameter($value))); |
|
426 | + $pf = ($qb->getType() === QueryBuilder::SELECT) ? $this->default_select_alias.'.' : ''; |
|
427 | + $qb->andWhere($expr->gte($pf.$field, $qb->createNamedParameter($value))); |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | |
@@ -439,9 +439,9 @@ discard block |
||
439 | 439 | protected function limitToNCGroupUser(IQueryBuilder $qb, $userId = '') { |
440 | 440 | $expr = $qb->expr(); |
441 | 441 | |
442 | - $pf = ($qb->getType() === QueryBuilder::SELECT) ? $this->default_select_alias . '.' : ''; |
|
442 | + $pf = ($qb->getType() === QueryBuilder::SELECT) ? $this->default_select_alias.'.' : ''; |
|
443 | 443 | |
444 | - $and = $expr->andX($expr->eq($pf . 'user_id', 'ncgu.gid')); |
|
444 | + $and = $expr->andX($expr->eq($pf.'user_id', 'ncgu.gid')); |
|
445 | 445 | if ($userId !== '') { |
446 | 446 | $and->add($expr->eq('ncgu.uid', $qb->createNamedParameter($userId))); |
447 | 447 | } else { |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | } |
465 | 465 | |
466 | 466 | $expr = $qb->expr(); |
467 | - $pf = $this->default_select_alias . '.'; |
|
467 | + $pf = $this->default_select_alias.'.'; |
|
468 | 468 | |
469 | 469 | /** @noinspection PhpMethodParametersCountMismatchInspection */ |
470 | 470 | $qb->selectAlias('lc.type', 'circle_type') |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | ->selectAlias('lc.settings', 'circle_settings') |
474 | 474 | ->leftJoin( |
475 | 475 | $this->default_select_alias, DeprecatedRequestBuilder::TABLE_CIRCLES, 'lc', |
476 | - $expr->eq($pf . 'circle_id', 'lc.unique_id') |
|
476 | + $expr->eq($pf.'circle_id', 'lc.unique_id') |
|
477 | 477 | ); |
478 | 478 | } |
479 | 479 |
@@ -299,7 +299,7 @@ |
||
299 | 299 | |
300 | 300 | |
301 | 301 | /** |
302 | - * @param array $members |
|
302 | + * @param Member[] $members |
|
303 | 303 | * |
304 | 304 | * @return self |
305 | 305 | */ |
@@ -78,22 +78,22 @@ discard block |
||
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 |
||
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); |