UnitService

Namespace

IO\Services

Constants
Type Name Value Description

int

METER

1

int

DECIMETER

2

int

CENTIMETER

3

int

MILLIMETER

4

Properties
Type Name Description

UnitNameRepositoryContract

$unitNameRepository

``

$defaultLang

array

$aMeasureUnits

``

$cache

Methods
public __construct($unitRepository)

UnitService constructor.

Parameters

Type

Name

Description

UnitNameRepositoryContract

$unitRepository

public getUnitById($unitId, $lang = "de"):UnitName

Get the unit by ID

Parameters

Type

Name

Description

int

$unitId

string

$lang

public getUnitNameByKey()
public static isValidUnit($sUnit):bool

Checks if the given string unit is a valid one for the PlentyDimension.

Parameters

Type

Name

Description

string

$sUnit

The unit to be checked

public static getHTML4Unit($sUnit = "SMM"):string

Returns HTML code for the unit ('m','cm' o'MM')

Parameters

Type

Name

Description

string

$sUnit

One of 'MTK', 'SCM', 'SMM'

public fromMemoryCache()
public resetMemoryCache($key = null)
Parameters

Type

Name

Description

``

$key