-
Notifications
You must be signed in to change notification settings - Fork 11
Added custom mimetype helper #14
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me, and i like the approach of keeping it separate from the apache mime type helper.
the class description could be explicit that it falls back to the default mappings from apache mimetype if no custom mapping is found. its kindof expected with this extending the other class, but still makes it more immediately clear.
private $mimetypes = []; | ||
|
||
/** | ||
* @param array $mimetypes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am a fan of stating the kindof obvious but maybe not really... i think we should say here that this is a hashmap of extension => mime type
* | ||
* @return $this | ||
*/ | ||
public function addMimetype($extension, $mimetype) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am not sure we need an adder for this. the constructor should be enough, its not like we discover mime types at runtime - or is there a use case for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im not sure this would ever be used, no. But I thought "why not?" This class should only be used in the 1% edge case. And if you are such end case you are probably doing something special and could probably be in a scenario when you want to edit this at runtime.
thanks! can you please update the documentation so that this can also be found? |
Of course! |
This will fix #10
Is this overkill? I thought about adding this features to ApacheMimeTypeHelper but that makes no sense since you still have to use
MultipartStreamBuilder::setMimetypeHelper
. Or maybe Im wrong..Anyhow. This is a way for application developers to extend the MimeTypeHelper without adding new classes.