original_string: public function encode($result)
      {
          if ('form' == $this->type) {
              array_walk_recursive($result[0], array($this, 'utf8'));
              
              $response = new SfResponse("<html><body><textarea>".json_encode($result[0])."</textarea></body></html>");            
              $response->headers->set('Content-Type', 'text/html');
              
              return $response;
          } else {
              if ($this->responseEncode){
                  // @todo: check utf8 config option from bundle
                  array_walk_recursive($result, array($this, 'utf8'));
              }
  
              $response = new SfResponse(json_encode($result));            
              $response->headers->set('Content-Type', 'application/json');
              
              return $response;
          }
      }
code: public function encode($result)
      {
          if ('form' == $this->type) {
              array_walk_recursive($result[0], array($this, 'utf8'));
              
              $response = new SfResponse("<html><body><textarea>".json_encode($result[0])."</textarea></body></html>");            
              $response->headers->set('Content-Type', 'text/html');
              
              return $response;
          } else {
              if ($this->responseEncode){
                  // @todo: check utf8 config option from bundle
                  array_walk_recursive($result, array($this, 'utf8'));
              }
  
              $response = new SfResponse(json_encode($result));            
              $response->headers->set('Content-Type', 'application/json');
              
              return $response;
          }
      }
code_tokens: public function encode ( $ result ) { if ( 'form' == $ this -> type ) { array_walk_recursive ( $ result [ 0 ] , array ( $ this , 'utf8' ) ) ; $ response = new SfResponse ( "<html><body><textarea>" . json_encode ( $ result [ 0 ] ) . "</textarea></body></html>" ) ; $ response -> headers -> set ( 'Content-Type' , 'text/html' ) ; return $ response ; } else { if ( $ this -> responseEncode ) { // @todo: check utf8 config option from bundle array_walk_recursive ( $ result , array ( $ this , 'utf8' ) ) ; } $ response = new SfResponse ( json_encode ( $ result ) ) ; $ response -> headers -> set ( 'Content-Type' , 'application/json' ) ; return $ response ; } }
docstring: Encode the response into a valid json ExtDirect result.
  
  @param  array $result
  @return string
docstring_tokens: Encode the response into a valid json ExtDirect result .