reformat code

Cette révision appartient à :
Daniel Seifert 2025-01-02 23:52:24 +01:00
Parent 880608ed64
révision 0110a3b7b9
Signé par: DanielS
ID de la clé GPG: 6A513E13AEE66170
3 fichiers modifiés avec 15 ajouts et 14 suppressions

Voir le fichier

@ -313,7 +313,7 @@ class Subscriber extends ArrayCollection
}
/**
* @return ?bool
* @return null|bool
* @throws BaseException
*/
public function persist(): ?bool
@ -339,18 +339,18 @@ class Subscriber extends ArrayCollection
return;
}
$currentTags = $this->endpoint->get( $this->getId() )->getTags();
$currentTags = $this->endpoint->get($this->getId())->getTags();
$removeTags = array_diff( $currentTags->toArray(), $this->getTags()->toArray() );
if ( count( $removeTags ) ) {
foreach ( $removeTags as $removeTag ) {
$this->endpoint->untag( $this->getEmailAddress(), $removeTag );
$removeTags = array_diff($currentTags->toArray(), $this->getTags()->toArray());
if (count($removeTags)) {
foreach ($removeTags as $removeTag) {
$this->endpoint->untag($this->getEmailAddress(), $removeTag);
}
}
$addTags = array_diff( $this->getTags()->toArray(), $currentTags->toArray() );
if ( count( $addTags ) ) {
$this->endpoint->tag( $this->getEmailAddress(), array_diff( $this->getTags()->toArray(), $currentTags->toArray() ) );
$addTags = array_diff($this->getTags()->toArray(), $currentTags->toArray());
if (count($addTags)) {
$this->endpoint->tag($this->getEmailAddress(), $addTags);
}
}

Voir le fichier

@ -59,10 +59,10 @@ class Tag extends ArrayCollection
}
/**
* @return bool
* @return null|bool
* @throws BaseException
*/
public function persist(): bool
public function persist(): ?bool
{
return $this->endpoint?->update(
$this->getId(),

Voir le fichier

@ -626,8 +626,7 @@ class SubscriberTest extends TestCase
?array $newTagList,
InvokedCount $removeTagInvocation,
InvokedCount $setTagInvocation
)
{
) {
$entityMock = $this->getMockBuilder(Subscriber::class)
->disableOriginalConstructor()
->onlyMethods(['getTags'])
@ -646,7 +645,9 @@ class SubscriberTest extends TestCase
$endpointMock->expects($removeTagInvocation)->method('untag')->willReturn(true);
$sut = new Subscriber(['id' => 'foo', 'email' => 'mymail@mydomain.tld'], $endpointSet ? $endpointMock : null);
if ($newTagList) $sut->set('tags', $newTagList);
if ($newTagList) {
$sut->set('tags', $newTagList);
}
$this->callMethod(
$sut,