PHP 클래스 SassNumber

Provides operations and type testing for Sass numbers. Units are of the passed value are converted the those of the class value if it has units. e.g. 2cm + 20mm = 4cm while 2 + 20mm = 22mm.
상속: extends SassLiteral
파일 보기 프로젝트 열기: richthegeek/phpsass 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$inExpression whether this number is in an expression or a literal number Used to determine whether division should take place

공개 메소드들

메소드 설명
__construct ( $value ) : SassNumber class constructor.
coerce ( array $numeratorUnits, array $denominatorUnits ) : SassNumber Returns the value of this number converted to other units.
getDenominatorUnits ( ) : string Returns the denominator units of this number.
getNumeratorUnits ( ) : string Returns the numerator units of this number.
getUnits ( ) : string Returns the units of this number.
getValue ( ) : float Returns the value of this number.
hasLegalUnits ( ) : boolean Returns a value indicating if this number has units that can be represented in CSS.
hasUnits ( ) : boolean Returns a value indicating if this number has units.
isComparableTo ( $other ) : boolean Returns a value indicating if this number can be compared to other.
isInt ( ) : boolean Returns a value indicating if this number is an integer.
isUnitless ( ) : boolean Returns a value indicating if this number is unitless.
isa ( string $subject ) : mixed Returns a value indicating if a token of this type can be matched at the start of the subject string.
length ( ) : integer Returns the number of values of SassNumber
nth ( $i ) : SassBoolean | SassNumber Returns the nth value of the SassNumber
op_div ( $other ) : mixed Divides this value by the value of other
op_eq ( $other ) : SassBoolean The SassScript == operation.
op_gt ( sassLiteral $other ) : SassBoolean The SassScript > operation.
op_gte ( sassLiteral $other ) : SassBoolean The SassScript >= operation.
op_lt ( sassLiteral $other ) : SassBoolean The SassScript < operation.
op_lte ( sassLiteral $other ) : SassBoolean The SassScript <= operation.
op_minus ( $other ) : mixed Subtracts the value of other from this value
op_modulo ( string $other ) : mixed Takes the modulus (remainder) of this value divided by the value of other
op_plus ( $other ) : mixed Adds the value of other to the value of this
op_times ( $other ) : mixed Multiplies this value by the value of other
op_unary_concat ( )
op_unary_minus ( ) : SassNumber Unary - operator
op_unary_plus ( ) : SassNumber Unary + operator
toInt ( ) : integer Returns the integer value.
toString ( ) : string Converts the number to a string with it's units if any.
unitString ( $numeratorUnits, $denominatorUnits ) : string Returns a string representation of the units.

비공개 메소드들

메소드 설명
areConvertable ( array $units ) : boolean Returns a value indicating if all the units are capable of being converted
coercionFactor ( array $fromUnits, array $toUnits ) : float Calculates the corecion factor to apply to the value
convert ( SassNumber $other ) : SassNumber Converts values and units.
removeCommonUnits ( array $u1, array $u2 ) : array Removes common units from each set.

메소드 상세

__construct() 공개 메소드

Sets the value and units of the number.
public __construct ( $value ) : SassNumber
리턴 SassNumber

coerce() 공개 메소드

The conversion takes into account the relationship between e.g. mm and cm, as well as between e.g. in and cm. If this number is unitless, it will simply return itself with the given units.
public coerce ( array $numeratorUnits, array $denominatorUnits ) : SassNumber
$numeratorUnits array
$denominatorUnits array
리턴 SassNumber

getDenominatorUnits() 공개 메소드

Returns the denominator units of this number.
public getDenominatorUnits ( ) : string
리턴 string the denominator units of this number

getNumeratorUnits() 공개 메소드

Returns the numerator units of this number.
public getNumeratorUnits ( ) : string
리턴 string the numerator units of this number

getUnits() 공개 메소드

Returns the units of this number.
public getUnits ( ) : string
리턴 string the units of this number

getValue() 공개 메소드

Returns the value of this number.
public getValue ( ) : float
리턴 float the value of this number.

hasLegalUnits() 공개 메소드

Returns a value indicating if this number has units that can be represented in CSS.
public hasLegalUnits ( ) : boolean
리턴 boolean true if this number has units that can be represented in CSS, false if not

hasUnits() 공개 메소드

