PHP Class PHPSA\Variable

Show file Open project: ovr/phpsa Class Usage Examples

Protected Properties

Property Type Description
$branch integer | string
$gets how many times was read from the var
$name variable name
$referenced is it referenced to another var?
$referencedTo to which variable referenced?
$sets how many times was written to the var
$type variable type
$value variable value

Public Methods

Method Description
__construct ( string $name, mixed $defaultValue = null, integer $type = CompiledExpression::UNKNOWN, integer | string $branch = self::BRANCH_ROOT ) Creates a variable.
__debugInfo ( ) : array
dec ( ) Decrement value of the variable
getGets ( ) : integer Gets the read counter.
getName ( ) : string
getReferencedTo ( ) : null | Variable
getSets ( ) : integer Gets the write counter.
getSymbolType ( ) : string
getType ( ) : mixed
getTypeName ( ) : string
getValue ( ) : mixed
inc ( ) Increment value of the variable
incGets ( ) : integer Increases the read counter.
incSets ( ) : integer Increases the write counter.
incUse ( ) Increment uses for gets and sets
isNumeric ( ) : boolean Is it an integer,double or number.
isReferenced ( ) : boolean
isUnused ( ) : boolean Check if you are setting values to variable but didn't use it (means get)
modify ( integer $type, mixed $value ) Changes variable type and value.
modifyType ( integer $type ) Changes variable type.
setReferencedTo ( Variable $referencedTo = null )

Method Details

__construct() public method

Creates a variable.
public __construct ( string $name, mixed $defaultValue = null, integer $type = CompiledExpression::UNKNOWN, integer | string $branch = self::BRANCH_ROOT )
$name string
$defaultValue mixed
$type integer
$branch integer | string

__debugInfo() public method

public __debugInfo ( ) : array
return array

dec() public method

Decrement value of the variable
public dec ( )

getGets() public method

Gets the read counter.
public getGets ( ) : integer
return integer

getName() public method

public getName ( ) : string
return string

getReferencedTo() public method

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

getSets() public method

Gets the write counter.
public getSets ( ) : integer
return integer

getSymbolType() public method

public getSymbolType ( ) : string
return string

getType() public method

public getType ( ) : mixed
return mixed

getTypeName() public method

public getTypeName ( ) : string
return string

getValue() public method

public getValue ( ) : mixed
return mixed

inc() public method

Increment value of the variable
public inc ( )

incGets() public method

Increases the read counter.
public incGets ( ) : integer
return integer

incSets() public method

Increases the write counter.
public incSets ( ) : integer
return integer

incUse() public method

Increment uses for gets and sets
public incUse ( )

isNumeric() public method

Is it an integer,double or number.
public isNumeric ( ) : boolean
return boolean

isReferenced() public method

public isReferenced ( ) : boolean
return boolean

isUnused() public method

Check if you are setting values to variable but didn't use it (means get)
public isUnused ( ) : boolean
return boolean

modify() public method

Changes variable type and value.
public modify ( integer $type, mixed $value )
$type integer
$value mixed

modifyType() public method

Changes variable type.
public modifyType ( integer $type )
$type integer

setReferencedTo() public method

public setReferencedTo ( Variable $referencedTo = null )
$referencedTo Variable

Property Details

$branch protected property

protected int|string $branch
return integer | string

$gets protected property

how many times was read from the var
protected $gets

$name protected property

variable name
protected $name

$referenced protected property

is it referenced to another var?
protected $referenced

$referencedTo protected property

to which variable referenced?
protected $referencedTo

$sets protected property

how many times was written to the var
protected $sets

$type protected property

variable type
protected $type

$value protected property

variable value
protected $value