EFL
Builders

EmailAddressBuilder

Fluent builder for constructing EmailAddress entries for a company or person.

Namespace and purpose

Imoli\EflLeasingSdk\Builder\EmailAddressBuilder is a fluent helper for building EmailAddress instances. It is used inside Company and Person to represent email contacts.

Class definition

  • Namespace: Imoli\EflLeasingSdk\Builder
  • Class: final EmailAddressBuilder
  • Builds: Imoli\EflLeasingSdk\Model\Customer\EmailAddress
namespace Imoli\EflLeasingSdk\Builder;

use Imoli\EflLeasingSdk\Model\Customer\EmailAddress;

final class EmailAddressBuilder
{
    public function withGuid(string $guid): self;
    public function withEmail(string $email): self;
    public function withTypeId(string $typeId): self;

    public function build(): EmailAddress;

    public static function create(string $guid, string $email, string $typeId): self;
}

Fluent API

  • withGuid(string $guid): self – sets the email entry identifier.
  • withEmail(string $email): self – sets the email address string.
  • withTypeId(string $typeId): self – sets the email type (e.g. business, billing).
  • build(): EmailAddress
    • Requires all of: guid, email, typeId.
    • Throws \LogicException when any of them is missing.
    • Returns a new EmailAddress instance.
  • static create(string $guid, string $email, string $typeId): self
    Convenience factory that initialises the builder with all required fields.

Usage example

use Imoli\EflLeasingSdk\Builder\EmailAddressBuilder;

$email = EmailAddressBuilder::create('email-guid', 'user@example.com', 'BUSINESS')
    ->build();