wikimedia/mediawiki-extensions-Wikibase

View on GitHub
lib/includes/Units/UnitStorage.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace Wikibase\Lib\Units;

/**
 * Storage interface for Unit conversion information.
 *
 * @license GPL-2.0-or-later
 * @author Stas Malyshev
 */
interface UnitStorage {

    /**
     * Check if the unit is primary
     * @param string $unit
     * @return bool
     */
    public function isPrimaryUnit( $unit );

    /**
     * Get conversion from this unit to primary unit
     * @param string $unit
     * @return array|null [ 'factor'=>$quantity, 'unit'=>$targetUnit ]
     *                    or null if no conversion available or needed
     */
    public function getConversion( $unit );

}