private function prepareArgs($code = null)
    {
        if (!$code) {
            // Default to last exception if nothing else was supplied
            return [new Arg(new Variable('_e'))];
        }

        if (\strpos('<?', $code) === false) {
            $code = '<?php ' . $code;
        }

        $nodes = $this->parse($code);
        if (\count($nodes) !== 1) {
            throw new \InvalidArgumentException('No idea how to throw this');
        }

        $node = $nodes[0];

        // Make this work for PHP Parser v3.x
        $expr = isset($node->expr) ? $node->expr : $node;

        $args = [new Arg($expr, false, false, $node->getAttributes())];

        // Allow throwing via a string, e.g. `throw-up "SUP"`
        if ($expr instanceof String_) {
            return [new New_(new FullyQualifiedName('Exception'), $args)];
        }

        return $args;
    }
private function prepareArgs($code = null)
    {
        if (!$code) {
            // Default to last exception if nothing else was supplied
            return [new Arg(new Variable('_e'))];
        }

        if (\strpos('<?', $code) === false) {
            $code = '<?php ' . $code;
        }

        $nodes = $this->parse($code);
        if (\count($nodes) !== 1) {
            throw new \InvalidArgumentException('No idea how to throw this');
        }

        $node = $nodes[0];

        // Make this work for PHP Parser v3.x
        $expr = isset($node->expr) ? $node->expr : $node;

        $args = [new Arg($expr, false, false, $node->getAttributes())];

        // Allow throwing via a string, e.g. `throw-up "SUP"`
        if ($expr instanceof String_) {
            return [new New_(new FullyQualifiedName('Exception'), $args)];
        }

        return $args;
    }
private function prepareArgs ( $ code = null ) { if ( ! $ code ) { // Default to last exception if nothing else was supplied return [ new Arg ( new Variable ( '_e' ) ) ] ; } if ( \ strpos ( '<?' , $ code ) === false ) { $ code = '<?php ' . $ code ; } $ nodes = $ this -> parse ( $ code ) ; if ( \ count ( $ nodes ) !== 1 ) { throw new \ InvalidArgumentException ( 'No idea how to throw this' ) ; } $ node = $ nodes [ 0 ] ; // Make this work for PHP Parser v3.x $ expr = isset ( $ node -> expr ) ? $ node -> expr : $ node ; $ args = [ new Arg ( $ expr , false , false , $ node -> getAttributes ( ) ) ] ; // Allow throwing via a string, e.g. `throw-up "SUP"` if ( $ expr instanceof String_ ) { return [ new New_ ( new FullyQualifiedName ( 'Exception' ) , $ args ) ] ; } return $ args ; }
Parse the supplied command argument.

If no argument was given, this falls back to `$_e`

@throws InvalidArgumentException if there is no exception to throw

@param string $code

@return Arg[]
Parse the supplied command argument .