Builders
CompanyBuilder
Fluent builder for constructing Company entries with contact details, addresses and statements.
Namespace and purpose
Imoli\EflLeasingSdk\Builder\CompanyBuilder is a fluent helper for building Company instances.
It aggregates emails, phones, contact persons, addresses and customer data statements for a company.
Class definition
- Namespace:
Imoli\EflLeasingSdk\Builder - Class: final
CompanyBuilder - Builds:
Imoli\EflLeasingSdk\Model\Customer\Company
namespace Imoli\EflLeasingSdk\Builder;
use Imoli\EflLeasingSdk\Model\Customer\Address;
use Imoli\EflLeasingSdk\Model\Customer\Company;
use Imoli\EflLeasingSdk\Model\Customer\CustomerDataStatement;
use Imoli\EflLeasingSdk\Model\Customer\EmailAddress;
use Imoli\EflLeasingSdk\Model\Customer\Person;
use Imoli\EflLeasingSdk\Model\Customer\Phone;
final class CompanyBuilder
{
public function __construct(string $guid, string $nip);
public function addEmail(EmailAddress $email): self;
public function addPhone(Phone $phone): self;
public function addPerson(Person $person): self;
public function addAddress(Address $address): self;
public function addStatement(CustomerDataStatement $statement): self;
public function build(): Company;
}
Fluent API
- __construct(string $guid, string $nip)
Initialises the builder with the required company GUID and tax identifier (NIP). - addEmail(EmailAddress $email): self
Appends anEmailAddressentry to the company. - addPhone(Phone $phone): self
Appends aPhoneentry to the company. - addPerson(Person $person): self
Appends aPersonassociated with the company. - addAddress(Address $address): self
Appends anAddressentry (e.g. registered office, correspondence). - addStatement(CustomerDataStatement $statement): self
Appends aCustomerDataStatementdescribing a consent/statement. - build(): Company
- Uses the GUID, NIP and all collected arrays (
emails,phones,persons,addresses,statements). - Returns a new
Companyinstance without additional validation – it is up to the caller to provide required data.
- Uses the GUID, NIP and all collected arrays (
Usage example
use Imoli\EflLeasingSdk\Builder\CompanyBuilder;
$company = (new CompanyBuilder('company-guid', '1234567890'))
->addEmail($email)
->addPhone($phone)
->addAddress($address)
->addPerson($person)
->addStatement($statement)
->build();