CS and API docs

This commit is contained in:
Chris Boden 2012-05-11 00:51:11 -04:00
parent 710ec2535f
commit 5f80c291b7
7 changed files with 15 additions and 5 deletions

View File

@ -1,6 +1,10 @@
<?php
namespace Ratchet;
/**
* Wraps ConnectionInterface objects via the decorator pattern but allows
* parameters to bubble through with magic methods
*/
abstract class AbstractConnectionDecorator implements ConnectionInterface {
/**
* @var ConnectionInterface

View File

@ -3,6 +3,10 @@ namespace Ratchet;
const VERSION = 'Ratchet/0.1';
/**
* A proxy object representing a connection to the application
* This acts as a container to storm data (in memory) about the connection
*/
interface ConnectionInterface {
/**
* Send data to the connection

View File

@ -4,8 +4,7 @@ use Ratchet\ConnectionInterface;
use React\Socket\ConnectionInterface as ReactConn;
/**
* A proxy object representing a connection to the application
* This acts as a container to storm data (in memory) about the connection
* {@inheritdoc}
*/
class IoConnection implements ConnectionInterface {
/**

View File

@ -1,7 +1,7 @@
<?php
namespace Ratchet\Wamp;
class JSONException extends Exception {
class JsonException extends Exception {
public function __construct() {
$code = json_last_error();

View File

@ -5,6 +5,8 @@ use Ratchet\AbstractConnectionDecorator;
use Ratchet\Wamp\WampServer as WAMP;
/**
* A ConnectionInterface object wrapper that is passed to your WAMP application
* representing a client. Methods on this Connection are therefore different.
* @property stdClass $WAMP
*/
class WampConnection extends AbstractConnectionDecorator {

View File

@ -72,13 +72,13 @@ class WampServer implements WsServerInterface {
/**
* @{inheritdoc}
* @throws Exception
* @throws JSONException
* @throws JsonException
*/
public function onMessage(ConnectionInterface $from, $msg) {
$from = $this->connections[$from];
if (null === ($json = @json_decode($msg, true))) {
throw new JSONException;
throw new JsonException;
}
switch ($json[0]) {

View File

@ -3,6 +3,7 @@ namespace Ratchet\WebSocket;
use Ratchet\AbstractConnectionDecorator;
/**
* {@inheritdoc}
* @property stdClass $WebSocket
*/
class WsConnection extends AbstractConnectionDecorator {