wwphp-fb/facebook-bot — pull request #5 by dennisdegryse (2014-12-26 23:05:03+00:00)
Title: Feature/connection

Please review this code before merging. Also please **don't** merge with fast-forward, so the branch is not destroyed.

# Change log
* Splitted cURL class into 2 separate components: Connection + MemberRequestHandler
* Connection component uses the _State Pattern_ to distribute behavior into connected and disconnected states.

# Future improvements & justification
As mentioned in issue #1 by @Golpha, the initial cURL class had a SOLID principle conflict. This conflict has been resolved in this branch and allows additional handlers to be added in a modular manner. The next step to take is to apply the multi-threaded model as described in the comment by myself in #1. Once this is done, additional handlers can compete in a more efficient way.

After merging this branch, new handlers can be added under the namespace `PHPWorldWide\FacebookBot\Handler`. They should be instantiated in the constructor of the `Bot` class and added to the `$handlers` array. The new handlers must (only) depend on the `Connection` component (which is clearly enforced by implementing the `Handler` interface). In the mean time, a separate branch can be created to complete the module model and adopt the new handlers without much effort if they follow the rules described here. Any changes to the `Handler` interface (thus changing the dependencies) must be discussed on beforehand.