Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove the get type method because it is inconsistent #26

Closed
wants to merge 1 commit into from

Conversation

backbone87
Copy link
Member

links can be directories or files

@discordier
Copy link
Member

Nope, a link never is a file nor a directory.
A link is a link.
The target it is pointing to is either file, directory or ... you guess it... even another link.

But you are right, we are in need of something like getTarget() for when it is a link to hunt the target down (and therefore allow to follow the link).

@backbone87
Copy link
Member Author

There is a getLinkTarget method.

But for me a link "inherits" the behavior of its target, which is either file behavior or directory behavior. We are on a high abstraction level, so one should not need to resolve the link to its target, to find out, if one can get the contents (file behavior) or list the contained files (directory behavior)

edit: to restrain: isDirectory should return true, if the pathname denotes a directory or link resolving to a directory. same goes for isFile

@tristanlins
Copy link
Member

I agree to both of you.
php-filesystem is a high level abstraction and links should not be a "barrier".
is_dir and is_file also return true on links that point to a directory or a file.
Maybe, there should be a better typing, like file, directory, link-file, link-directory, link and unknown.

In the local filesystem I don't see an inconsistency, because it use is_dir and is_file.
But the ftp filesystem currently not support "link target typing", see #31

Link creation is currently fully unsupported, see #32

@backbone87
Copy link
Member Author

I don't see the point of having a getType method.

isLink, isFile, isDirectory are completly satisfying all use cases I can think of.

@tristanlins
Copy link
Member

According to our phone discussion, getType should return a bitmask. see #35

@tristanlins tristanlins closed this Dec 9, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants