PHP Class PHPSA\Context

Exibir arquivo Open project: ovr/phpsa Class Usage Examples

Public Properties

Property Type Description
$aliasManager AliasManager
$application Application
$currentBranch string | integer
$output Symfony\Component\Console\Output\OutputInterface
$scope PHPSA\Definition\ParentDefinition | null For FunctionDefinition it's null, use scopePointer
$scopePointer ScopePointer | null

Protected Properties

Property Type Description
$eventManager Webiny\Component\EventManager\EventManager
$filepath string
$symbols Variable[]

Public Methods

Method Description
__construct ( Symfony\Component\Console\Output\OutputInterface $output, Application $application, EventManager $eventManager ) Construct our Context with all needed information
addSymbol ( string $name ) : Variable Creates a variable from a symbol and adds it to the context.
addVariable ( Variable $variable ) : boolean Adds a variable to the context.
clear ( ) Resets context to beginning stage.
clearSymbols ( ) Clears only all symbols.
debug ( $message, PhpParser\Node $expr = null ) Creates a debug message.
getCurrentBranch ( ) : integer
getEventManager ( ) : EventManager
getExpressionCompiler ( ) : Expression
getFilepath ( ) : string
getSymbol ( $name ) : Variable | null Returns a variable if it exists.
getSymbols ( ) : Variable[] Returns an array of all variables.
initGlobals ( ) Adds all global variables to the context.
modifyReferencedVariables ( Variable $variable, $type, $value ) Updates all references on the given variable.
notice ( string $type, string $message, NodeAbstract $expr, integer $status = Check::CHECK_SAFE ) : boolean Creates a notice message.
setCurrentBranch ( integer | string $currentBranch )
setFilepath ( string $filepath )
setScope ( AbstractDefinition $scope = null )
syntaxError ( Error $exception, string $filepath ) : boolean Creates a syntax error message.
warning ( string $type, string $message ) : boolean Creates a warning message.

Method Details

__construct() public method

Construct our Context with all needed information
public __construct ( Symfony\Component\Console\Output\OutputInterface $output, Application $application, EventManager $eventManager )
$output Symfony\Component\Console\Output\OutputInterface
$application Application
$eventManager Webiny\Component\EventManager\EventManager

addSymbol() public method

Creates a variable from a symbol and adds it to the context.
public addSymbol ( string $name ) : Variable
$name string
return Variable

addVariable() public method

Adds a variable to the context.
public addVariable ( Variable $variable ) : boolean
$variable Variable
return boolean

clear() public method

Resets context to beginning stage.
public clear ( )

clearSymbols() public method

Clears only all symbols.
public clearSymbols ( )

debug() public method

Creates a debug message.
public debug ( $message, PhpParser\Node $expr = null )
$expr PhpParser\Node

getCurrentBranch() public method

public getCurrentBranch ( ) : integer
return integer

getEventManager() public method

public getEventManager ( ) : EventManager
return Webiny\Component\EventManager\EventManager

getExpressionCompiler() public method

public getExpressionCompiler ( ) : Expression
return PHPSA\Compiler\Expression

getFilepath() public method

public getFilepath ( ) : string
return string

getSymbol() public method

Returns a variable if it exists.
public getSymbol ( $name ) : Variable | null
$name
return Variable | null

getSymbols() public method

Returns an array of all variables.
public getSymbols ( ) : Variable[]
return Variable[]

initGlobals() public method

Adds all global variables to the context.
public initGlobals ( )

modifyReferencedVariables() public method

Updates all references on the given variable.
public modifyReferencedVariables ( Variable $variable, $type, $value )
$variable Variable
$type
$value

notice() public method

Creates a notice message.
public notice ( string $type, string $message, NodeAbstract $expr, integer $status = Check::CHECK_SAFE ) : boolean
$type string
$message string
$expr PhpParser\NodeAbstract
$status integer
return boolean

setCurrentBranch() public method

public setCurrentBranch ( integer | string $currentBranch )
$currentBranch integer | string

setFilepath() public method

public setFilepath ( string $filepath )
$filepath string

setScope() public method

public setScope ( AbstractDefinition $scope = null )
$scope PHPSA\Definition\AbstractDefinition

syntaxError() public method

Creates a syntax error message.
public syntaxError ( Error $exception, string $filepath ) : boolean
$exception PhpParser\Error
$filepath string
return boolean

warning() public method

Creates a warning message.
public warning ( string $type, string $message ) : boolean
$type string
$message string
return boolean

Property Details

$aliasManager public_oe property

public AliasManager,phpsa $aliasManager
return AliasManager

$application public_oe property

public Application,phpsa $application
return Application

$currentBranch public_oe property

public string|int $currentBranch
return string | integer

$eventManager protected_oe property

protected EventManager,Webiny\Component\EventManager $eventManager
return Webiny\Component\EventManager\EventManager

$filepath protected_oe property

protected string $filepath
return string

$output public_oe property

public OutputInterface,Symfony\Component\Console\Output $output
return Symfony\Component\Console\Output\OutputInterface

$scope public_oe property

For FunctionDefinition it's null, use scopePointer
public ParentDefinition,PHPSA\Definition|null $scope
return PHPSA\Definition\ParentDefinition | null

$scopePointer public_oe property

public ScopePointer,phpsa|null $scopePointer
return ScopePointer | null

$symbols protected_oe property

protected Variable[],phpsa $symbols
return Variable[]