original_string: public function addSnippetToPackage($data) {
          $response=CodeBank_ClientAPI::responseBase();
          
          //Ensure logged in
          if(!Permission::check('CODE_BANK_ACCESS')) {
              $response['status']='EROR';
              $response['message']=_t('CodeBankAPI.PERMISSION_DENINED', '_Permission Denied');
              
              return $response;
          }
          
          
          $package=SnippetPackage::get()->byID(intval($data->packageID));
          if(!empty($package) && $package!==false && $package->ID!=0) {
              $snippet=Snippet::get()->byID(intval($data->snippetID));
              if(!empty($snippet) && $snippet!==false && $snippet->ID!=0) {
                  $package->Snippets()->add($snippet);
                  
                  
                  $response['status']='HELO';
              }else {
                  $response['status']='EROR';
                  $response['message']=_t('CodeBankAPI.SNIPPET_NOT_FOUND', '_Snippet not found');
              }
              
              $response['status']='HELO';
          }else {
              $response['status']='EROR';
              $response['message']=_t('CodeBankAPI.PACKAGE_NOT_FOUND', '_Package not found');
          }
          
          
          return $response;
      }
code: public function addSnippetToPackage($data) {
          $response=CodeBank_ClientAPI::responseBase();
          
          //Ensure logged in
          if(!Permission::check('CODE_BANK_ACCESS')) {
              $response['status']='EROR';
              $response['message']=_t('CodeBankAPI.PERMISSION_DENINED', '_Permission Denied');
              
              return $response;
          }
          
          
          $package=SnippetPackage::get()->byID(intval($data->packageID));
          if(!empty($package) && $package!==false && $package->ID!=0) {
              $snippet=Snippet::get()->byID(intval($data->snippetID));
              if(!empty($snippet) && $snippet!==false && $snippet->ID!=0) {
                  $package->Snippets()->add($snippet);
                  
                  
                  $response['status']='HELO';
              }else {
                  $response['status']='EROR';
                  $response['message']=_t('CodeBankAPI.SNIPPET_NOT_FOUND', '_Snippet not found');
              }
              
              $response['status']='HELO';
          }else {
              $response['status']='EROR';
              $response['message']=_t('CodeBankAPI.PACKAGE_NOT_FOUND', '_Package not found');
          }
          
          
          return $response;
      }
code_tokens: public function addSnippetToPackage ( $ data ) { $ response = CodeBank_ClientAPI :: responseBase ( ) ; //Ensure logged in if ( ! Permission :: check ( 'CODE_BANK_ACCESS' ) ) { $ response [ 'status' ] = 'EROR' ; $ response [ 'message' ] = _t ( 'CodeBankAPI.PERMISSION_DENINED' , '_Permission Denied' ) ; return $ response ; } $ package = SnippetPackage :: get ( ) -> byID ( intval ( $ data -> packageID ) ) ; if ( ! empty ( $ package ) && $ package !== false && $ package -> ID != 0 ) { $ snippet = Snippet :: get ( ) -> byID ( intval ( $ data -> snippetID ) ) ; if ( ! empty ( $ snippet ) && $ snippet !== false && $ snippet -> ID != 0 ) { $ package -> Snippets ( ) -> add ( $ snippet ) ; $ response [ 'status' ] = 'HELO' ; } else { $ response [ 'status' ] = 'EROR' ; $ response [ 'message' ] = _t ( 'CodeBankAPI.SNIPPET_NOT_FOUND' , '_Snippet not found' ) ; } $ response [ 'status' ] = 'HELO' ; } else { $ response [ 'status' ] = 'EROR' ; $ response [ 'message' ] = _t ( 'CodeBankAPI.PACKAGE_NOT_FOUND' , '_Package not found' ) ; } return $ response ; }
docstring: Adds a snippet to a package
  @param {stdClass} $data Data passed from ActionScript
  @return {array} Standard response base
docstring_tokens: Adds a snippet to a package