protected static function _recursiveJsonExprFinder(
        &$value,
        array &$javascriptExpressions,
        $currentKey = null
    ) {
        if ($value instanceof Expr) {
            // TODO: Optimize with ascii keys, if performance is bad
            $magicKey = "____" . $currentKey . "_" . (count($javascriptExpressions));
            $javascriptExpressions[] = array(

                //if currentKey is integer, encodeUnicodeString call is not required.
                "magicKey" => (is_int($currentKey)) ? $magicKey : Encoder::encodeUnicodeString($magicKey),
                "value"    => $value->__toString(),
            );
            $value = $magicKey;
        } elseif (is_array($value)) {
            foreach ($value as $k => $v) {
                $value[$k] = static::_recursiveJsonExprFinder($value[$k], $javascriptExpressions, $k);
            }
        } elseif (is_object($value)) {
            foreach ($value as $k => $v) {
                $value->$k = static::_recursiveJsonExprFinder($value->$k, $javascriptExpressions, $k);
            }
        }
        return $value;
    }
protected static function _recursiveJsonExprFinder(
        &$value,
        array &$javascriptExpressions,
        $currentKey = null
    ) {
        if ($value instanceof Expr) {
            // TODO: Optimize with ascii keys, if performance is bad
            $magicKey = "____" . $currentKey . "_" . (count($javascriptExpressions));
            $javascriptExpressions[] = array(

                //if currentKey is integer, encodeUnicodeString call is not required.
                "magicKey" => (is_int($currentKey)) ? $magicKey : Encoder::encodeUnicodeString($magicKey),
                "value"    => $value->__toString(),
            );
            $value = $magicKey;
        } elseif (is_array($value)) {
            foreach ($value as $k => $v) {
                $value[$k] = static::_recursiveJsonExprFinder($value[$k], $javascriptExpressions, $k);
            }
        } elseif (is_object($value)) {
            foreach ($value as $k => $v) {
                $value->$k = static::_recursiveJsonExprFinder($value->$k, $javascriptExpressions, $k);
            }
        }
        return $value;
    }
protected static function _recursiveJsonExprFinder ( & $ value , array & $ javascriptExpressions , $ currentKey = null ) { if ( $ value instanceof Expr ) { // TODO: Optimize with ascii keys, if performance is bad $ magicKey = "____" . $ currentKey . "_" . ( count ( $ javascriptExpressions ) ) ; $ javascriptExpressions [ ] = array ( //if currentKey is integer, encodeUnicodeString call is not required. "magicKey" => ( is_int ( $ currentKey ) ) ? $ magicKey : Encoder :: encodeUnicodeString ( $ magicKey ) , "value" => $ value -> __toString ( ) , ) ; $ value = $ magicKey ; } elseif ( is_array ( $ value ) ) { foreach ( $ value as $ k => $ v ) { $ value [ $ k ] = static :: _recursiveJsonExprFinder ( $ value [ $ k ] , $ javascriptExpressions , $ k ) ; } } elseif ( is_object ( $ value ) ) { foreach ( $ value as $ k => $ v ) { $ value -> $ k = static :: _recursiveJsonExprFinder ( $ value -> $ k , $ javascriptExpressions , $ k ) ; } } return $ value ; }
Check & Replace Aegis\JSON\Expr for tmp ids in the valueToEncode

Check if the value is a Aegis\JSON\Expr, and if replace its value
with a magic key and save the javascript expression in an array.

NOTE this method is recursive.

NOTE: This method is used internally by the encode method.

@see encode
@param mixed $value a string - object property to be encoded
@param array $javascriptExpressions
@param null|string|int $currentKey
@return mixed
Check & Replace Aegis \ JSON \ Expr for tmp ids in the valueToEncode