original_string: final public function saveImage($filename)
  	{
  		$extension = pathinfo($filename, PATHINFO_EXTENSION);
  
  		if (! is_string($extension)) {
  			$extension = image_type_to_extension($this->_image_type);
  			$filename .= ".{$extension}";
  		}
  
  		switch(strtolower($extension))
  		{
  			case 'jpeg':
  			case 'jpg':
  				return $this->imageJPEG($filename);
  				break;
  
  			case 'png':
  				return $this->imagePNG($filename);
  				break;
  
  			case 'gif':
  				return $this->imageGIF($filename);
  
  			default:
  				trigger_error('Invalid extension or not an image', E_USER_WARNING);
  				return false;
  		}
  	}
code: final public function saveImage($filename)
  	{
  		$extension = pathinfo($filename, PATHINFO_EXTENSION);
  
  		if (! is_string($extension)) {
  			$extension = image_type_to_extension($this->_image_type);
  			$filename .= ".{$extension}";
  		}
  
  		switch(strtolower($extension))
  		{
  			case 'jpeg':
  			case 'jpg':
  				return $this->imageJPEG($filename);
  				break;
  
  			case 'png':
  				return $this->imagePNG($filename);
  				break;
  
  			case 'gif':
  				return $this->imageGIF($filename);
  
  			default:
  				trigger_error('Invalid extension or not an image', E_USER_WARNING);
  				return false;
  		}
  	}
code_tokens: final public function saveImage ( $ filename ) { $ extension = pathinfo ( $ filename , PATHINFO_EXTENSION ) ; if ( ! is_string ( $ extension ) ) { $ extension = image_type_to_extension ( $ this -> _image_type ) ; $ filename .= ".{$extension}" ; } switch ( strtolower ( $ extension ) ) { case 'jpeg' : case 'jpg' : return $ this -> imageJPEG ( $ filename ) ; break ; case 'png' : return $ this -> imagePNG ( $ filename ) ; break ; case 'gif' : return $ this -> imageGIF ( $ filename ) ; default : trigger_error ( 'Invalid extension or not an image' , E_USER_WARNING ) ; return false ; } }
docstring: Generic save funciton, which converts image according to extension
  
  @param string $filename Path and extension to save to
  @return bool            Success or failure of save
docstring_tokens: Generic save funciton which converts image according to extension