private static function _replaceJsExpr($data, &$jsExpressions)
    {
        if (!is_array($data) &&
            !is_object($data)) {
            return $data;
        }

        if (is_object($data)) {
            if ($data instanceof \stdClass) {
                return $data;
            } elseif (!$data instanceof HighchartJsExpr) {
                $data = $data->getValue();
            }
        }

        if ($data instanceof HighchartJsExpr) {
            $magicKey = "____" . count($jsExpressions) . "_" . count($jsExpressions);
            $jsExpressions[$magicKey] = $data->getExpression();
            return $magicKey;
        }

        if(is_array($data)) {
            foreach ($data as $key => $value) {
                $data[$key] = static::_replaceJsExpr($value, $jsExpressions);
            }
        }
        
        return $data;
    }
private static function _replaceJsExpr($data, &$jsExpressions)
    {
        if (!is_array($data) &&
            !is_object($data)) {
            return $data;
        }

        if (is_object($data)) {
            if ($data instanceof \stdClass) {
                return $data;
            } elseif (!$data instanceof HighchartJsExpr) {
                $data = $data->getValue();
            }
        }

        if ($data instanceof HighchartJsExpr) {
            $magicKey = "____" . count($jsExpressions) . "_" . count($jsExpressions);
            $jsExpressions[$magicKey] = $data->getExpression();
            return $magicKey;
        }

        if(is_array($data)) {
            foreach ($data as $key => $value) {
                $data[$key] = static::_replaceJsExpr($value, $jsExpressions);
            }
        }
        
        return $data;
    }
private static function _replaceJsExpr ( $ data , & $ jsExpressions ) { if ( ! is_array ( $ data ) && ! is_object ( $ data ) ) { return $ data ; } if ( is_object ( $ data ) ) { if ( $ data instanceof \ stdClass ) { return $ data ; } elseif ( ! $ data instanceof HighchartJsExpr ) { $ data = $ data -> getValue ( ) ; } } if ( $ data instanceof HighchartJsExpr ) { $ magicKey = "____" . count ( $ jsExpressions ) . "_" . count ( $ jsExpressions ) ; $ jsExpressions [ $ magicKey ] = $ data -> getExpression ( ) ; return $ magicKey ; } if ( is_array ( $ data ) ) { foreach ( $ data as $ key => $ value ) { $ data [ $ key ] = static :: _replaceJsExpr ( $ value , $ jsExpressions ) ; } } return $ data ; }
Replaces any HighchartJsExpr for an id, and save the
js expression on the jsExpressions array
Based on Zend_Json

@param mixed $data           The data to analyze
@param array &$jsExpressions The array that will hold
information about the replaced
js expressions
Replaces any HighchartJsExpr for an id and save the js expression on the jsExpressions array Based on Zend_Json