Exakat\Analyzer\Arrays\GettingLastElement::analyze PHP Method

analyze() public method

public analyze ( )
    public function analyze()
    {
        // current(array_slice($a, -1));
        $this->atomFunctionIs('\\current')->outIs('ARGUMENTS')->outWithRank('ARGUMENT', 0)->functioncallIs('\\array_slice')->outIs('ARGUMENTS')->outWithRank('ARGUMENT', 1)->codeIs('-1')->back('first');
        $this->prepareQuery();
        // array_slice($a, -1)[0];
        $this->atomIs('Array')->outIs('INDEX')->codeIs('0')->back('first')->outIs('VARIABLE')->functioncallIs(array('\\array_slice', '\\array_reverse'))->outIs('ARGUMENTS')->outWithRank('ARGUMENT', 1)->codeIs('-1')->back('first');
        $this->prepareQuery();
        //$b = array_reverse($a)[0];
        $this->atomIs('Array')->outIs('INDEX')->codeIs('0')->back('first')->outIs('VARIABLE')->functioncallIs('\\array_reverse')->back('first');
        $this->prepareQuery();
        //$b = array_pop($a);$a[] = $b;
        $this->atomIs('Assignation')->outIs('RIGHT')->atomFunctionIs('\\array_pop')->outIs('ARGUMENTS')->outWithRank('ARGUMENT', 0)->savePropertyAs('code', 'var')->back('first')->nextSibling()->atomIs('Assignation')->outIs('LEFT')->atomIs('Arrayappend')->outIs('APPEND')->samePropertyAs('code', 'var')->back('first');
        $this->prepareQuery();
    }
GettingLastElement