original_string: public function save($path = null, $quality = null)
      {
          $path = is_null($path) ? $this->basePath() : $path;
  
          if (is_null($path)) {
              throw new Exception\NotWritableException(
                  "Can't write to undefined path."
              );
          }
  
          $data = $this->encode(pathinfo($path, PATHINFO_EXTENSION), $quality);
          $saved = @file_put_contents($path, $data);
  
          if ($saved === false) {
              throw new Exception\NotWritableException(
                  "Can't write image data to path ({$path})"
              );
          }
  
          // set new file info
          $this->setFileInfoFromPath($path);
  
          return $this;
      }
code: public function save($path = null, $quality = null)
      {
          $path = is_null($path) ? $this->basePath() : $path;
  
          if (is_null($path)) {
              throw new Exception\NotWritableException(
                  "Can't write to undefined path."
              );
          }
  
          $data = $this->encode(pathinfo($path, PATHINFO_EXTENSION), $quality);
          $saved = @file_put_contents($path, $data);
  
          if ($saved === false) {
              throw new Exception\NotWritableException(
                  "Can't write image data to path ({$path})"
              );
          }
  
          // set new file info
          $this->setFileInfoFromPath($path);
  
          return $this;
      }
code_tokens: public function save ( $ path = null , $ quality = null ) { $ path = is_null ( $ path ) ? $ this -> basePath ( ) : $ path ; if ( is_null ( $ path ) ) { throw new Exception \ NotWritableException ( "Can't write to undefined path." ) ; } $ data = $ this -> encode ( pathinfo ( $ path , PATHINFO_EXTENSION ) , $ quality ) ; $ saved = @ file_put_contents ( $ path , $ data ) ; if ( $ saved === false ) { throw new Exception \ NotWritableException ( "Can't write image data to path ({$path})" ) ; } // set new file info $ this -> setFileInfoFromPath ( $ path ) ; return $ this ; }
docstring: Saves encoded image in filesystem
  
  @param  string  $path
  @param  int     $quality
  @return \Intervention\Image\Image
docstring_tokens: Saves encoded image in filesystem