Differences Between: [Versions 400 and 401]
1 <?php 2 3 namespace MongoDB\GridFS\Exception; 4 5 use MongoDB\Exception\RuntimeException; 6 use function MongoDB\BSON\fromPHP; 7 use function MongoDB\BSON\toJSON; 8 use function sprintf; 9 use function stream_get_meta_data; 10 11 class StreamException extends RuntimeException 12 { 13 /** 14 * @param resource $source 15 * @param resource $destination 16 */ 17 public static function downloadFromFilenameFailed(string $filename, $source, $destination) : self 18 { 19 $sourceMetadata = stream_get_meta_data($source); 20 $destinationMetadata = stream_get_meta_data($destination); 21 22 return new static(sprintf('Downloading file from "%s" to "%s" failed. GridFS filename: "%s"', $sourceMetadata['uri'], $destinationMetadata['uri'], $filename)); 23 } 24 25 /** 26 * @param mixed $id 27 * @param resource $source 28 * @param resource $destination 29 */ 30 public static function downloadFromIdFailed($id, $source, $destination) : self 31 { 32 $idString = toJSON(fromPHP(['_id' => $id])); 33 $sourceMetadata = stream_get_meta_data($source); 34 $destinationMetadata = stream_get_meta_data($destination); 35 36 return new static(sprintf('Downloading file from "%s" to "%s" failed. GridFS identifier: "%s"', $sourceMetadata['uri'], $destinationMetadata['uri'], $idString)); 37 } 38 39 /** @param resource $source */ 40 public static function uploadFailed(string $filename, $source, string $destinationUri) : self 41 { 42 $sourceMetadata = stream_get_meta_data($source); 43 44 return new static(sprintf('Uploading file from "%s" to "%s" failed. GridFS filename: "%s"', $sourceMetadata['uri'], $destinationUri, $filename)); 45 } 46 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body