/**
  * Validate the path of the symbolic link object. The link doesn't need to exist.
  * The symbolic link may not be an existing file or directory.
  *
  * @param FilesystemObject|string $path Filesystem object instance or the path as a string.
  *
  * @return bool True if the path of the filesystem object seems to be valid, false otherwise.
  */
 public static function isValid($path)
 {
     // Convert the path into a string, return false if failed
     if (($path = self::asPath($path, false)) === null) {
         return false;
     }
     // Make sure the file is valid as FileSystemObject
     if (!FilesystemObjectHelper::isValid($path)) {
         return false;
     }
     // TODO: Use better validation!
     // Make sure the symbolic link isn't a an existing file or directory, return the result.
     return !(FilesystemObjectHelper::isFile($path) || FilesystemObjectHelper::isDirectory($path));
 }
 public static function from($path, $child = null)
 {
     // Create a filesystem object instance and make sure it's valid
     if (($path = FilesystemObjectHelper::getCombinedPath($path, $child)) === null) {
         return null;
     }
     // Return a File instance if the filesystem object is a file
     if (FilesystemObjectHelper::isFile($path)) {
         return new File($path);
     }
     // Return a Directory instance if the filesystem object is a directory
     if (FilesystemObjectHelper::isDirectory($path)) {
         return new Directory($path);
     }
     // Return a SymbolicLink instance if the filesystem object is a symbolic link
     if (FilesystemObjectHelper::isSymbolicLink($path)) {
         return new SymbolicLink($path);
     }
     // Return as filesystem object instance
     return new FilesystemObject($path);
 }
 /**
  * Validate a directory or the path of a directory. The directory doesn't need to exist.
  * The directory may not be an existing file or symbolic link.
  *
  * @param \carbon\core\io\filesystem\FilesystemObject|string $dir Filesystem object instance or the path of a directory as a string.
  *
  * @return bool True if the directory path seems to be valid, false otherwise.
  */
 public static function isValid($dir)
 {
     // Convert the directory into a string, return the false if failed
     if (($dir = self::asPath($dir, false)) === null) {
         return false;
     }
     // Make sure the directory is valid as FileSystemObject
     if (!FilesystemObjectHelper::isValid($dir)) {
         return false;
     }
     // Make sure the directory isn't a file or symbolic link, return the result
     return !(FilesystemObjectHelper::isFile($dir) || FilesystemObjectHelper::isSymbolicLink($dir));
 }