-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddressValueObject.php
More file actions
43 lines (34 loc) · 988 Bytes
/
AddressValueObject.php
File metadata and controls
43 lines (34 loc) · 988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/*
* Copyright (c) Fusonic GmbH. All rights reserved.
* Licensed under the MIT License. See LICENSE file in the project root for license information.
*/
declare(strict_types=1);
namespace Fusonic\DDDExtensions\Tests\Domain;
use Fusonic\DDDExtensions\Domain\Model\ValueObject;
final readonly class AddressValueObject extends ValueObject implements \Stringable
{
public function __construct(
private string $street,
private string $number,
) {
}
public function getStreet(): string
{
return $this->street;
}
public function getNumber(): string
{
return $this->number;
}
public function equals(ValueObject $object): bool
{
return $object instanceof self
&& $object->getStreet() === $this->street
&& $object->getNumber() === $this->number;
}
public function __toString(): string
{
return \sprintf('%s, %s', $this->street, $this->number);
}
}