Builders
AddressBuilder
Fluent builder for constructing Address entries in customer data.
Namespace and purpose
Imoli\EflLeasingSdk\Builder\AddressBuilder is a fluent helper for building Address instances.
It is used inside Company and Person models to describe postal addresses such as registered office or correspondence address.
Class definition
- Namespace:
Imoli\EflLeasingSdk\Builder - Class: final
AddressBuilder - Builds:
Imoli\EflLeasingSdk\Model\Customer\Address
namespace Imoli\EflLeasingSdk\Builder;
use Imoli\EflLeasingSdk\Model\Customer\Address;
final class AddressBuilder
{
public function withGuid(string $guid): self;
public function withName(string $name): self;
public function withTypeId(string $typeId): self;
public function withCity(string $city): self;
public function withStreet(string $street): self;
public function withHouseNumber(string $houseNumber): self;
public function withPostalCode(string $postalCode): self;
public function withCountryCode(string $countryCode): self;
public function withFlatNumber(?string $flatNumber): self;
public function build(): Address;
public static function create(
string $guid,
string $name,
string $typeId,
string $city,
string $street,
string $houseNumber,
string $postalCode,
string $countryCode
): self;
}
Fluent API
- withGuid(string $guid): self – sets the unique identifier of the address entry.
- withName(string $name): self – sets a human‑readable label (e.g. “Headquarters”).
- withTypeId(string $typeId): self – sets the address type (e.g. registered office, correspondence).
- withCity/withStreet/withHouseNumber/withPostalCode/withCountryCode(...) – set core location components.
- withFlatNumber(?string $flatNumber): self – optionally sets the flat/apartment number.
- build(): Address
- Requires:
guid,name,typeId,city,street,houseNumber,postalCode,countryCode. - Throws
\LogicExceptionif any of them is missing. - Returns a new
Addressinstance.
- Requires:
- static create(...): self
Convenience factory that sets all required fields in a single call.
Usage example
use Imoli\EflLeasingSdk\Builder\AddressBuilder;
$address = AddressBuilder::create(
'addr-guid',
'Headquarters',
'REGISTERED',
'Wroclaw',
'Main Street',
'1A',
'50-000',
'PL'
)
->withFlatNumber('2')
->build();