src/flowcode/enlace/view/JsonView.php
private function toArray($obj) {
        $arr = array();

        if (is_array($obj)) {
            foreach ($obj as $value) {
                $arr[] = $this->toArray($value);
            }
        } else if (is_object($obj)) {
            $arObj = (array) $obj;
            foreach ($arObj as $key => $value) {
                $attribute = str_replace(get_class($obj), "", $key);
                if (is_object($value) || is_array($value)) {
                    $value = $this->toArray($value);
                } else {
                    $arr[$attribute] = $this->utf8_encode_all($value);
                }
            }
        } else {
            $arr = $this->utf8_encode_all($obj);
        }
        return $arr;
    }
private function toArray($obj) {
        $arr = array();

        if (is_array($obj)) {
            foreach ($obj as $value) {
                $arr[] = $this->toArray($value);
            }
        } else if (is_object($obj)) {
            $arObj = (array) $obj;
            foreach ($arObj as $key => $value) {
                $attribute = str_replace(get_class($obj), "", $key);
                if (is_object($value) || is_array($value)) {
                    $value = $this->toArray($value);
                } else {
                    $arr[$attribute] = $this->utf8_encode_all($value);
                }
            }
        } else {
            $arr = $this->utf8_encode_all($obj);
        }
        return $arr;
    }
private function toArray ( $ obj ) { $ arr = array ( ) ; if ( is_array ( $ obj ) ) { foreach ( $ obj as $ value ) { $ arr [ ] = $ this -> toArray ( $ value ) ; } } else if ( is_object ( $ obj ) ) { $ arObj = ( array ) $ obj ; foreach ( $ arObj as $ key => $ value ) { $ attribute = str_replace ( get_class ( $ obj ) , "" , $ key ) ; if ( is_object ( $ value ) || is_array ( $ value ) ) { $ value = $ this -> toArray ( $ value ) ; } else { $ arr [ $ attribute ] = $ this -> utf8_encode_all ( $ value ) ; } } } else { $ arr = $ this -> utf8_encode_all ( $ obj ) ; } return $ arr ; }
Convierte un objeto a notacion json.
@param type $obj
@return type
Convierte un objeto a notacion json .