protected function buildResponse($data)
    {
        $response = $this->getCompilerResponse();

        foreach ($data as $item) {
            if (!isset($item['tag']) && !isset($item['value'])) {
                continue;
            }

            if (isset($item['tag']) && ($item['tag'] == 'errors' || $item['tag'] == 'warnings')) {
                foreach ($item['value'] as $error) {
                    $attributes = $error['attributes'];
                    
                    $error = new CompilerResponseError($error['value'], array(
                        'type' => $attributes['type'],
                        'file' => $attributes['file'],
                        'line' => $attributes['lineno'],
                        'char' => $attributes['charno'],
                        'code' => $attributes['line'],
                    ));

                    if ($item['tag'] == 'errors') {
                        $response->addError($error);
                    } else {
                        $response->addWarning($error);
                    }
                }
            } elseif (is_array($item['value'])) {
                $this->buildResponse($item['value']);
            } else {
                $method = 'set' . ucfirst($item['tag']);
                if (method_exists($response, $method)) {
                    call_user_func_array(array($response, $method), array($item['value']));
                }
            }
        }

        return $response;
    }
protected function buildResponse($data)
    {
        $response = $this->getCompilerResponse();

        foreach ($data as $item) {
            if (!isset($item['tag']) && !isset($item['value'])) {
                continue;
            }

            if (isset($item['tag']) && ($item['tag'] == 'errors' || $item['tag'] == 'warnings')) {
                foreach ($item['value'] as $error) {
                    $attributes = $error['attributes'];
                    
                    $error = new CompilerResponseError($error['value'], array(
                        'type' => $attributes['type'],
                        'file' => $attributes['file'],
                        'line' => $attributes['lineno'],
                        'char' => $attributes['charno'],
                        'code' => $attributes['line'],
                    ));

                    if ($item['tag'] == 'errors') {
                        $response->addError($error);
                    } else {
                        $response->addWarning($error);
                    }
                }
            } elseif (is_array($item['value'])) {
                $this->buildResponse($item['value']);
            } else {
                $method = 'set' . ucfirst($item['tag']);
                if (method_exists($response, $method)) {
                    call_user_func_array(array($response, $method), array($item['value']));
                }
            }
        }

        return $response;
    }
protected function buildResponse ( $ data ) { $ response = $ this -> getCompilerResponse ( ) ; foreach ( $ data as $ item ) { if ( ! isset ( $ item [ 'tag' ] ) && ! isset ( $ item [ 'value' ] ) ) { continue ; } if ( isset ( $ item [ 'tag' ] ) && ( $ item [ 'tag' ] == 'errors' || $ item [ 'tag' ] == 'warnings' ) ) { foreach ( $ item [ 'value' ] as $ error ) { $ attributes = $ error [ 'attributes' ] ; $ error = new CompilerResponseError ( $ error [ 'value' ] , array ( 'type' => $ attributes [ 'type' ] , 'file' => $ attributes [ 'file' ] , 'line' => $ attributes [ 'lineno' ] , 'char' => $ attributes [ 'charno' ] , 'code' => $ attributes [ 'line' ] , ) ) ; if ( $ item [ 'tag' ] == 'errors' ) { $ response -> addError ( $ error ) ; } else { $ response -> addWarning ( $ error ) ; } } } elseif ( is_array ( $ item [ 'value' ] ) ) { $ this -> buildResponse ( $ item [ 'value' ] ) ; } else { $ method = 'set' . ucfirst ( $ item [ 'tag' ] ) ; if ( method_exists ( $ response , $ method ) ) { call_user_func_array ( array ( $ response , $ method ) , array ( $ item [ 'value' ] ) ) ; } } } return $ response ; }
Build response object from compiler response data

@param array $data
@return CompilerResponse
Build response object from compiler response data