UnableToMountFilesystem.php 915 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. declare(strict_types=1);
  3. namespace League\Flysystem;
  4. use LogicException;
  5. class UnableToMountFilesystem extends LogicException implements FilesystemException
  6. {
  7. /**
  8. * @param mixed $key
  9. */
  10. public static function becauseTheKeyIsNotValid($key): UnableToMountFilesystem
  11. {
  12. return new UnableToMountFilesystem(
  13. 'Unable to mount filesystem, key was invalid. String expected, received: ' . gettype($key)
  14. );
  15. }
  16. /**
  17. * @param mixed $filesystem
  18. */
  19. public static function becauseTheFilesystemWasNotValid($filesystem): UnableToMountFilesystem
  20. {
  21. $received = is_object($filesystem) ? get_class($filesystem) : gettype($filesystem);
  22. return new UnableToMountFilesystem(
  23. 'Unable to mount filesystem, filesystem was invalid. Instance of ' . FilesystemOperator::class . ' expected, received: ' . $received
  24. );
  25. }
  26. }