Skip to content

Commit 6159587

Browse files
committed
Added to_string method
1 parent cc8809c commit 6159587

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/PhpValueObject/User/Password.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,12 @@ public function equals(ValueObject $valueObjectToCompare): bool
5454
{
5555
return ($this->pwd() === $valueObjectToCompare->pwd());
5656
}
57+
58+
/**
59+
* @return string
60+
*/
61+
public function __toString()
62+
{
63+
return $this->pwd;
64+
}
5765
}

src/PhpValueObject/User/Username.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ public function username(): string
5050
return $this->username;
5151
}
5252

53+
/**
54+
* @return string
55+
*/
56+
public function __toString()
57+
{
58+
return $this->username;
59+
}
60+
5361
/**
5462
* Compare a value object with another one.
5563
*

0 commit comments

Comments
 (0)