Builders
ItemDetailBuilder
Fluent builder for constructing ItemDetail key–value metadata entries.
Namespace and purpose
Imoli\EflLeasingSdk\Builder\ItemDetailBuilder is a small fluent helper for building ItemDetail instances.
ItemDetail represents a single key–value pair of metadata associated with an OfferItem.
Class definition
- Namespace:
Imoli\EflLeasingSdk\Builder - Class: final
ItemDetailBuilder - Builds:
Imoli\EflLeasingSdk\Model\Calculation\ItemDetail
namespace Imoli\EflLeasingSdk\Builder;
use Imoli\EflLeasingSdk\Model\Calculation\ItemDetail;
final class ItemDetailBuilder
{
public function withId(string $id): self;
public function withValue(string $value): self;
public function build(): ItemDetail;
public static function create(string $id, string $value): self;
}
Fluent API
- withId(string $id): self
Sets the identifier of the detail (e.g. code from the EFL API or your system). - withValue(string $value): self
Sets the textual value of the detail. - build(): ItemDetail
- Requires both
idandvalue. - Throws
\LogicExceptionif any of them is missing. - Returns a new
ItemDetailinstance.
- Requires both
- static create(string $id, string $value): self
Convenience factory that sets bothidandvaluein a single call.
Usage examples
use Imoli\EflLeasingSdk\Builder\ItemDetailBuilder;
$detail = ItemDetailBuilder::create('asset-code', 'Laptop X')->build();
Combined with OfferItemBuilder:
use Imoli\EflLeasingSdk\Builder\OfferItemBuilder;
$offerItem = OfferItemBuilder::create(1, 'asset-guid-1', 23.0, [$detail])
->build();