public function analyze() { $atoms = array('Property', 'Staticproperty'); $this->atomIs($atoms)->hasIn(array('PREPLUSPLUS', 'POSTPLUSPLUS', 'DEFINE', 'CAST'))->back('first'); $this->prepareQuery(); $this->atomIs($atoms)->inIs(array('LEFT', 'APPEND'))->atomIs(array('Assignation', 'Arrayappend'))->back('first'); $this->prepareQuery(); // arguments : reference variable in a custom function $this->atomIs($atoms)->savePropertyAs('rank', 'rank')->inIs('ARGUMENT')->inIs('ARGUMENTS')->hasNoIn('METHOD')->tokenIs(array('T_STRING', 'T_NS_SEPARATOR'))->functionDefinition()->outIs('ARGUMENTS')->outIs('ARGUMENT')->samePropertyAs('rank', 'rank', true)->is('reference', true)->back('first'); $this->prepareQuery(); // PHP functions that are references $data = new Methods(); $functions = $data->getFunctionsReferenceArgs(); $references = array(); foreach ($functions as $function) { if (!isset($references[$function['position']])) { $references[$function['position']] = array('\\' . $function['function']); } else { $references[$function['position']][] = '\\' . $function['function']; } } foreach ($references as $position => $functions) { $this->atomIs($atoms)->inIsIE('VARIABLE')->is('rank', $position)->inIs('ARGUMENT')->inIs('ARGUMENTS')->hasNoIn('METHOD')->atomIs('Functioncall')->tokenIs(array('T_STRING', 'T_NS_SEPARATOR', 'T_UNSET'))->fullnspathIs($functions)->back('first'); $this->prepareQuery(); } // Class constructors (__construct) $this->atomIs($atoms)->savePropertyAs('rank', 'rank')->inIs('ARGUMENT')->inIs('ARGUMENTS')->hasNoIn('METHOD')->tokenIs(array('T_STRING', 'T_NS_SEPARATOR'))->atomIs('Functioncall')->hasIn('NEW')->classDefinition()->outIs('BLOCK')->outIs('ELEMENT')->analyzerIs('Classes/Constructor')->outIs('ARGUMENTS')->outIs('ARGUMENT')->samePropertyAs('rank', 'rank')->is('reference', true)->back('first'); $this->prepareQuery(); }
public function analyze() { // $a[3]++; $this->atomIs('Array')->hasIn(array('PREPLUSPLUS', 'POSTPLUSPLUS', 'DEFINE', 'CAST'))->back('first'); $this->prepareQuery(); // $a[1] = 2; $this->atomIs('Array')->hasNoIn('VARIABLE')->inIs('LEFT')->atomIs('Assignation')->back('first')->raw('where( __.repeat( __.out("VARIABLE")).emit(hasLabel("Arrayappend")).times(' . self::MAX_LOOPING . ').count().is(eq(0)) )'); $this->prepareQuery(); // $a[1][] = 2; $this->atomIs('Array')->inIs('APPEND')->atomIs('Arrayappend')->back('first'); $this->prepareQuery(); // arguments : reference variable in a custom function $this->atomIs('Array')->savePropertyAs('rank', 'rank')->inIs('ARGUMENT')->inIs('ARGUMENTS')->hasNoIn('METHOD')->tokenIs(array('T_STRING', 'T_NS_SEPARATOR'))->functionDefinition()->inIs('NAME')->outIs('ARGUMENTS')->outIs('ARGUMENT')->samePropertyAs('rank', 'rank', true)->is('reference', true)->back('first'); $this->prepareQuery(); // function/methods definition : all modified by incoming values // simple variable $this->atomIs('Function')->outIs('ARGUMENTS')->outIs('ARGUMENT')->atomIs('Array'); $this->prepareQuery(); // PHP functions that are references $data = new Methods(); $functions = $data->getFunctionsReferenceArgs(); $references = array(); foreach ($functions as $function) { if (!isset($references[$function['position']])) { $references[$function['position']] = array('\\' . $function['function']); } else { $references[$function['position']][] = '\\' . $function['function']; } } foreach ($references as $position => $functions) { $this->atomIs('Array')->is('rank', $position)->inIs('ARGUMENT')->inIs('ARGUMENTS')->hasNoIn('METHOD')->atomIs('Functioncall')->tokenIs(array('T_STRING', 'T_NS_SEPARATOR', 'T_UNSET'))->fullnspathIs($functions)->back('first'); $this->prepareQuery(); } // Class constructors (__construct) $this->atomIs('Array')->savePropertyAs('rank', 'rank')->inIs('ARGUMENT')->inIs('ARGUMENTS')->hasNoIn('METHOD')->tokenIs(array('T_STRING', 'T_NS_SEPARATOR'))->atomIs('Functioncall')->hasIn('NEW')->classDefinition()->outIs('BLOCK')->outIs('ELEMENT')->analyzerIs('Classes/Constructor')->outIs('ARGUMENTS')->outIs('ARGUMENT')->samePropertyAs('rank', 'rank')->is('reference', true)->back('first'); $this->prepareQuery(); }