Wikibase
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

 $data
 

Detailed Description

Array-based static unit storage.

Mostly useful for tests.

Author
Lucas Werkmeister

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Units\InMemoryUnitStorage::__construct ( array  $data = null)
Parameters
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 ( )
protected

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>]

Returns
array[]|null null when loading failed.

Reimplemented from Wikibase\Lib\Units\BaseUnitStorage.

Member Data Documentation

◆ $data

Wikibase\Lib\Units\InMemoryUnitStorage::$data
private

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