@@ -162,16 +162,16 @@ discard block |
||
162 | 162 | $this->generateMemberSelectAlias($alias, self::PREFIX_MEMBER) |
163 | 163 | ->leftJoin( |
164 | 164 | $this->getDefaultSelectAlias(), CoreRequestBuilder::TABLE_MEMBER, $alias, |
165 | - $expr->eq($alias . '.circle_id', $this->getDefaultSelectAlias() . '.unique_id') |
|
165 | + $expr->eq($alias.'.circle_id', $this->getDefaultSelectAlias().'.unique_id') |
|
166 | 166 | ); |
167 | 167 | |
168 | 168 | // TODO: Check in big table if it is better to put condition in andWhere() or in LeftJoin() |
169 | 169 | $this->andWhere( |
170 | 170 | $expr->andX( |
171 | - $expr->eq($alias . '.user_id', $this->createNamedParameter($member->getUserId())), |
|
172 | - $expr->eq($alias . '.user_type', $this->createNamedParameter($member->getUserType())), |
|
173 | - $expr->eq($alias . '.instance', $this->createNamedParameter($this->getInstance($member))), |
|
174 | - $expr->gte($alias . '.level', $this->createNamedParameter($level)) |
|
171 | + $expr->eq($alias.'.user_id', $this->createNamedParameter($member->getUserId())), |
|
172 | + $expr->eq($alias.'.user_type', $this->createNamedParameter($member->getUserType())), |
|
173 | + $expr->eq($alias.'.instance', $this->createNamedParameter($this->getInstance($member))), |
|
174 | + $expr->gte($alias.'.level', $this->createNamedParameter($level)) |
|
175 | 175 | ) |
176 | 176 | ); |
177 | 177 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | ->leftJoin( |
193 | 193 | $this->getDefaultSelectAlias(), CoreRequestBuilder::TABLE_CIRCLE, $alias, |
194 | 194 | $expr->andX( |
195 | - $expr->eq($alias . '.unique_id', $this->getDefaultSelectAlias() . '.circle_id') |
|
195 | + $expr->eq($alias.'.unique_id', $this->getDefaultSelectAlias().'.circle_id') |
|
196 | 196 | ) |
197 | 197 | ); |
198 | 198 | |
@@ -222,8 +222,8 @@ discard block |
||
222 | 222 | ->leftJoin( |
223 | 223 | $circleTableAlias, CoreRequestBuilder::TABLE_MEMBER, $alias, |
224 | 224 | $expr->andX( |
225 | - $expr->eq($alias . '.circle_id', $circleTableAlias . '.unique_id'), |
|
226 | - $expr->eq($alias . '.level', $this->createNamedParameter(Member::LEVEL_OWNER)) |
|
225 | + $expr->eq($alias.'.circle_id', $circleTableAlias.'.unique_id'), |
|
226 | + $expr->eq($alias.'.level', $this->createNamedParameter(Member::LEVEL_OWNER)) |
|
227 | 227 | ) |
228 | 228 | ); |
229 | 229 | } |
@@ -249,11 +249,11 @@ discard block |
||
249 | 249 | ->leftJoin( |
250 | 250 | $aliasCircle, CoreRequestBuilder::TABLE_MEMBER, $alias, |
251 | 251 | $expr->andX( |
252 | - $expr->eq($alias . '.circle_id', $aliasCircle . '.unique_id'), |
|
253 | - $expr->eq($alias . '.user_id', $this->createNamedParameter($initiator->getUserId())), |
|
254 | - $expr->eq($alias . '.user_type', $this->createNamedParameter($initiator->getUserType())), |
|
252 | + $expr->eq($alias.'.circle_id', $aliasCircle.'.unique_id'), |
|
253 | + $expr->eq($alias.'.user_id', $this->createNamedParameter($initiator->getUserId())), |
|
254 | + $expr->eq($alias.'.user_type', $this->createNamedParameter($initiator->getUserType())), |
|
255 | 255 | $expr->eq( |
256 | - $alias . '.instance', $this->createNamedParameter($this->getInstance($initiator)) |
|
256 | + $alias.'.instance', $this->createNamedParameter($this->getInstance($initiator)) |
|
257 | 257 | ) |
258 | 258 | ) |
259 | 259 | ); |
@@ -276,9 +276,9 @@ discard block |
||
276 | 276 | $this->leftJoin( |
277 | 277 | $this->getDefaultSelectAlias(), CoreRequestBuilder::TABLE_MEMBER, $alias, |
278 | 278 | $expr->andX( |
279 | - $expr->eq($alias . '.circle_id', $this->getDefaultSelectAlias() . '.unique_id'), |
|
280 | - $expr->eq($alias . '.instance', $this->createNamedParameter($instance)), |
|
281 | - $expr->gte($alias . '.level', $this->createNamedParameter(Member::LEVEL_MEMBER)) |
|
279 | + $expr->eq($alias.'.circle_id', $this->getDefaultSelectAlias().'.unique_id'), |
|
280 | + $expr->eq($alias.'.instance', $this->createNamedParameter($instance)), |
|
281 | + $expr->gte($alias.'.level', $this->createNamedParameter(Member::LEVEL_MEMBER)) |
|
282 | 282 | ) |
283 | 283 | ); |
284 | 284 | } |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | $expr = $this->expr(); |
299 | 299 | $this->leftJoin( |
300 | 300 | $this->getDefaultSelectAlias(), CoreRequestBuilder::TABLE_REMOTE, $alias, |
301 | - $expr->eq($alias . '.instance', $this->createNamedParameter($instance)) |
|
301 | + $expr->eq($alias.'.instance', $this->createNamedParameter($instance)) |
|
302 | 302 | ); |
303 | 303 | } |
304 | 304 | |
@@ -317,15 +317,15 @@ discard block |
||
317 | 317 | // - 4 (Visible to everyone) |
318 | 318 | $orX = $expr->orX(); |
319 | 319 | $orX->add( |
320 | - $expr->andX($expr->gte($alias . '.level', $this->createNamedParameter(Member::LEVEL_MEMBER))) |
|
320 | + $expr->andX($expr->gte($alias.'.level', $this->createNamedParameter(Member::LEVEL_MEMBER))) |
|
321 | 321 | ); |
322 | 322 | $orX->add( |
323 | 323 | $expr->andX( |
324 | - $expr->bitwiseAnd($aliasCircle . '.config', Circle::CFG_PERSONAL), |
|
325 | - $expr->eq($alias . '.level', $this->createNamedParameter(Member::LEVEL_OWNER)) |
|
324 | + $expr->bitwiseAnd($aliasCircle.'.config', Circle::CFG_PERSONAL), |
|
325 | + $expr->eq($alias.'.level', $this->createNamedParameter(Member::LEVEL_OWNER)) |
|
326 | 326 | ) |
327 | 327 | ); |
328 | - $orX->add($expr->bitwiseAnd($aliasCircle . '.config', Circle::CFG_VISIBLE)); |
|
328 | + $orX->add($expr->bitwiseAnd($aliasCircle.'.config', Circle::CFG_VISIBLE)); |
|
329 | 329 | $this->andWhere($orX); |
330 | 330 | |
331 | 331 | |
@@ -360,10 +360,10 @@ discard block |
||
360 | 360 | $expr = $this->expr(); |
361 | 361 | |
362 | 362 | $orHidden = $expr->orX(); |
363 | - $orHidden->add($expr->bitwiseAnd($alias . '.config', Circle::CFG_SINGLE)); |
|
364 | - $orHidden->add($expr->bitwiseAnd($alias . '.config', Circle::CFG_HIDDEN)); |
|
365 | - $orHidden->add($expr->bitwiseAnd($alias . '.config', Circle::CFG_BACKEND)); |
|
366 | - $this->andWhere($this->createFunction('NOT') . $orHidden); |
|
363 | + $orHidden->add($expr->bitwiseAnd($alias.'.config', Circle::CFG_SINGLE)); |
|
364 | + $orHidden->add($expr->bitwiseAnd($alias.'.config', Circle::CFG_HIDDEN)); |
|
365 | + $orHidden->add($expr->bitwiseAnd($alias.'.config', Circle::CFG_BACKEND)); |
|
366 | + $this->andWhere($this->createFunction('NOT').$orHidden); |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | |
@@ -392,33 +392,33 @@ discard block |
||
392 | 392 | |
393 | 393 | $orX = $expr->orX(); |
394 | 394 | $orX->add( |
395 | - $expr->eq($alias . '.type', $this->createNamedParameter(RemoteInstance::TYPE_GLOBAL_SCALE)) |
|
395 | + $expr->eq($alias.'.type', $this->createNamedParameter(RemoteInstance::TYPE_GLOBAL_SCALE)) |
|
396 | 396 | ); |
397 | 397 | |
398 | 398 | $orExtOrPassive = $expr->orX(); |
399 | 399 | $orExtOrPassive->add( |
400 | - $expr->eq($alias . '.type', $this->createNamedParameter(RemoteInstance::TYPE_EXTERNAL)) |
|
400 | + $expr->eq($alias.'.type', $this->createNamedParameter(RemoteInstance::TYPE_EXTERNAL)) |
|
401 | 401 | ); |
402 | 402 | if (!$sensitive) { |
403 | 403 | $orExtOrPassive->add( |
404 | - $expr->eq($alias . '.type', $this->createNamedParameter(RemoteInstance::TYPE_PASSIVE)) |
|
404 | + $expr->eq($alias.'.type', $this->createNamedParameter(RemoteInstance::TYPE_PASSIVE)) |
|
405 | 405 | ); |
406 | 406 | } |
407 | 407 | |
408 | 408 | $andExternal = $expr->andX(); |
409 | 409 | $andExternal->add($orExtOrPassive); |
410 | - $andExternal->add($expr->isNotNull($aliasMembers . '.instance')); |
|
410 | + $andExternal->add($expr->isNotNull($aliasMembers.'.instance')); |
|
411 | 411 | |
412 | 412 | $orExtOrTrusted = $expr->orX(); |
413 | 413 | $orExtOrTrusted->add($andExternal); |
414 | 414 | $orExtOrTrusted->add( |
415 | - $expr->eq($alias . '.type', $this->createNamedParameter(RemoteInstance::TYPE_TRUSTED)) |
|
415 | + $expr->eq($alias.'.type', $this->createNamedParameter(RemoteInstance::TYPE_TRUSTED)) |
|
416 | 416 | ); |
417 | 417 | |
418 | 418 | $andTrusted = $expr->andX(); |
419 | 419 | $andTrusted->add($orExtOrTrusted); |
420 | - $andTrusted->add($expr->bitwiseAnd($aliasCircle . '.config', Circle::CFG_FEDERATED)); |
|
421 | - $andTrusted->add($expr->emptyString($aliasOwner . '.instance')); |
|
420 | + $andTrusted->add($expr->bitwiseAnd($aliasCircle.'.config', Circle::CFG_FEDERATED)); |
|
421 | + $andTrusted->add($expr->emptyString($aliasOwner.'.instance')); |
|
422 | 422 | $orX->add($andTrusted); |
423 | 423 | |
424 | 424 | $this->andWhere($orX); |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * @param int $flag |
430 | 430 | */ |
431 | 431 | public function filterConfig(int $flag): void { |
432 | - $this->andWhere($this->expr()->bitwiseAnd($this->getDefaultSelectAlias() . '.config', $flag)); |
|
432 | + $this->andWhere($this->expr()->bitwiseAnd($this->getDefaultSelectAlias().'.config', $flag)); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | |
@@ -440,15 +440,15 @@ discard block |
||
440 | 440 | * @return $this |
441 | 441 | */ |
442 | 442 | private function generateCircleSelectAlias(string $alias, string $prefix): self { |
443 | - $this->selectAlias($alias . '.unique_id', $prefix . 'unique_id') |
|
444 | - ->selectAlias($alias . '.name', $prefix . 'name') |
|
445 | - ->selectAlias($alias . '.alt_name', $prefix . 'alt_name') |
|
446 | - ->selectAlias($alias . '.description', $prefix . 'description') |
|
447 | - ->selectAlias($alias . '.settings', $prefix . 'settings') |
|
448 | - ->selectAlias($alias . '.config', $prefix . 'config') |
|
449 | - ->selectAlias($alias . '.contact_addressbook', $prefix . 'contact_addressbook') |
|
450 | - ->selectAlias($alias . '.contact_groupname', $prefix . 'contact_groupname') |
|
451 | - ->selectAlias($alias . '.creation', $prefix . 'creation'); |
|
443 | + $this->selectAlias($alias.'.unique_id', $prefix.'unique_id') |
|
444 | + ->selectAlias($alias.'.name', $prefix.'name') |
|
445 | + ->selectAlias($alias.'.alt_name', $prefix.'alt_name') |
|
446 | + ->selectAlias($alias.'.description', $prefix.'description') |
|
447 | + ->selectAlias($alias.'.settings', $prefix.'settings') |
|
448 | + ->selectAlias($alias.'.config', $prefix.'config') |
|
449 | + ->selectAlias($alias.'.contact_addressbook', $prefix.'contact_addressbook') |
|
450 | + ->selectAlias($alias.'.contact_groupname', $prefix.'contact_groupname') |
|
451 | + ->selectAlias($alias.'.creation', $prefix.'creation'); |
|
452 | 452 | |
453 | 453 | return $this; |
454 | 454 | } |
@@ -460,20 +460,20 @@ discard block |
||
460 | 460 | * @return $this |
461 | 461 | */ |
462 | 462 | private function generateMemberSelectAlias(string $alias, string $prefix): self { |
463 | - $this->selectAlias($alias . '.circle_id', $prefix . 'circle_id') |
|
464 | - ->selectAlias($alias . '.single_id', $prefix . 'single_id') |
|
465 | - ->selectAlias($alias . '.user_id', $prefix . 'user_id') |
|
466 | - ->selectAlias($alias . '.user_type', $prefix . 'user_type') |
|
467 | - ->selectAlias($alias . '.member_id', $prefix . 'member_id') |
|
468 | - ->selectAlias($alias . '.instance', $prefix . 'instance') |
|
469 | - ->selectAlias($alias . '.cached_name', $prefix . 'cached_name') |
|
470 | - ->selectAlias($alias . '.cached_update', $prefix . 'cached_update') |
|
471 | - ->selectAlias($alias . '.status', $prefix . 'status') |
|
472 | - ->selectAlias($alias . '.level', $prefix . 'level') |
|
473 | - ->selectAlias($alias . '.note', $prefix . 'note') |
|
474 | - ->selectAlias($alias . '.contact_id', $prefix . 'contact_id') |
|
475 | - ->selectAlias($alias . '.contact_meta', $prefix . 'contact_meta') |
|
476 | - ->selectAlias($alias . '.joined', $prefix . 'joined'); |
|
463 | + $this->selectAlias($alias.'.circle_id', $prefix.'circle_id') |
|
464 | + ->selectAlias($alias.'.single_id', $prefix.'single_id') |
|
465 | + ->selectAlias($alias.'.user_id', $prefix.'user_id') |
|
466 | + ->selectAlias($alias.'.user_type', $prefix.'user_type') |
|
467 | + ->selectAlias($alias.'.member_id', $prefix.'member_id') |
|
468 | + ->selectAlias($alias.'.instance', $prefix.'instance') |
|
469 | + ->selectAlias($alias.'.cached_name', $prefix.'cached_name') |
|
470 | + ->selectAlias($alias.'.cached_update', $prefix.'cached_update') |
|
471 | + ->selectAlias($alias.'.status', $prefix.'status') |
|
472 | + ->selectAlias($alias.'.level', $prefix.'level') |
|
473 | + ->selectAlias($alias.'.note', $prefix.'note') |
|
474 | + ->selectAlias($alias.'.contact_id', $prefix.'contact_id') |
|
475 | + ->selectAlias($alias.'.contact_meta', $prefix.'contact_meta') |
|
476 | + ->selectAlias($alias.'.joined', $prefix.'joined'); |
|
477 | 477 | |
478 | 478 | return $this; |
479 | 479 | } |
@@ -548,29 +548,29 @@ discard block |
||
548 | 548 | * @throws MemberNotFoundException |
549 | 549 | */ |
550 | 550 | public function importFromDatabase(array $data, string $prefix = ''): INC21QueryRow { |
551 | - if (!array_key_exists($prefix . 'member_id', $data)) { |
|
551 | + if (!array_key_exists($prefix.'member_id', $data)) { |
|
552 | 552 | throw new MemberNotFoundException(); |
553 | 553 | } |
554 | 554 | |
555 | - $this->setId($this->get($prefix . 'member_id', $data)); |
|
556 | - $this->setCircleId($this->get($prefix . 'circle_id', $data)); |
|
557 | - $this->setSingleId($this->get($prefix . 'single_id', $data)); |
|
558 | - $this->setUserId($this->get($prefix . 'user_id', $data)); |
|
559 | - $this->setUserType($this->getInt($prefix . 'user_type', $data)); |
|
560 | - $this->setInstance($this->get($prefix . 'instance', $data)); |
|
561 | - $this->setLevel($this->getInt($prefix . 'level', $data)); |
|
562 | - $this->setStatus($this->get($prefix . 'status', $data)); |
|
563 | - $this->setCachedName($this->get($prefix . 'cached_name', $data)); |
|
564 | - $this->setNote($this->get($prefix . 'note', $data)); |
|
565 | - $this->setContactId($this->get($prefix . 'contact_id', $data)); |
|
566 | - $this->setContactMeta($this->get($prefix . 'contact_meta', $data)); |
|
567 | - |
|
568 | - $cachedUpdate = $this->get($prefix . 'cached_update', $data); |
|
555 | + $this->setId($this->get($prefix.'member_id', $data)); |
|
556 | + $this->setCircleId($this->get($prefix.'circle_id', $data)); |
|
557 | + $this->setSingleId($this->get($prefix.'single_id', $data)); |
|
558 | + $this->setUserId($this->get($prefix.'user_id', $data)); |
|
559 | + $this->setUserType($this->getInt($prefix.'user_type', $data)); |
|
560 | + $this->setInstance($this->get($prefix.'instance', $data)); |
|
561 | + $this->setLevel($this->getInt($prefix.'level', $data)); |
|
562 | + $this->setStatus($this->get($prefix.'status', $data)); |
|
563 | + $this->setCachedName($this->get($prefix.'cached_name', $data)); |
|
564 | + $this->setNote($this->get($prefix.'note', $data)); |
|
565 | + $this->setContactId($this->get($prefix.'contact_id', $data)); |
|
566 | + $this->setContactMeta($this->get($prefix.'contact_meta', $data)); |
|
567 | + |
|
568 | + $cachedUpdate = $this->get($prefix.'cached_update', $data); |
|
569 | 569 | if ($cachedUpdate !== '') { |
570 | 570 | $this->setCachedUpdate(DateTime::createFromFormat('Y-m-d H:i:s', $cachedUpdate)->getTimestamp()); |
571 | 571 | } |
572 | 572 | |
573 | - $joined = $this->get($prefix . 'joined', $data); |
|
573 | + $joined = $this->get($prefix.'joined', $data); |
|
574 | 574 | if ($joined !== '') { |
575 | 575 | $this->setJoined(DateTime::createFromFormat('Y-m-d H:i:s', $joined)->getTimestamp()); |
576 | 576 | } |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | |
600 | 600 | if (!$level) { |
601 | 601 | $all = implode(', ', array_values(self::$DEF_LEVEL)); |
602 | - throw new MemberLevelException('Available levels: ' . $all); |
|
602 | + throw new MemberLevelException('Available levels: '.$all); |
|
603 | 603 | } |
604 | 604 | |
605 | 605 | return (int)$level; |
@@ -49,11 +49,11 @@ discard block |
||
49 | 49 | |
50 | 50 | use TArrayTools; |
51 | 51 | |
52 | - const TYPE_UNKNOWN = 'Unknown'; // not trusted |
|
53 | - const TYPE_PASSIVE = 'Passive'; // Minimum information about Federated Circles are broadcasted if a member belongs to the circle. |
|
54 | - const TYPE_EXTERNAL = 'External'; // info about Federated Circles and their members are broadcasted if a member belongs to the circle. |
|
55 | - const TYPE_TRUSTED = 'Trusted'; // everything about Federated Circles are broadcasted. |
|
56 | - const TYPE_GLOBAL_SCALE = 'GlobalScale'; // every Circle is broadcasted, |
|
52 | + const TYPE_UNKNOWN = 'Unknown'; // not trusted |
|
53 | + const TYPE_PASSIVE = 'Passive'; // Minimum information about Federated Circles are broadcasted if a member belongs to the circle. |
|
54 | + const TYPE_EXTERNAL = 'External'; // info about Federated Circles and their members are broadcasted if a member belongs to the circle. |
|
55 | + const TYPE_TRUSTED = 'Trusted'; // everything about Federated Circles are broadcasted. |
|
56 | + const TYPE_GLOBAL_SCALE = 'GlobalScale'; // every Circle is broadcasted, |
|
57 | 57 | |
58 | 58 | const TEST = 'test'; |
59 | 59 | const INCOMING = 'incoming'; |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | ]; |
400 | 400 | |
401 | 401 | if ($this->getAuthSigned() !== '') { |
402 | - $data['auth-signed'] = $this->getAlgorithm() . ':' . $this->getAuthSigned(); |
|
402 | + $data['auth-signed'] = $this->getAlgorithm().':'.$this->getAuthSigned(); |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | return array_filter(array_merge($data, parent::jsonSerialize())); |