Exakat\Analyzer\Constants\MultipleConstantDefinition::analyze PHP Метод

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

public analyze ( )
    public function analyze()
    {
        // case-insensitive constants with Define
        // Search for definitions and count them
        $csDefinitions = $this->query(<<<GREMLIN
g.V().hasLabel("Functioncall").where( __.in("METHOD", "NEW").count().is(eq(0)) )
                              .has("token", within('T_STRING', 'T_NS_SEPARATOR') )
                              .filter{it.get().value("fullnspath").toLowerCase() == '\\\\define'}
                              .out("ARGUMENTS")
                              .or( __.out("ARGUMENT").has("rank", 2).count().is(eq(0)),
                                   __.out("ARGUMENT").has("rank", 2).where( __.in("ANALYZED").has("analyzer", "Structures/Truthy").count().is(eq(0)) ),
                                  )
                              .out("ARGUMENT").has("rank", 0).hasLabel("String").where(__.out("CONCAT").count().is(eq(0)) )
                              .values("noDelimiter")
GREMLIN
);
        $constDefinitions = $this->query(<<<GREMLIN
g.V().hasLabel("Const").where( __.in("ELEMENT").in("BLOCK").hasLabel("Class", "Trait").count().is(eq(0)) )
                       .out("CONST")
                       .out("NAME").values("code")
GREMLIN
);
        $cisDefinitions = $this->query(<<<GREMLIN
g.V().hasLabel("Functioncall").where( __.in("METHOD", "NEW").count().is(eq(0)) )
                              .has("token", within('T_STRING', 'T_NS_SEPARATOR') )
                              .filter{it.get().value("fullnspath").toLowerCase() == '\\\\define'}
                              .out("ARGUMENTS")
                              .out("ARGUMENT").has("rank", 2).where( __.in("ANALYZED").has("analyzer", "Structures/Truthy").count().is(eq(1)) ).in("ARGUMENT")
                              .out("ARGUMENT").has("rank", 0)
                              .map{ it.get().value("noDelimiter").toLowerCase()}
GREMLIN
);
        if ($a = $this->selfCollisions($cisDefinitions)) {
            $this->applyToCisDefine($a);
        }
        if ($a = $this->selfCollisions(array_merge($constDefinitions, $csDefinitions))) {
            $this->applyToConst(array_intersect($a, $constDefinitions));
            $this->applyToCsDefine(array_intersect($a, $csDefinitions));
        }
        if ($a = $this->CsCisCollisions($csDefinitions, $cisDefinitions)) {
            $this->applyToCisDefine($a);
            $this->applyToCsDefine($a);
        }
        if ($a = $this->CsCisCollisions($constDefinitions, $cisDefinitions)) {
            $this->applyToCisDefine($a);
            $this->applyToConst($a);
        }
    }