class CRM_Core_CodeGen_BaseTask implements CRM_Core_CodeGen_ITask

Class CRM_Core_CodeGen_BaseTask

Properties

protected CRM_Core_CodeGen_Main $config
protected $tables

Methods

__construct(CRM_Core_CodeGen_Main $config)

No description

setConfig(object $config)

TODO: this is the most rudimentary possible hack. CG config should eventually be made into a first-class object.

bool
needsUpdate()

No description

static string|NULL
extractRegex(string $file, string $regex)

Extract a single regex from a file.

bool
isApproxPhpMatch($actual, $expected)

Determine if two snippets of PHP code are approximately equivalent.

Details

at line 17
__construct(CRM_Core_CodeGen_Main $config)

Parameters

CRM_Core_CodeGen_Main $config

at line 27
setConfig(object $config)

TODO: this is the most rudimentary possible hack. CG config should eventually be made into a first-class object.

Parameters

object $config

at line 36
bool needsUpdate()

Return Value

bool TRUE if an update is needed.

at line 50
static protected string|NULL extractRegex(string $file, string $regex)

Extract a single regex from a file.

Parameters

string $file File name
string $regex A pattern to match. Ex: "foo=([a-z]+)".

Return Value

string|NULL The value matched.

at line 75
protected bool isApproxPhpMatch($actual, $expected)

Determine if two snippets of PHP code are approximately equivalent.

This includes exceptions to equivalence for (a) whitespace and (b) the token "GenCodeChecksum".

This is useful for determining if someone has manually mucked with one the files. However, it's not perfect -- because whitespace changes are not detected. Hence, it's good to use in combination with another heuristic.

Parameters

$actual
$expected

Return Value

bool