Exakat\Analyzer\Analyzer::fetchContext PHP Method

fetchContext() public method

public fetchContext ( $context = self::CONTEXT_OUTSIDE_CLOSURE )
    public function fetchContext($context = self::CONTEXT_OUTSIDE_CLOSURE)
    {
        $forClosure = "                    // This is make variables in USE available in the parent level\n                    if (it.out('USE').out('ARGUMENT').retain([current]).any()) {\n                        context[it.atom] = 'Global';\n                    }\n";
        if ($context == self::CONTEXT_IN_CLOSURE) {
            $forClosure = "";
        }
        $this->addMethod(<<<GREMLIN
as("context")
.sideEffect{ line = it.get().value('line');
             fullcode = it.get().value('fullcode');
             file='None'; 
             theFunction = 'None'; 
             theClass='None'; 
             theNamespace='\\\\'; 
             }
.sideEffect{ line = it.get().value('line'); }
.until( hasLabel('File') ).repeat( 
    __.in({$this->linksDown})
      .sideEffect{ if (it.get().label() == 'Function') { theFunction = it.get().value('code')} }
      .sideEffect{ if (it.get().label() in ['Class']) { theClass = it.get().value('fullcode')} }
      .sideEffect{ if (it.get().label() in ['Namespace']) { theNamespace = it.get().vertices(OUT, 'NAME').next().value('fullcode')} }
       )
.sideEffect{  file = it.get().value('fullcode');}
.sideEffect{ context = ['line':line, 'file':file, 'fullcode':fullcode, 'function':theFunction, 'class':theClass, 'namespace':theNamespace]; }
.select("context")

GREMLIN
);
        return $this;
    }
Analyzer