Since: 2025-02-24

class Location 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 Location
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.

Details

string locationCode()

Get the location code.

Return Value

string

The method returns the location code

Examples

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

static Location 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

Location

Provides fluent interface

Exceptions

InvalidArgumentException

string __toString()

Get the string representation of the location.

Return Value

string

The magic method returns the location code

Examples

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