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); }