Exakat\Analyzer\Structures\UselessGlobal::analyze PHP Метод

analyze() публичный Метод

public analyze ( )
    public function analyze()
    {
        // Global are unused if used only once
        $inglobal = $this->query(<<<GREMLIN
g.V().hasLabel("Global").out("GLOBAL").values("code")
GREMLIN
);
        $inGLobals = $this->query(<<<'GREMLIN'
g.V().hasLabel("Variable").has("code", "\$GLOBALS").in("VARIABLE").hasLabel("Array").out("INDEX").values("globalvar")
GREMLIN
);
        $counts = array_count_values(array_merge($inGLobals, $inglobal));
        $loneGlobal = array_filter($counts, function ($x) {
            return $x == 1;
        });
        $loneGlobal = array_keys($loneGlobal);
        $this->atomIs('Global')->outIs('GLOBAL')->codeIs($loneGlobal);
        $this->prepareQuery();
        $this->atomIs('Variable')->codeIs('$GLOBALS')->inIs('VARIABLE')->atomIs('Array')->_as('results')->outIs('INDEX')->atomIs('String')->is('globalvar', $loneGlobal)->back('results');
        $this->prepareQuery();
        // used only once
        // written only
    }