original_string: private function compress()
      {
          switch ($this->compressFormat)
          {
              case 'zip':
                  
                  if (class_exists('\ZipArchive'))
                  {
                      $zip = new \ZipArchive;
                      
                      if ($zip->open($this->filename.'.zip', \ZipArchive::CREATE) === true)
                      {
                          $zip->addFile($this->filename.'.'.$this->extension, basename($this->filename).'.'.$this->extension);
                          $zip->close();
                          
                          // We delete the sql file
                          $this->delete();
                          
                          // Changing file extension to zip
                          $this->extension = 'zip';
                      }
                  }
                  else
                  {
                      throw new \Exception('\ZipArchive object does not exists');
                  }
                  
              break;
              
              case 'gz':
              case 'gzip':
                  
                  $content = file_get_contents($this->filename.'.'.$this->extension);
                  
                  file_put_contents($this->filename.'.sql.gz', gzencode($content, 9));
                  
                  // We delete the sql file
                  $this->delete();
                  
                  // Changing file extension to gzip
                  $this->extension = 'sql.gz';
                  
              break;
          }
      }
code: private function compress()
      {
          switch ($this->compressFormat)
          {
              case 'zip':
                  
                  if (class_exists('\ZipArchive'))
                  {
                      $zip = new \ZipArchive;
                      
                      if ($zip->open($this->filename.'.zip', \ZipArchive::CREATE) === true)
                      {
                          $zip->addFile($this->filename.'.'.$this->extension, basename($this->filename).'.'.$this->extension);
                          $zip->close();
                          
                          // We delete the sql file
                          $this->delete();
                          
                          // Changing file extension to zip
                          $this->extension = 'zip';
                      }
                  }
                  else
                  {
                      throw new \Exception('\ZipArchive object does not exists');
                  }
                  
              break;
              
              case 'gz':
              case 'gzip':
                  
                  $content = file_get_contents($this->filename.'.'.$this->extension);
                  
                  file_put_contents($this->filename.'.sql.gz', gzencode($content, 9));
                  
                  // We delete the sql file
                  $this->delete();
                  
                  // Changing file extension to gzip
                  $this->extension = 'sql.gz';
                  
              break;
          }
      }
code_tokens: private function compress ( ) { switch ( $ this -> compressFormat ) { case 'zip' : if ( class_exists ( '\ZipArchive' ) ) { $ zip = new \ ZipArchive ; if ( $ zip -> open ( $ this -> filename . '.zip' , \ ZipArchive :: CREATE ) === true ) { $ zip -> addFile ( $ this -> filename . '.' . $ this -> extension , basename ( $ this -> filename ) . '.' . $ this -> extension ) ; $ zip -> close ( ) ; // We delete the sql file $ this -> delete ( ) ; // Changing file extension to zip $ this -> extension = 'zip' ; } } else { throw new \ Exception ( '\ZipArchive object does not exists' ) ; } break ; case 'gz' : case 'gzip' : $ content = file_get_contents ( $ this -> filename . '.' . $ this -> extension ) ; file_put_contents ( $ this -> filename . '.sql.gz' , gzencode ( $ content , 9 ) ) ; // We delete the sql file $ this -> delete ( ) ; // Changing file extension to gzip $ this -> extension = 'sql.gz' ; break ; } }
docstring: Compress the file
docstring_tokens: Compress the file