Currently it is pretty hard to test the code completely.
As the handlers have many dependencies, their construction is difficult.
In order to make stuff simpler we should make the domain model observable. The observer(s) should receive events and send it to the socket.
On the other side, no reading is done by the domain model, all messages are received via the onMessage() function.
An example:
<?php
$handler = new ClientHandler();
$observer = new ArrayStoreObserver($handler);
$handler->onMessage(new ClientRequestMessage());
print_r($observer->shiftMessage());
This should print an OK message.
Currently it is pretty hard to test the code completely.
As the handlers have many dependencies, their construction is difficult.
In order to make stuff simpler we should make the domain model observable. The observer(s) should receive events and send it to the socket.
On the other side, no reading is done by the domain model, all messages are received via the
onMessage()function.An example:
This should print an OK message.