Skip to content

Commit

Permalink
Add __toString methods to Entities
Browse files Browse the repository at this point in the history
  • Loading branch information
0x46616c6b committed Dec 23, 2023
1 parent 46ffea0 commit dece4ba
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Entity/Alias.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,17 @@ public function clearSensitiveData(): void
$this->user = null;
$this->destination = null;
}

public function __toString()

Check warning on line 71 in src/Entity/Alias.php

View check run for this annotation

Codecov / codecov/patch

src/Entity/Alias.php#L71

Added line #L71 was not covered by tests
{
if ($this->source === null) {
return '';

Check warning on line 74 in src/Entity/Alias.php

View check run for this annotation

Codecov / codecov/patch

src/Entity/Alias.php#L73-L74

Added lines #L73 - L74 were not covered by tests
}

if ($this->random) {
return $this->source . ' -> ' . $this->destination . ' (random)';

Check warning on line 78 in src/Entity/Alias.php

View check run for this annotation

Codecov / codecov/patch

src/Entity/Alias.php#L77-L78

Added lines #L77 - L78 were not covered by tests
}

return $this->source . ' -> ' . $this->destination;

Check warning on line 81 in src/Entity/Alias.php

View check run for this annotation

Codecov / codecov/patch

src/Entity/Alias.php#L81

Added line #L81 was not covered by tests
}
}
5 changes: 5 additions & 0 deletions src/Entity/Voucher.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,9 @@ public function setInvitedUser(User $invitedUser = null): void
{
$this->invitedUser = $invitedUser;
}

public function __toString()

Check warning on line 79 in src/Entity/Voucher.php

View check run for this annotation

Codecov / codecov/patch

src/Entity/Voucher.php#L79

Added line #L79 was not covered by tests
{
return $this->code;

Check warning on line 81 in src/Entity/Voucher.php

View check run for this annotation

Codecov / codecov/patch

src/Entity/Voucher.php#L81

Added line #L81 was not covered by tests
}
}

0 comments on commit dece4ba

Please sign in to comment.