protected function allExpressions(array $expressions=null, &$all=null)
    {

        $expressions = $expressions ?: $this->expressions();
        $all = $all ?: [];

        foreach ($expressions as $expression) {

            $all[] = $expression;

            if ($expression instanceof HasExpressions) {
                $this->allExpressions($expression->expressions(), $all);
            }

        }

        return $all;
    }
protected function allExpressions(array $expressions=null, &$all=null)
    {

        $expressions = $expressions ?: $this->expressions();
        $all = $all ?: [];

        foreach ($expressions as $expression) {

            $all[] = $expression;

            if ($expression instanceof HasExpressions) {
                $this->allExpressions($expression->expressions(), $all);
            }

        }

        return $all;
    }
protected function allExpressions ( array $ expressions = null , & $ all = null ) { $ expressions = $ expressions ? : $ this -> expressions ( ) ; $ all = $ all ? : [ ] ; foreach ( $ expressions as $ expression ) { $ all [ ] = $ expression ; if ( $ expression instanceof HasExpressions ) { $ this -> allExpressions ( $ expression -> expressions ( ) , $ all ) ; } } return $ all ; }
Recursively collect all expressions.

@param array $expressions (optional)
@param array $all (optional)

@return array
Recursively collect all expressions .