PHP Class PHPSA\CompiledExpression

Show file Open project: ovr/phpsa Class Usage Examples

Protected Properties

Property Type Description
$type integer By default we don't know what it is
$value mixed Possible value
$variable Variable | null

Public Methods

Method Description
__construct ( integer $type = self::UNKNOWN, mixed $value = null, Variable $variable = null ) Construct new CompiledExpression to pass result
__debugInfo ( ) : array Returns debug info.
canBeObject ( ) : boolean This is needed via in feature $this->type can store multiple type(s) by bitmask
fromZvalValue ( $value ) : CompiledExpression If we don't know $type but know $value
getType ( ) : integer Returns the type of the expression.
getTypeName ( ) : string Returns the type of the expression as a string.
getValue ( ) : mixed Returns the value of the expression.
getVariable ( ) : Variable | null
hasValue ( ) : boolean
isArray ( ) : boolean
isCallable ( ) : boolean
isCorrectValue ( ) : boolean Check that $this->value is correct for $this->type
isEquals ( integer $value ) : boolean Checks whether the expressions value equals the given value.
isObject ( ) : boolean
isScalar ( ) : boolean
isString ( ) : boolean
isTypeKnown ( ) : boolean
toVariable ( string $name ) : Variable Creates a variable from the expression.

Method Details

__construct() public method

Construct new CompiledExpression to pass result
public __construct ( integer $type = self::UNKNOWN, mixed $value = null, Variable $variable = null )
$type integer
$value mixed
$variable Variable

__debugInfo() public method

Returns debug info.
public __debugInfo ( ) : array
return array

canBeObject() public method

This is needed via in feature $this->type can store multiple type(s) by bitmask
public canBeObject ( ) : boolean
return boolean

fromZvalValue() public static method

If we don't know $type but know $value
public static fromZvalValue ( $value ) : CompiledExpression
$value
return CompiledExpression

getType() public method

Returns the type of the expression.
public getType ( ) : integer
return integer

getTypeName() public method

Returns the type of the expression as a string.
public getTypeName ( ) : string
return string

getValue() public method

Returns the value of the expression.
public getValue ( ) : mixed
return mixed

getVariable() public method

public getVariable ( ) : Variable | null
return Variable | null

hasValue() public method

public hasValue ( ) : boolean
return boolean

isArray() public method

public isArray ( ) : boolean
return boolean

isCallable() public method

public isCallable ( ) : boolean
return boolean

isCorrectValue() public method

Check that $this->value is correct for $this->type
public isCorrectValue ( ) : boolean
return boolean

isEquals() public method

Checks whether the expressions value equals the given value.
public isEquals ( integer $value ) : boolean
$value integer
return boolean

isObject() public method

public isObject ( ) : boolean
return boolean

isScalar() public method

public isScalar ( ) : boolean
return boolean

isString() public method

public isString ( ) : boolean
return boolean

isTypeKnown() public method

public isTypeKnown ( ) : boolean
return boolean

toVariable() public method

Creates a variable from the expression.
public toVariable ( string $name ) : Variable
$name string Name of the Variable
return Variable

Property Details

$type protected property

By default we don't know what it is
protected int $type
return integer

$value protected property

Possible value
protected mixed $value
return mixed

$variable protected property

protected Variable,phpsa|null $variable
return Variable | null