-
Notifications
You must be signed in to change notification settings - Fork 7
Some refactor to make the code cleaner #2
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
I've deleted commit 0205974 & fixed some other bugs to make the commit history cleaner. You will need to |
Add server implementation to ajax
For some reason, WIP check dissapeared. Do not merge while 'WIP' is in title. |
[skip ci]
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 gave it a read, this looks great!
Whilst I cannot judge whether or not the code is idiomatic (I am not a PHP developer), I couldn't find any obvious issues 👍
My only comment would be that I am not sure if supporting the following syntax is a good idea:
$response = $mta->someResource->callableFunction($arg1, $arg2, $arg3, ...);
My concern is that, if we add more ways to interact with a server, the possibility of clashing with existing resources might prevent us from adding more methods.
What do you think? It is totally your call whether or not to keep the functionality.
We have MtaService class where it happens the real interaction with the server. The magic method (in Resource class) will execute the method Plus, it also adds some DX. Although, I will remove the magic getter from Mta class and keep So the final ways to call a resource function will be: $response = $mta->getResource('someResource')->call('callableFunction', $arg1, $arg2, $arg3, ...);
// or
$response = $mta->getResource('someResource')->callableFunction($arg1, $arg2, $arg3, ...); |
This is actually what I was referring to. I didn't even notice the I notice public function getName()
{
return $this->name;
} If there's a callable function I agree it's nice to have the shorthand, but imo there's the same issue here. Maybe a nice way around that would be to support |
Agree. I will add it tomorrow. |
Oh, and one more thing, the license. It looks like all of this is original work, so the license should be completely up to you. I'd recommend either: |
@qaisjp What about now? |
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.
Go for merge!
It would also be able to be used with composer, the package manager for php.