Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Lib\Units\BaseUnitStorage Class Reference

Basic unit storage functionality. More...

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

Public Member Functions

 isPrimaryUnit ( $unit)
 Check if certain unit is primary.
 
 getConversion ( $unit)
 Get conversion from this unit to primary unit.
 

Protected Member Functions

 loadStorageData ()
 Load data from concrete storage.
 

Private Member Functions

 loadData ()
 Load data from storage.
 

Private Attributes

 $storageData
 

Detailed Description

Basic unit storage functionality.

Concrete classes need to fill in data loading.

Author
Stas Malyshev

Member Function Documentation

◆ getConversion()

Wikibase\Lib\Units\BaseUnitStorage::getConversion (   $unit)

Get conversion from this unit to primary unit.

Parameters
string$unit
Returns
array|null 'factor' => factor from this unit to primary unit 'unit' => primary unit

Implements Wikibase\Lib\Units\UnitStorage.

◆ isPrimaryUnit()

Wikibase\Lib\Units\BaseUnitStorage::isPrimaryUnit (   $unit)

Check if certain unit is primary.

Parameters
string$unit
Returns
bool

Implements Wikibase\Lib\Units\UnitStorage.

◆ loadData()

Wikibase\Lib\Units\BaseUnitStorage::loadData ( )
private

Load data from storage.

◆ loadStorageData()

Wikibase\Lib\Units\BaseUnitStorage::loadStorageData ( )
abstractprotected

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 in Wikibase\Lib\Units\CSVUnitStorage, Wikibase\Lib\Units\InMemoryUnitStorage, and Wikibase\Lib\Units\JsonUnitStorage.

Member Data Documentation

◆ $storageData

Wikibase\Lib\Units\BaseUnitStorage::$storageData
private

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