src/Graviton/AnalyticsBundle/Manager/AnalyticsManager.php
private function convertData(array $data = null)
    {
        if (!is_array($data)) {
            return $data;
        }

        foreach ($data as $key => $val) {
            /** convert dbrefs */
            if (is_array($val) && isset($val['$ref']) && isset($val['$id'])) {
                $data[$key] = $this->convertData(
                    $this->resolveObject($val['$ref'], $val['$id'])
                );
            } elseif (is_array($val)) {
                $data[$key] = $this->convertData($val);
            }
            /** convert mongodate to text dates **/
            if ($val instanceof \MongoDate) {
                $data[$key] = $this->dateConverter->formatDateTime($val->toDateTime());
            }
            /** convert mongoid */
            if ($val instanceof \MongoId) {
                $data[$key] = (string) $val;
            }
        }

        return $data;
    }
private function convertData(array $data = null)
    {
        if (!is_array($data)) {
            return $data;
        }

        foreach ($data as $key => $val) {
            /** convert dbrefs */
            if (is_array($val) && isset($val['$ref']) && isset($val['$id'])) {
                $data[$key] = $this->convertData(
                    $this->resolveObject($val['$ref'], $val['$id'])
                );
            } elseif (is_array($val)) {
                $data[$key] = $this->convertData($val);
            }
            /** convert mongodate to text dates **/
            if ($val instanceof \MongoDate) {
                $data[$key] = $this->dateConverter->formatDateTime($val->toDateTime());
            }
            /** convert mongoid */
            if ($val instanceof \MongoId) {
                $data[$key] = (string) $val;
            }
        }

        return $data;
    }
private function convertData ( array $ data = null ) { if ( ! is_array ( $ data ) ) { return $ data ; } foreach ( $ data as $ key => $ val ) { /** convert dbrefs */ if ( is_array ( $ val ) && isset ( $ val [ '$ref' ] ) && isset ( $ val [ '$id' ] ) ) { $ data [ $ key ] = $ this -> convertData ( $ this -> resolveObject ( $ val [ '$ref' ] , $ val [ '$id' ] ) ) ; } elseif ( is_array ( $ val ) ) { $ data [ $ key ] = $ this -> convertData ( $ val ) ; } /** convert mongodate to text dates **/ if ( $ val instanceof \ MongoDate ) { $ data [ $ key ] = $ this -> dateConverter -> formatDateTime ( $ val -> toDateTime ( ) ) ; } /** convert mongoid */ if ( $ val instanceof \ MongoId ) { $ data [ $ key ] = ( string ) $ val ; } } return $ data ; }
convert various things in the data that should be rendered differently

@param array $data data

@return array data with changed things
convert various things in the data that should be rendered differently