PHP Class PMA\libraries\Advisor

Show file Open project: phpmyadmin/phpmyadmin Class Usage Examples

Protected Properties

Property Type Description
$parseResult
$runResult
$variables

Public Methods

Method Description
addRule ( string $type, array $rule ) : void Adds a rule to the result list
escapePercent ( string $str ) : string Escapes percent string to be used in format string.
getParseResult ( ) : mixed Get parseResult
getRunResult ( ) : mixed Get runResult
getVariables ( ) : mixed Get variables
parseRulesFile ( ) : array Reads the rule file into an array, throwing errors messages on syntax errors.
ruleExprEvaluate ( string $expr ) : integer Runs a code expression, replacing variable names with their respective values
run ( ) : array Parses and executes advisor rules
runRules ( ) : boolean Executes advisor rules
setParseResult ( array $parseResult ) : Advisor Set parseResult
setRunResult ( array $runResult ) : Advisor Set runResult
setVariable ( string | integer $variable, mixed $value ) Set a variable and its value
setVariables ( array $variables ) : Advisor Set variables
splitJustification ( array $rule ) : string[] Splits justification to text and formula.
storeError ( string $description, Exception $exception ) : void Stores current error in run results.
translate ( string $str, string $param = null ) : string Wrapper function for translating.

Private Methods

Method Description
replaceLinkURL ( array $matches ) : string Callback for wrapping links with PMA_linkURL
ruleExprEvaluateFired ( array $matches ) : string Callback for evaluating fired() condition.
ruleExprEvaluateVariable ( array $matches ) : string Callback for evaluating variables in expression.

Method Details

addRule() public method

Adds a rule to the result list
public addRule ( string $type, array $rule ) : void
$type string type of rule
$rule array rule itself
return void

escapePercent() public static method

Escapes percent string to be used in format string.
public static escapePercent ( string $str ) : string
$str string string to escape
return string

getParseResult() public method

Get parseResult
public getParseResult ( ) : mixed
return mixed

getRunResult() public method

Get runResult
public getRunResult ( ) : mixed
return mixed

getVariables() public method

Get variables
public getVariables ( ) : mixed
return mixed

parseRulesFile() public static method

Reads the rule file into an array, throwing errors messages on syntax errors.
public static parseRulesFile ( ) : array
return array with parsed data

ruleExprEvaluate() public method

Runs a code expression, replacing variable names with their respective values
public ruleExprEvaluate ( string $expr ) : integer
$expr string expression to evaluate
return integer result of evaluated expression

run() public method

Parses and executes advisor rules
public run ( ) : array
return array with run and parse results

runRules() public method

Executes advisor rules
public runRules ( ) : boolean
return boolean

setParseResult() public method

Set parseResult
public setParseResult ( array $parseResult ) : Advisor
$parseResult array Parse result
return Advisor

setRunResult() public method

Set runResult
public setRunResult ( array $runResult ) : Advisor
$runResult array Run result
return Advisor

setVariable() public method

Set a variable and its value
public setVariable ( string | integer $variable, mixed $value )
$variable string | integer Variable to set
$value mixed Value to set

setVariables() public method

Set variables
public setVariables ( array $variables ) : Advisor
$variables array Variables
return Advisor

splitJustification() public static method

Splits justification to text and formula.
public static splitJustification ( array $rule ) : string[]
$rule array the rule
return string[]

storeError() public method

Stores current error in run results.
public storeError ( string $description, Exception $exception ) : void
$description string description of an error.
$exception Exception exception raised
return void

translate() public method

Wrapper function for translating.
public translate ( string $str, string $param = null ) : string
$str string the string
$param string the parameters
return string

Property Details

$parseResult protected property

protected $parseResult

$runResult protected property

protected $runResult

$variables protected property

protected $variables