protected static function scanDependency($context, $code)
{
$child = array();
$code = preg_replace_callback('/static::(\\w+?)\\s*\\(/', function ($matches) use($context, &$child) {
if (!isset($child[$matches[1]])) {
$child[$matches[1]] = 0;
}
$child[$matches[1]]++;
return "{$context['funcprefix']}{$matches[1]}(";
}, $code);
// replace the constants
$code = preg_replace('/static::([A-Z0-9_]+)/', "\$cx['constants']['\$1']", $code);
// compress space
$code = preg_replace('/ /', ' ', $code);
return array(static::replaceSafeString($context, $code), $child);
}