MediaWiki Wikibase extension
Wikibase\Lib\Units\InMemoryUnitStorage Class Reference

Array-based static unit storage. More...

+ Inheritance diagram for Wikibase\Lib\Units\InMemoryUnitStorage:
+ Collaboration diagram for Wikibase\Lib\Units\InMemoryUnitStorage:

Public Member Functions

 __construct (array $data=null)
- Public Member Functions inherited from Wikibase\Lib\Units\BaseUnitStorage
 isPrimaryUnit ( $unit)
 Check if certain unit is primary. More...
 getConversion ( $unit)
 Get conversion from this unit to primary unit. More...

Protected Member Functions

 loadStorageData ()
 Load data from concrete storage. More...

Private Attributes


Detailed Description

Array-based static unit storage.

Mostly useful for tests.

Lucas Werkmeister

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Units\InMemoryUnitStorage::__construct ( array  $data = null)
array[] | null$dataThe data for the unit storage, a map from unit to an array of the form [ 'factor' => $factor, 'unit' => $unit ]. 'null' simulates a failure to load data.

Member Function Documentation

◆ loadStorageData()

Wikibase\Lib\Units\InMemoryUnitStorage::loadStorageData ( )

Load data from concrete storage.

The method should return array indexed by source unit. Each row should be either [<factor>, <unit>] or ['factor' => <factor>, 'unit' => <unit>]

array[]|null null when loading failed.

Reimplemented from Wikibase\Lib\Units\BaseUnitStorage.

Member Data Documentation

◆ $data


The documentation for this class was generated from the following file: