EFL
Builders

PhoneBuilder

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

Namespace and purpose

Imoli\EflLeasingSdk\Builder\PhoneBuilder is a fluent helper for building Phone instances. It is used inside Company and Person to represent phone numbers with prefix, type and kind.

Class definition

  • Namespace: Imoli\EflLeasingSdk\Builder
  • Class: final PhoneBuilder
  • Builds: Imoli\EflLeasingSdk\Model\Customer\Phone
namespace Imoli\EflLeasingSdk\Builder;

use Imoli\EflLeasingSdk\Model\Customer\Phone;

final class PhoneBuilder
{
    public function withGuid(string $guid): self;
    public function withPrefix(string $prefix): self;
    public function withNumber(string $number): self;
    public function withTypeId(string $typeId): self;
    public function withKindId(string $kindId): self;

    public function build(): Phone;

    public static function create(
        string $guid,
        string $prefix,
        string $number,
        string $typeId,
        string $kindId
    ): self;
}

Fluent API

  • withGuid(string $guid): self – sets the phone entry identifier.
  • withPrefix(string $prefix): self – sets the phone prefix (e.g. country/area code).
  • withNumber(string $number): self – sets the phone number.
  • withTypeId(string $typeId): self – sets the phone type (e.g. mobile, landline).
  • withKindId(string $kindId): self – sets the phone kind (business, private, etc.).
  • build(): Phone
    • Requires: guid, prefix, number, typeId, kindId.
    • Throws \LogicException if any of them is missing.
    • Returns a new Phone instance.
  • static create(...): self
    Convenience factory that sets all required fields in one call.

Usage example

use Imoli\EflLeasingSdk\Builder\PhoneBuilder;

$phone = PhoneBuilder::create('phone-guid', '+48', '123456789', 'MOBILE', 'BUSINESS')
    ->build();