public static function autocomplete($name, $args2, $args3)
{
$res = array();
if (preg_match('#^(.*)::(.*)$#', $name, $matches)) {
$methods = get_class_methods($matches[1]);
foreach ($methods as $m) {
if ($matches[2] === '' or strpos($m, $matches[2]) === 0) {
$res[] = $matches[1] . '::' . $m . '()';
}
}
} elseif (preg_match('#\\$([^$]*)->([^>]*)$#', readline_info('line_buffer'), $matches)) {
$obj = self::$_vars[$matches[1]];
if (!is_object($obj) or ($class = get_class($obj)) === false) {
return null;
}
if (is_a($obj, 'Pix_Table_Row')) {
// columns
foreach (array_keys($obj->getTable()->_columns) as $m) {
if ($matches[2] === '' or strpos($m, $matches[2]) === 0) {
$res[] = $m;
}
}
// relations
foreach (array_keys($obj->getTable()->_relations) as $m) {
if ($matches[2] === '' or strpos($m, $matches[2]) === 0) {
$res[] = $m;
}
}
// aliases
if ($obj->getTable()->_aliases) {
foreach (array_keys($obj->getTable()->_aliases) as $m) {
if ($matches[2] === '' or strpos($m, $matches[2]) === 0) {
$res[] = $m;
}
}
}
// hook
if ($obj->getTable()->_hooks) {
foreach (array_keys($obj->getTable()->_hooks) as $name) {
if ($matches[2] === '' or stripos($name, $matches[2]) === 0) {
$res[] = $name;
}
}
}
// Table Row Helper
foreach (array_keys($obj->getTable()->getHelperManager('row')->getMethods()) as $name) {
if ($matches[2] === '' or stripos($name, $matches[2]) === 0) {
$res[] = $name . '()';
}
}
// Table Static Helper
foreach (array_keys(Pix_Table::getStaticHelperManager('row')->getMethods()) as $name) {
if ($matches[2] === '' or stripos($name, $matches[2]) === 0) {
$res[] = $name . '()';
}
}
}
$methods = get_class_methods($class);
foreach ($methods as $m) {
if ($matches[2] === '' or strpos($m, $matches[2]) === 0) {
$res[] = $m . '()';
}
}
} else {
foreach (self::findMatch($name) as $o) {
$res[] = $o;
}
}
if (count($res) == 0) {
return null;
}
return $res;
}