Öffentliche Methoden | |
__construct ($output_precision=4, $internal_precision=10, $force_no_bcmath=false) | |
convert ($length, $to_unit) | |
getSigFigs ($n) | |
Datenfelder | |
const | ENGLISH = 1 |
const | METRIC = 2 |
const | DIGITAL = 3 |
Geschützte Attribute | |
$outputPrecision | |
$internalPrecision | |
Statische, geschützte Attribute | |
static | $units |
Private Methoden | |
add ($s1, $s2, $scale) | |
mul ($s1, $s2, $scale) | |
div ($s1, $s2, $scale) | |
round ($n, $sigfigs) | |
scale ($r, $scale) | |
Private Attribute | |
$bcmath | |
Class for converting between different unit-lengths as specified by CSS.
Definiert in Zeile 7 der Datei UnitConverter.php.
__construct | ( | $output_precision = 4 , |
|
$internal_precision = 10 , |
|||
$force_no_bcmath = false |
|||
) |
Definiert in Zeile 56 der Datei UnitConverter.php.
|
private |
Adds two numbers, using arbitrary precision when available.
string | $s1 | |
string | $s2 | |
int | $scale |
Definiert in Zeile 214 der Datei UnitConverter.php.
Benutzt scale().
convert | ( | $length, | |
$to_unit | |||
) |
Converts a length object of one unit into another unit.
HTMLPurifier_Length | $length | Instance of HTMLPurifier_Length to convert. You must validate() it before passing it here! |
string | $to_unit | Unit to convert to. |
Definiert in Zeile 82 der Datei UnitConverter.php.
Benutzt $outputPrecision, div(), getSigFigs(), mul() und round().
|
private |
Divides two numbers, using arbitrary precision when available.
string | $s1 | |
string | $s2 | |
int | $scale |
Definiert in Zeile 246 der Datei UnitConverter.php.
Benutzt scale().
Wird benutzt von convert().
getSigFigs | ( | $n) |
Returns the number of significant figures in a string number.
string | $n | Decimal number |
Definiert in Zeile 192 der Datei UnitConverter.php.
Wird benutzt von convert().
|
private |
Multiples two numbers, using arbitrary precision when available.
string | $s1 | |
string | $s2 | |
int | $scale |
Definiert in Zeile 230 der Datei UnitConverter.php.
Benutzt scale().
Wird benutzt von convert().
|
private |
Rounds a number according to the number of sigfigs it should have, using arbitrary precision when available.
float | $n | |
int | $sigfigs |
Definiert in Zeile 262 der Datei UnitConverter.php.
Benutzt scale().
Wird benutzt von convert() und scale().
|
private |
Scales a float to $scale digits right of decimal point, like BCMath.
float | $r | |
int | $scale |
Definiert in Zeile 289 der Datei UnitConverter.php.
Benutzt round().
Wird benutzt von add(), div(), mul() und round().
|
private |
Whether or not BCMath is available. bool
Definiert in Zeile 54 der Datei UnitConverter.php.
|
protected |
Bcmath precision for internal calculations. int
Definiert in Zeile 48 der Datei UnitConverter.php.
|
protected |
Minimum bcmath precision for output. int
Definiert in Zeile 42 der Datei UnitConverter.php.
Wird benutzt von convert().
|
staticprotected |
Units information array. Units are grouped into measuring systems (English, Metric), and are assigned an integer representing the conversion factor between that unit and the smallest unit in the system. Numeric indexes are actually magical constants that encode conversion data from one system to the next, with a O(n^2) constraint on memory (this is generally not a problem, since the number of measuring systems is small.)
Definiert in Zeile 23 der Datei UnitConverter.php.
const DIGITAL = 3 |
Definiert in Zeile 12 der Datei UnitConverter.php.
const ENGLISH = 1 |
Definiert in Zeile 10 der Datei UnitConverter.php.
const METRIC = 2 |
Definiert in Zeile 11 der Datei UnitConverter.php.