Returns a value indicating if this number has units.
public hasUnits ( ) : boolean
리턴 boolean true if this number has, false if not

isComparableTo() 공개 메소드

Returns a value indicating if this number can be compared to other.
public isComparableTo ( $other ) : boolean
리턴 boolean true if this number can be compared to other, false if not

isInt() 공개 메소드

Returns a value indicating if this number is an integer.
public isInt ( ) : boolean
리턴 boolean true if this number is an integer, false if not

isUnitless() 공개 메소드

Returns a value indicating if this number is unitless.
public isUnitless ( ) : boolean
리턴 boolean true if this number is unitless, false if not

isa() 공개 정적인 메소드

Returns a value indicating if a token of this type can be matched at the start of the subject string.
public static isa ( string $subject ) : mixed
$subject string the subject string
리턴 mixed match at the start of the string or false if no match

length() 공개 메소드

Returns the number of values of SassNumber
public length ( ) : integer
리턴 integer

nth() 공개 메소드

Returns the nth value of the SassNumber
public nth ( $i ) : SassBoolean | SassNumber
리턴 SassBoolean | SassNumber

op_div() 공개 메소드

Divides this value by the value of other
public op_div ( $other ) : mixed
리턴 mixed SassNumber if other is a SassNumber or SassColour if it is a SassColour

op_eq() 공개 메소드

The SassScript == operation.
public op_eq ( $other ) : SassBoolean
리턴 SassBoolean SassBoolean object with the value true if the values of this and other are equal, false if they are not

op_gt() 공개 메소드

The SassScript > operation.
public op_gt ( sassLiteral $other ) : SassBoolean
$other sassLiteral the value to compare to this
리턴 SassBoolean SassBoolean object with the value true if the values of this is greater than the value of other, false if it is not

op_gte() 공개 메소드

The SassScript >= operation.
public op_gte ( sassLiteral $other ) : SassBoolean
$other sassLiteral the value to compare to this
리턴 SassBoolean SassBoolean object with the value true if the values of this is greater than or equal to the value of other, false if it is not

op_lt() 공개 메소드

The SassScript < operation.
public op_lt ( sassLiteral $other ) : SassBoolean
$other sassLiteral the value to compare to this
리턴 SassBoolean SassBoolean object with the value true if the values of this is less than the value of other, false if it is not

op_lte() 공개 메소드

The SassScript <= operation.
public op_lte ( sassLiteral $other ) : SassBoolean
$other sassLiteral the value to compare to this
리턴 SassBoolean SassBoolean object with the value true if the values of this is less than or equal to the value of other, false if it is not

op_minus() 공개 메소드

Subtracts the value of other from this value
public op_minus ( $other ) : mixed
리턴 mixed SassNumber if other is a SassNumber or SassColour if it is a SassColour

op_modulo() 공개 메소드

Takes the modulus (remainder) of this value divided by the value of other
public op_modulo ( string $other ) : mixed
$other string value to divide by
리턴 mixed SassNumber if other is a SassNumber or SassColour if it is a SassColour

op_plus() 공개 메소드

Adds the value of other to the value of this
public op_plus ( $other ) : mixed
리턴 mixed SassNumber if other is a SassNumber or SassColour if it is a SassColour

op_times() 공개 메소드

Multiplies this value by the value of other
public op_times ( $other ) : mixed
리턴 mixed SassNumber if other is a SassNumber or SassColour if it is a SassColour

op_unary_concat() 공개 메소드

public op_unary_concat ( )

op_unary_minus() 공개 메소드

Unary - operator
public op_unary_minus ( ) : SassNumber
리턴 SassNumber the negative value of this number

op_unary_plus() 공개 메소드

Unary + operator
public op_unary_plus ( ) : SassNumber
리턴 SassNumber the value of this number

toInt() 공개 메소드

Returns the integer value.
public toInt ( ) : integer
리턴 integer the integer value.

toString() 공개 메소드

If the units are px the result is rounded down to the nearest integer, otherwise the result is rounded to the specified precision.
public toString ( ) : string
리턴 string number as a string with it's units if any

unitString() 공개 메소드

Returns a string representation of the units.
public unitString ( $numeratorUnits, $denominatorUnits ) : string
리턴 string the units

프로퍼티 상세

$inExpression 공개적으로 프로퍼티

whether this number is in an expression or a literal number Used to determine whether division should take place
public $inExpression