original_string: public function getSnippetDiff($data) {
          $response=CodeBank_ClientAPI::responseBase();
          
          
          //Get the Main Revision
          $snippet1=SnippetVersion::get()->byID(intval($data->mainRev));
          if(empty($snippet1) || $snippet1===false || $snippet1->ID==0) {
              $response['status']='EROR';
              $response['message']=_t('CodeBankAPI.MAIN_REVISION_NOT_FOUND', '_Main revision not found');
          
              return $response;
          }
          
          $snippet1=preg_replace('/\r\n|\n|\r/', "\n", $snippet1->Text);
          
          
          //Get the Comparision Revision
          $snippet2=SnippetVersion::get()->byID(intval($data->compRev));
          if(empty($snippet2) || $snippet1===false || $snippet2->ID==0) {
              $response['status']='EROR';
              $response['message']=_t('CodeBankAPI.COMPARE_REVISION_NOT_FOUND', '_Compare revision not found');
          
              return $response;
          }
          
          $snippet2=preg_replace('/\r\n|\n|\r/', "\n", $snippet2->Text);
          
          
          //Generate the diff file
          $diff=new Text_Diff('auto', array(preg_split('/\n/', $snippet2), preg_split('/\n/', $snippet1)));
          $renderer=new Text_Diff_Renderer_unified(array('leading_context_lines'=>1, 'trailing_context_lines'=>1));
          
          $response['data']=array('mainRev'=>$snippet1, 'compRev'=>$snippet2, 'diff'=>$renderer->render($diff));
          
          
          return $response;
      }
code: public function getSnippetDiff($data) {
          $response=CodeBank_ClientAPI::responseBase();
          
          
          //Get the Main Revision
          $snippet1=SnippetVersion::get()->byID(intval($data->mainRev));
          if(empty($snippet1) || $snippet1===false || $snippet1->ID==0) {
              $response['status']='EROR';
              $response['message']=_t('CodeBankAPI.MAIN_REVISION_NOT_FOUND', '_Main revision not found');
          
              return $response;
          }
          
          $snippet1=preg_replace('/\r\n|\n|\r/', "\n", $snippet1->Text);
          
          
          //Get the Comparision Revision
          $snippet2=SnippetVersion::get()->byID(intval($data->compRev));
          if(empty($snippet2) || $snippet1===false || $snippet2->ID==0) {
              $response['status']='EROR';
              $response['message']=_t('CodeBankAPI.COMPARE_REVISION_NOT_FOUND', '_Compare revision not found');
          
              return $response;
          }
          
          $snippet2=preg_replace('/\r\n|\n|\r/', "\n", $snippet2->Text);
          
          
          //Generate the diff file
          $diff=new Text_Diff('auto', array(preg_split('/\n/', $snippet2), preg_split('/\n/', $snippet1)));
          $renderer=new Text_Diff_Renderer_unified(array('leading_context_lines'=>1, 'trailing_context_lines'=>1));
          
          $response['data']=array('mainRev'=>$snippet1, 'compRev'=>$snippet2, 'diff'=>$renderer->render($diff));
          
          
          return $response;
      }
code_tokens: public function getSnippetDiff ( $ data ) { $ response = CodeBank_ClientAPI :: responseBase ( ) ; //Get the Main Revision $ snippet1 = SnippetVersion :: get ( ) -> byID ( intval ( $ data -> mainRev ) ) ; if ( empty ( $ snippet1 ) || $ snippet1 === false || $ snippet1 -> ID == 0 ) { $ response [ 'status' ] = 'EROR' ; $ response [ 'message' ] = _t ( 'CodeBankAPI.MAIN_REVISION_NOT_FOUND' , '_Main revision not found' ) ; return $ response ; } $ snippet1 = preg_replace ( '/\r\n|\n|\r/' , "\n" , $ snippet1 -> Text ) ; //Get the Comparision Revision $ snippet2 = SnippetVersion :: get ( ) -> byID ( intval ( $ data -> compRev ) ) ; if ( empty ( $ snippet2 ) || $ snippet1 === false || $ snippet2 -> ID == 0 ) { $ response [ 'status' ] = 'EROR' ; $ response [ 'message' ] = _t ( 'CodeBankAPI.COMPARE_REVISION_NOT_FOUND' , '_Compare revision not found' ) ; return $ response ; } $ snippet2 = preg_replace ( '/\r\n|\n|\r/' , "\n" , $ snippet2 -> Text ) ; //Generate the diff file $ diff = new Text_Diff ( 'auto' , array ( preg_split ( '/\n/' , $ snippet2 ) , preg_split ( '/\n/' , $ snippet1 ) ) ) ; $ renderer = new Text_Diff_Renderer_unified ( array ( 'leading_context_lines' => 1 , 'trailing_context_lines' => 1 ) ) ; $ response [ 'data' ] = array ( 'mainRev' => $ snippet1 , 'compRev' => $ snippet2 , 'diff' => $ renderer -> render ( $ diff ) ) ; return $ response ; }
docstring: Gets the snippet text for the two revisions as well as a unified diff file of the revisions
  @param {stdClass} $data Data passed from ActionScript
  @return {array} Standard response base
docstring_tokens: Gets the snippet text for the two revisions as well as a unified diff file of the revisions