original_string: public function save($saveName, $quality = 80)
      {
          $type         = $this->getType(pathinfo($saveName, PATHINFO_EXTENSION));
          $imageFunc    = 'image' . $type;
          $errorMessage = 'Image saved is failed! Check the directory is can write?';
  
          if ($type === 'jpeg')
          {
              imageinterlace($this->newImage, true);
  
              if ( !$imageFunc($this->newImage, $saveName, $quality) )
              {
                  throw new \ErrorException($errorMessage);
              }
          }
          else
          {
              if (!$imageFunc($this->newImage, $saveName))
              {
                  throw new \ErrorException($errorMessage);
              }
          }
  
          $this->destroyAll();
  
          return $this;
      }
code: public function save($saveName, $quality = 80)
      {
          $type         = $this->getType(pathinfo($saveName, PATHINFO_EXTENSION));
          $imageFunc    = 'image' . $type;
          $errorMessage = 'Image saved is failed! Check the directory is can write?';
  
          if ($type === 'jpeg')
          {
              imageinterlace($this->newImage, true);
  
              if ( !$imageFunc($this->newImage, $saveName, $quality) )
              {
                  throw new \ErrorException($errorMessage);
              }
          }
          else
          {
              if (!$imageFunc($this->newImage, $saveName))
              {
                  throw new \ErrorException($errorMessage);
              }
          }
  
          $this->destroyAll();
  
          return $this;
      }
code_tokens: public function save ( $ saveName , $ quality = 80 ) { $ type = $ this -> getType ( pathinfo ( $ saveName , PATHINFO_EXTENSION ) ) ; $ imageFunc = 'image' . $ type ; $ errorMessage = 'Image saved is failed! Check the directory is can write?' ; if ( $ type === 'jpeg' ) { imageinterlace ( $ this -> newImage , true ) ; if ( ! $ imageFunc ( $ this -> newImage , $ saveName , $ quality ) ) { throw new \ ErrorException ( $ errorMessage ) ; } } else { if ( ! $ imageFunc ( $ this -> newImage , $ saveName ) ) { throw new \ ErrorException ( $ errorMessage ) ; } } $ this -> destroyAll ( ) ; return $ this ; }
docstring: Saved image file
  
  @param string $saveName
  @param int $quality 80
  @return $this
  @throws \ErrorException
docstring_tokens: Saved image file