PathTraversalDetected.php 510 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. declare(strict_types=1);
  3. namespace League\Flysystem;
  4. use RuntimeException;
  5. class PathTraversalDetected extends RuntimeException implements FilesystemException
  6. {
  7. /**
  8. * @var string
  9. */
  10. private $path;
  11. public function path(): string
  12. {
  13. return $this->path;
  14. }
  15. public static function forPath(string $path): PathTraversalDetected
  16. {
  17. $e = new PathTraversalDetected("Path traversal detected: {$path}");
  18. $e->path = $path;
  19. return $e;
  20. }
  21. }