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

Better shorter namespace? #6

Closed
jenstornell opened this issue Apr 30, 2019 · 2 comments
Closed

Better shorter namespace? #6

jenstornell opened this issue Apr 30, 2019 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@jenstornell
Copy link
Collaborator

The old syntax without namespace looks like this:

convertImage('./image.png', './image.webp', 5);

The new syntax will probably look something like this:

\Jens\ImageConverter\convertImage('./image.png', './image.webp', 5);

I don't really like the namespace, but I don't have a better suggestion at the moment.

Another idea

\ImageConverter\convert('./image.png', './image.webp', 5);

It's probably too generic, but I like the look of it better (I also changed the function name). It needs some more thought.

The reason I think it's important to get it right is that it's probably the only line of code most people will use. The rest is "hidden" in the class behind it.

@peter279k
Copy link
Member

@jenstornell, thank you for your concern.

I also prefer this \ImageConverter\convert('./image.png', './image.webp', 5); would be great.

@peter279k peter279k added the enhancement New feature or request label Apr 30, 2019
@peter279k peter279k self-assigned this Apr 30, 2019
jenstornell added a commit that referenced this issue May 4, 2019
- Changed namespace from `Jens\ImageConverter` to `ImageConverter`
- Added `convert` helper function
- Changed `example.php` to include the shorter version
@jenstornell
Copy link
Collaborator Author

I added the new namespace and changed the example.php with it.

I was not sure if there was a good reason to keep the class call version. I removed it, but we can re-add it if it make sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants