PHP Trait Psecio\Parse\Rule\Helper\IsFunctionCallTrait

Show file Open project: psecio/parse

Protected Methods

Method Description
countCalledFunctionArguments ( PhpParser\Node $node ) : integer Count the arguments of called function
getCalledFunctionArgument ( PhpParser\Node $node, integer $index ) : PhpParser\Node\Arg Get argument of called function
getCalledFunctionName ( PhpParser\Node $node ) : string Get name of called function
isFunctionCall ( PhpParser\Node $node, string | string[] $names = '' ) : boolean Check if $node is a function call

Method Details

countCalledFunctionArguments() protected method

Count the arguments of called function
protected countCalledFunctionArguments ( PhpParser\Node $node ) : integer
$node PhpParser\Node
return integer

getCalledFunctionArgument() protected method

Get argument of called function
protected getCalledFunctionArgument ( PhpParser\Node $node, integer $index ) : PhpParser\Node\Arg
$node PhpParser\Node
$index integer Index of argument to fetch
return PhpParser\Node\Arg If argument is not found an empty string is returned

getCalledFunctionName() protected method

Get name of called function
protected getCalledFunctionName ( PhpParser\Node $node ) : string
$node PhpParser\Node
return string Empty string if name could not be parsed

isFunctionCall() protected method

Check for name too if provided
protected isFunctionCall ( PhpParser\Node $node, string | string[] $names = '' ) : boolean
$node PhpParser\Node
$names string | string[] One or more function names to search for
return boolean