public function analyze()
{
$resourceUsage = $this->loadJson('resource_usage.json');
$positions = array(0);
foreach ($resourceUsage as $creation => $usage) {
foreach ($positions as $pos) {
if (!isset($usage->{"function{$pos}"})) {
continue;
}
$functions = $this->makeFullNsPath((array) $usage->{"function{$pos}"});
//direct usage of the resource :
// readdir(opendir('uncheckedDir4'));
$this->atomFunctionIs($creation)->inIs('ARGUMENT')->inIs('ARGUMENTS')->hasNoIn('METHOD')->fullnspathIs($functions);
$this->prepareQuery();
// deferred usage of the resource
//$dir = opendir('uncheckedDir4'); readdir($dir);
$this->atomFunctionIs($creation)->inIs('RIGHT')->atomIs('Assignation')->hasNoIn('CONDITION')->_as('result')->outIs('LEFT')->savePropertyAs('fullcode', 'tmpvar')->inIs('LEFT')->nextSibling()->atomInside('Variable')->samePropertyAs('code', 'tmpvar')->raw('where( __.in("ARGUMENT").in("ARGUMENTS").has("fullnspath", "\\\\is_resource").count().is(eq(0)) )')->hasNoIn('NOT')->raw('where( __.in("CONDITION").hasLabel("Ifthen", "While" ).count().is(eq(0)) )')->raw('where( __.in("LEFT", "RIGHT").hasLabel("Logical").count().is(eq(0)) )')->hasNoComparison()->back('result');
$this->prepareQuery();
}
}
}