protected function _toArray($data)
    {
        $array = array();

        foreach ($data as $key => $value) {
            if (is($value, 'AnDomainBehaviorSerializable')) {
                $array[$key] = $value->toSerializableArray();
            } elseif (is_array($value)) {
                $array[$key] = $this->_toArray($value);
            } else {
                $array[$key] = $value;
            }
        }

        return $array;
    }
protected function _toArray($data)
    {
        $array = array();

        foreach ($data as $key => $value) {
            if (is($value, 'AnDomainBehaviorSerializable')) {
                $array[$key] = $value->toSerializableArray();
            } elseif (is_array($value)) {
                $array[$key] = $this->_toArray($value);
            } else {
                $array[$key] = $value;
            }
        }

        return $array;
    }
protected function _toArray ( $ data ) { $ array = array ( ) ; foreach ( $ data as $ key => $ value ) { if ( is ( $ value , 'AnDomainBehaviorSerializable' ) ) { $ array [ $ key ] = $ value -> toSerializableArray ( ) ; } elseif ( is_array ( $ value ) ) { $ array [ $ key ] = $ this -> _toArray ( $ value ) ; } else { $ array [ $ key ] = $ value ; } } return $ array ; }
Return an array representation of the data. It iteratates through the data if an element
implements toSerializableArray it will call it.

@param array $data
Return an array representation of the data . It iteratates through the data if an element implements toSerializableArray it will call it .