PHP 클래스 HTMLPurifier_UnitConverter, yii

파일 보기 프로젝트 열기: yiisoft/yii 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$internalPrecision Bcmath precision for internal calculations.
$outputPrecision Minimum bcmath precision for output.
$units 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.)

공개 메소드들

메소드 설명
__construct ( $output_precision = 4, $internal_precision = 10, $force_no_bcmath = false )
convert ( HTMLPurifier_Length $length, string $to_unit ) : HTMLPurifier_Length | boolean Converts a length object of one unit into another unit.
getSigFigs ( string $n ) : integer Returns the number of significant figures in a string number.

비공개 메소드들

메소드 설명
add ( string $s1, string $s2, integer $scale ) : string Adds two numbers, using arbitrary precision when available.
div ( string $s1, string $s2, integer $scale ) : string Divides two numbers, using arbitrary precision when available.
mul ( string $s1, string $s2, integer $scale ) : string Multiples two numbers, using arbitrary precision when available.
round ( float $n, integer $sigfigs ) : string Rounds a number according to the number of sigfigs it should have, using arbitrary precision when available.
scale ( float $r, integer $scale ) : string Scales a float to $scale digits right of decimal point, like BCMath.

메소드 상세

__construct() 공개 메소드

public __construct ( $output_precision = 4, $internal_precision = 10, $force_no_bcmath = false )

convert() 공개 메소드

Converts a length object of one unit into another unit.
public convert ( HTMLPurifier_Length $length, string $to_unit ) : HTMLPurifier_Length | boolean
$length HTMLPurifier_Length Instance of HTMLPurifier_Length to convert. You must validate() it before passing it here!
$to_unit string Unit to convert to.
리턴 HTMLPurifier_Length | boolean

getSigFigs() 공개 메소드

Returns the number of significant figures in a string number.
public getSigFigs ( string $n ) : integer
$n string Decimal number
리턴 integer number of sigfigs

프로퍼티 상세

$internalPrecision 보호되어 있는 프로퍼티

Bcmath precision for internal calculations.
protected $internalPrecision

$outputPrecision 보호되어 있는 프로퍼티

Minimum bcmath precision for output.
protected $outputPrecision

$units 보호되어 있는 정적으로 프로퍼티

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.)
protected static $units