Builders
IdentityDocumentBuilder
Fluent builder for constructing IdentityDocument entries for a person.
Namespace and purpose
Imoli\EflLeasingSdk\Builder\IdentityDocumentBuilder is a fluent helper for building IdentityDocument instances.
It represents a single identity document (e.g. ID card, passport) linked to a Person.
Class definition
- Namespace:
Imoli\EflLeasingSdk\Builder - Class: final
IdentityDocumentBuilder - Builds:
Imoli\EflLeasingSdk\Model\Customer\IdentityDocument
namespace Imoli\EflLeasingSdk\Builder;
use Imoli\EflLeasingSdk\Model\Customer\IdentityDocument;
final class IdentityDocumentBuilder
{
public function withGuid(string $guid): self;
public function withNumber(string $number): self;
public function withIssuer(string $issuer): self;
public function withIssuedOn(string $issuedOn): self;
public function withTypeId(string $typeId): self;
public function withValidTo(?string $validTo): self;
public function build(): IdentityDocument;
public static function create(
string $guid,
string $number,
string $issuer,
string $issuedOn,
string $typeId
): self;
}
Fluent API
- withGuid(string $guid): self – sets the document GUID.
- withNumber(string $number): self – sets the document number.
- withIssuer(string $issuer): self – sets the issuing authority.
- withIssuedOn(string $issuedOn): self – sets the issue date (string as expected by the API).
- withTypeId(string $typeId): self – sets the document type identifier.
- withValidTo(?string $validTo): self – optionally sets the expiry date.
- build(): IdentityDocument
- Requires:
guid,number,issuer,issuedOn,typeId. - Throws
\LogicExceptionif any of them is missing. - Returns a new
IdentityDocumentinstance.
- Requires:
- static create(...): self
Convenience factory that sets all required fields;validTocan be added later viawithValidTo().
Usage example
use Imoli\EflLeasingSdk\Builder\IdentityDocumentBuilder;
$document = IdentityDocumentBuilder::create(
'doc-guid',
'ABC123456',
'Local Authority',
'2015-01-01',
'ID_CARD'
)
->withValidTo('2030-01-01')
->build();