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

Use file content hash has filename if none is set. #20

Merged
merged 4 commits into from
Sep 17, 2016
Merged

Use file content hash has filename if none is set. #20

merged 4 commits into from
Sep 17, 2016

Conversation

geidelguerra
Copy link
Contributor

No description provided.

@frasmage
Copy link
Collaborator

frasmage commented Sep 9, 2016

Hi Geidel,

I like the idea of this, but it shouldn't replace the default behavior of inheriting the original filename. I would rather make it configurable, someting like

$uploader->fromSource($foo)
    ->useHashForFilename()
    ->upload();

I am away on vacation at the moment, but i will add this to my to-do list when I get home. Otherwise, feel free to iterate on your pr in the meantime.

@frasmage
Copy link
Collaborator

Hi Geidel,

Great! That is very similar to the approach I was thinking. I have a couple of nitpicks and suggestions to make before we merge this.

  • $snake_case for properties please. can we make the name $hash_filename or similar? Imho, boolean vars shouldn't start with a verb.
  • needs a useDefaultFilename() method which clears $filename and $hash_filename properties.
  • setFilename() should set $hash_filename to false, e.g. if it is called after.
  • useHashForFilename() should clear $filename.
  • that line wth the double ternary expression is getting too bloated, needs to be extracted to its own method.
  • need to update the documentation accordingly.

Feel free to take a stab at any of those, I'll handle anything that is left over this weekend when I get home.

Abstract filename generation to a method.
Add new method useDefaultFilename()
Rename generateHashFilename to generateHash
@frasmage
Copy link
Collaborator

Looks great! I will update the documentation and push this live with the next version this weekend.

Thanks for your help!

@geidelguerra
Copy link
Contributor Author

Your are welcome! I'll continue trying to improve this awesome library.

@frasmage frasmage changed the base branch from master to develop September 17, 2016 11:36
@frasmage frasmage merged commit c1fd89d into plank:develop Sep 17, 2016
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.

None yet

2 participants