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 file instance or the path of a file. The file doesn't need to exist.
  * The file may not be an existing directory or symbolic link.
  *
  * @param \carbon\core\io\filesystem\FilesystemObject|string $path Filesystem object instance or the path of a file as a string.
  *
  * @return bool True if the file path seems to be valid, false otherwise.
  */
 public static function isValid($path)
 {
     // Convert the file into a string, return the 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;
     }
     // Make sure the file isn't a directory or symbolic link, return the result
     return !(FilesystemObjectHelper::isDirectory($path) || FilesystemObjectHelper::isSymbolicLink($path));
 }