LightnCandy\Exporter::scanDependency PHP Méthode

scanDependency() protected static méthode

Scan for required standalone functions
protected static scanDependency ( array\arraystring | integer> $context, string $code ) : array
$context array\arraystring | integer>
$code string PHP code string of the method
Résultat array
    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);
    }