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

JSON based unit conversion storage. More...

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

Public Member Functions

 __construct ( $fileName)
 
- Public Member Functions inherited from Wikibase\Lib\Units\BaseUnitStorage
 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 Attributes

 $sourceFile
 

Detailed Description

JSON based unit conversion storage.

Storage format: Json map, each element is 'Qsource': [ <factor>, 'QstandardUnit' ] Example: { "Q103510": [ "100000", "Q44395" ], "Q130964": [ "4.19", "Q25269" ], "Q182429": [ "1", "Q182429" ] } Q182429 here is a primary unit since source and standard are the same. Primary units must have factor of 1. Another acceptable format is: "Q103510": { "factor": "100000", "unit": "Q44395" },

Author
Stas Malyshev

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Units\JsonUnitStorage::__construct (   $fileName)
Parameters
string$fileNameFilename of the storage file.

Member Function Documentation

◆ loadStorageData()

Wikibase\Lib\Units\JsonUnitStorage::loadStorageData ( )
protected

Load data from concrete storage.

Returns
array[]|null

Reimplemented from Wikibase\Lib\Units\BaseUnitStorage.

Member Data Documentation

◆ $sourceFile

Wikibase\Lib\Units\JsonUnitStorage::$sourceFile
private

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