original_string: public function save($filename)
      {
          $type = pathinfo($filename, PATHINFO_EXTENSION);
          $type = ($type === 'jpg') ? 'jpeg' : $type;
          $type = (in_array($type, $this->imageTypes)) ? $type : 'png';
  
          header('Content-type: image/' . $type);
  
          $imageFunc = 'image' . $type;
          $imageFunc($this->image, $filename);
  
          $this->destroy($this->image);
  
          return $this;
      }
code: public function save($filename)
      {
          $type = pathinfo($filename, PATHINFO_EXTENSION);
          $type = ($type === 'jpg') ? 'jpeg' : $type;
          $type = (in_array($type, $this->imageTypes)) ? $type : 'png';
  
          header('Content-type: image/' . $type);
  
          $imageFunc = 'image' . $type;
          $imageFunc($this->image, $filename);
  
          $this->destroy($this->image);
  
          return $this;
      }
code_tokens: public function save ( $ filename ) { $ type = pathinfo ( $ filename , PATHINFO_EXTENSION ) ; $ type = ( $ type === 'jpg' ) ? 'jpeg' : $ type ; $ type = ( in_array ( $ type , $ this -> imageTypes ) ) ? $ type : 'png' ; header ( 'Content-type: image/' . $ type ) ; $ imageFunc = 'image' . $ type ; $ imageFunc ( $ this -> image , $ filename ) ; $ this -> destroy ( $ this -> image ) ; return $ this ; }
docstring: Save captcha image file
  
  @param string $filename
  @return $this
docstring_tokens: Save captcha image file