Since: 2025-02-24

class LocationCode implements Stringable (View source)

This class represents a warehouse location identified by warehouse, rack, and shelf. The location code is generated from these properties.

Methods

string
locationCode()

Get the location code.

static LocationCode
of(string|array|null $warehouse = null, string|null $rack = null, string|null $shelf = null)

Create a new Location instance.

string
__toString()

Get the string representation of the location code.

Details

string locationCode()

Get the location code.

Return Value

string

The method returns the location code

Examples

print LocationCode::of(warehouse: 'AUK', rack: 'R3', shelf: 'S32')->locationCode();

static LocationCode of(string|array|null $warehouse = null, string|null $rack = null, string|null $shelf = null)

Create a new Location instance.

Parameters

string|array|null $warehouse

Warehouse ID or array of arguments

string|null $rack Rack
string|null $shelf Shelf

Return Value

LocationCode

Provides fluent interface

Exceptions

InvalidArgumentException

string __toString()

Get the string representation of the location code.

Return Value

string

The magic method returns the location code

Examples

print LocationCode::of(warehouse: 'A1') => 'A1'
print LocationCode::of(warehouse: 'A1', rack: 'B3') => 'A1-B3'