public function phrasizeOrTermize($value, $phrase = true, $escape = true)
    {
        if (!$phrase && !$escape)
            return $value;

        if (!is_array($value))
            return $phrase
                ? new PhraseExpression($value)
                : new TermExpression($value)
            ;

        $ary = array();
        foreach ($value as $key => $v) {
            $ary[$key] = $this->phrasizeOrTermize($v, $phrase, $escape);
        }

        return $ary;
    }
public function phrasizeOrTermize($value, $phrase = true, $escape = true)
    {
        if (!$phrase && !$escape)
            return $value;

        if (!is_array($value))
            return $phrase
                ? new PhraseExpression($value)
                : new TermExpression($value)
            ;

        $ary = array();
        foreach ($value as $key => $v) {
            $ary[$key] = $this->phrasizeOrTermize($v, $phrase, $escape);
        }

        return $ary;
    }
public function phrasizeOrTermize ( $ value , $ phrase = true , $ escape = true ) { if ( ! $ phrase && ! $ escape ) return $ value ; if ( ! is_array ( $ value ) ) return $ phrase ? new PhraseExpression ( $ value ) : new TermExpression ( $ value ) ; $ ary = array ( ) ; foreach ( $ value as $ key => $ v ) { $ ary [ $ key ] = $ this -> phrasizeOrTermize ( $ v , $ phrase , $ escape ) ; } return $ ary ; }
Helper function that wraps an expression value with a phrase expression or a term expression
Phrasing wins on termizing

@param mixed $value
@param bool $phrase
@param bool $escape
@return PhraseExpression|TermExpression|string
Helper function that wraps an expression value with a phrase expression or a term expression Phrasing wins on termizing