Exakat\Analyzer\Php\CloseTagsConsistency::analyze PHP Method

analyze() public method

public analyze ( )
    public function analyze()
    {
        $mapping = <<<GREMLIN
if (it.get().value("close_tag") == true) {
    x2 = 'closeTag';
} else {
    x2 = 'no Close Tag';
}
GREMLIN;
        $storage = array('with ?>' => 'closeTag', 'without ?>' => 'no Close Tag');
        $this->atomIs('File')->outIs('FILE')->outIs('ELEMENT')->atomIs('Php')->raw('map{ ' . $mapping . ' }')->raw('groupCount("gf").cap("gf").sideEffect{ s = it.get().values().sum(); }.next()');
        $types = (array) $this->rawQuery();
        $store = array();
        $total = 0;
        foreach ($storage as $key => $v) {
            $c = empty($types[$v]) ? 0 : $types[$v];
            $store[] = array('key' => $key, 'value' => $c);
            $total += $c;
        }
        Analyzer::$datastore->addRowAnalyzer($this->analyzerQuoted, $store);
        if ($total == 0) {
            return;
        }
        $types = array_filter($types, function ($x) use($total) {
            return $x > 0 && $x / $total < 0.1;
        });
        $types = '["' . str_replace('\\', '\\\\', implode('", "', array_keys($types))) . '"]';
        $this->atomIs('File')->outIs('FILE')->outIs('ELEMENT')->atomIs('Php')->raw('sideEffect{ ' . $mapping . ' }')->raw('filter{ x2 in ' . $types . '}')->back('first');
        $this->prepareQuery();
    }
CloseTagsConsistency