/**
  * 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 function isValid()
 {
     return FilesystemObjectHelper::isValid($this);
 }
예제 #3
0
 /**
  * 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));
 }