diff --git a/src/Ratchet/Resource/AbstractConnectionDecorator.php b/src/Ratchet/AbstractConnectionDecorator.php similarity index 96% rename from src/Ratchet/Resource/AbstractConnectionDecorator.php rename to src/Ratchet/AbstractConnectionDecorator.php index c4ea479..c683fa3 100644 --- a/src/Ratchet/Resource/AbstractConnectionDecorator.php +++ b/src/Ratchet/AbstractConnectionDecorator.php @@ -1,5 +1,5 @@ _id = $callId; - $this->_uri = $uri; - $this->_desc = $desc; - - $data = array(WAMP::MSG_CALL_ERROR, $callId, $uri, $desc); - - if (null !== $details) { - $data[] = $details; - $this->_details = $details; - } - - return $this->setMessage(json_encode($data)); - } - - /** - * @return string|null - */ - public function getId() { - return $this->_id; - } - - /** - * @return string|null - */ - public function getUri() { - return $this->_uri; - } - - /** - * @return string - */ - public function getDescription() { - return $this->_desc; - } - - /** - * @return string|null - */ - public function getDetails() { - return $this->_details; - } -} \ No newline at end of file diff --git a/src/Ratchet/Component/WAMP/Command/Action/CallResult.php b/src/Ratchet/Component/WAMP/Command/Action/CallResult.php deleted file mode 100644 index b65d062..0000000 --- a/src/Ratchet/Component/WAMP/Command/Action/CallResult.php +++ /dev/null @@ -1,45 +0,0 @@ -_id = $callId; - $this->_data = $data; - - return $this->setMessage(json_encode(array(WAMP::MSG_CALL_RESULT, $callId, $data))); - } - - /** - * @return string|null - */ - public function getId() { - return $this->_id; - } - - /** - * @return array|null - */ - public function getData() { - return $this->_data; - } -} \ No newline at end of file diff --git a/src/Ratchet/Component/WAMP/Command/Action/Event.php b/src/Ratchet/Component/WAMP/Command/Action/Event.php deleted file mode 100644 index a26a18d..0000000 --- a/src/Ratchet/Component/WAMP/Command/Action/Event.php +++ /dev/null @@ -1,19 +0,0 @@ -setMessage(json_encode(array(WAMP::MSG_EVENT, $uri, $msg))); - } -} \ No newline at end of file diff --git a/src/Ratchet/Component/WAMP/Command/Action/Prefix.php b/src/Ratchet/Component/WAMP/Command/Action/Prefix.php deleted file mode 100644 index 047c1ea..0000000 --- a/src/Ratchet/Component/WAMP/Command/Action/Prefix.php +++ /dev/null @@ -1,40 +0,0 @@ -_curie = $curie; - $this->_uri = $uri; - - return $this->setMessage(json_encode(array(WAMP::MSG_PREFIX, $curie, $uri))); - } - - /** - * @return string - */ - public function getCurie() { - return $this->_curie; - } - - /** - * @return string - */ - public function getUri() { - return $this->_uri; - } -} diff --git a/src/Ratchet/Component/WAMP/Command/Action/Welcome.php b/src/Ratchet/Component/WAMP/Command/Action/Welcome.php deleted file mode 100644 index c9c8974..0000000 --- a/src/Ratchet/Component/WAMP/Command/Action/Welcome.php +++ /dev/null @@ -1,18 +0,0 @@ -setMessage(json_encode(array(WAMP::MSG_WELCOME, $sessionId, 1, $serverIdent))); - } -} \ No newline at end of file diff --git a/src/Ratchet/Component/ComponentInterface.php b/src/Ratchet/ComponentInterface.php similarity index 66% rename from src/Ratchet/Component/ComponentInterface.php rename to src/Ratchet/ComponentInterface.php index 63ed81c..abebe3f 100644 --- a/src/Ratchet/Component/ComponentInterface.php +++ b/src/Ratchet/ComponentInterface.php @@ -1,6 +1,6 @@ validateDomain($domain)) { @@ -77,7 +77,7 @@ class FlashPolicyComponent implements MessageComponentInterface { * crossdomain.xml. * * @param string - * @return FlashPolicyComponent + * @return FlashPolicy */ public function setSiteControl($permittedCrossDomainPolicies = 'all') { if (!$this->validateSiteControl($permittedCrossDomainPolicies)) { diff --git a/src/Ratchet/Component/Server/IoConnection.php b/src/Ratchet/Server/IoConnection.php similarity index 77% rename from src/Ratchet/Component/Server/IoConnection.php rename to src/Ratchet/Server/IoConnection.php index c14303e..5338435 100644 --- a/src/Ratchet/Component/Server/IoConnection.php +++ b/src/Ratchet/Server/IoConnection.php @@ -1,6 +1,6 @@ conn = $conn; $this->server = $server; } diff --git a/src/Ratchet/Component/Server/IOServerComponent.php b/src/Ratchet/Server/IoServer.php similarity index 91% rename from src/Ratchet/Component/Server/IOServerComponent.php rename to src/Ratchet/Server/IoServer.php index 234fed5..d6dfc80 100644 --- a/src/Ratchet/Component/Server/IOServerComponent.php +++ b/src/Ratchet/Server/IoServer.php @@ -1,7 +1,7 @@ setSaveHandler($handler); diff --git a/src/Ratchet/Component/WAMP/Exception.php b/src/Ratchet/Wamp/Exception.php similarity index 55% rename from src/Ratchet/Component/WAMP/Exception.php rename to src/Ratchet/Wamp/Exception.php index f66097e..9b0ca24 100644 --- a/src/Ratchet/Component/WAMP/Exception.php +++ b/src/Ratchet/Wamp/Exception.php @@ -1,5 +1,5 @@ WAMP->sessionId = uniqid(); $this->WAMP->prefixes = array(); - $this->send(json_encode(array(WAMP::MSG_WELCOME, $this->WAMP->sessionId, 1, \Ratchet\Resource\VERSION))); + $this->send(json_encode(array(WAMP::MSG_WELCOME, $this->WAMP->sessionId, 1, \Ratchet\VERSION))); } /** diff --git a/src/Ratchet/Component/WAMP/WAMPServerComponent.php b/src/Ratchet/Wamp/WampServer.php similarity index 89% rename from src/Ratchet/Component/WAMP/WAMPServerComponent.php rename to src/Ratchet/Wamp/WampServer.php index 06e5099..b80f239 100644 --- a/src/Ratchet/Component/WAMP/WAMPServerComponent.php +++ b/src/Ratchet/Wamp/WampServer.php @@ -1,7 +1,7 @@ _decorating = $server_component; $this->connections = new \SplObjectStorage; } diff --git a/src/Ratchet/Component/WAMP/WAMPServerComponentInterface.php b/src/Ratchet/Wamp/WampServerInterface.php similarity index 58% rename from src/Ratchet/Component/WAMP/WAMPServerComponentInterface.php rename to src/Ratchet/Wamp/WampServerInterface.php index 180ad2a..144fabe 100644 --- a/src/Ratchet/Component/WAMP/WAMPServerComponentInterface.php +++ b/src/Ratchet/Wamp/WampServerInterface.php @@ -1,46 +1,42 @@ 0) { $response->setHeader('Sec-WebSocket-Protocol', implode(',', $agreed_protocols)); } - $response->setHeader('X-Powered-By', \Ratchet\Resource\VERSION); + $response->setHeader('X-Powered-By', \Ratchet\VERSION); $header = (string)$response; $from->send($header); diff --git a/src/Ratchet/Component/WebSocket/WebSocketComponentInterface.php b/src/Ratchet/WebSocket/WsServerInterface.php similarity index 62% rename from src/Ratchet/Component/WebSocket/WebSocketComponentInterface.php rename to src/Ratchet/WebSocket/WsServerInterface.php index 14f70d5..30b9ba4 100644 --- a/src/Ratchet/Component/WebSocket/WebSocketComponentInterface.php +++ b/src/Ratchet/WebSocket/WsServerInterface.php @@ -1,8 +1,8 @@ getMethod('getConnection'); $method->setAccessible(true); @@ -94,7 +94,7 @@ class AbstractConnectionDecoratorTest extends \PHPUnit_Framework_TestCase { } public function testGetConnectionLevel2() { - $class = new \ReflectionClass('\\Ratchet\\Resource\\AbstractConnectionDecorator'); + $class = new \ReflectionClass('\\Ratchet\\AbstractConnectionDecorator'); $method = $class->getMethod('getConnection'); $method->setAccessible(true); diff --git a/tests/Ratchet/Tests/Mock/Component.php b/tests/Ratchet/Tests/Mock/Component.php index bcf0fbb..d0064d0 100644 --- a/tests/Ratchet/Tests/Mock/Component.php +++ b/tests/Ratchet/Tests/Mock/Component.php @@ -1,8 +1,8 @@ _policy = new FlashPolicyComponent(); + $this->_policy = new FlashPolicy(); } public function testPolicyRender() { diff --git a/tests/Ratchet/Tests/Component/Server/IpBlackListComponentTest.php b/tests/Ratchet/Tests/Server/IpBlackListComponentTest.php similarity index 85% rename from tests/Ratchet/Tests/Component/Server/IpBlackListComponentTest.php rename to tests/Ratchet/Tests/Server/IpBlackListComponentTest.php index bd0d5e2..2d1f662 100644 --- a/tests/Ratchet/Tests/Component/Server/IpBlackListComponentTest.php +++ b/tests/Ratchet/Tests/Server/IpBlackListComponentTest.php @@ -1,19 +1,19 @@ _mock = new MockComponent; - $this->_comp = new IpBlackListComponent($this->_mock); + $this->_comp = new IpBlackList($this->_mock); } public function testBlockAndCloseOnOpen() { @@ -86,6 +86,6 @@ class IpBlackListComponentTest extends \PHPUnit_Framework_TestCase { } public function testUnblockingSilentlyFails() { - $this->assertInstanceOf('\\Ratchet\\Component\\Server\\IpBlackListComponent', $this->_comp->unblockAddress('localhost')); + $this->assertInstanceOf('\\Ratchet\\Server\\IpBlackList', $this->_comp->unblockAddress('localhost')); } } \ No newline at end of file diff --git a/tests/Ratchet/Tests/Component/Session/Serialize/PhpHandlerTest.php b/tests/Ratchet/Tests/Session/Serialize/PhpHandlerTest.php similarity index 83% rename from tests/Ratchet/Tests/Component/Session/Serialize/PhpHandlerTest.php rename to tests/Ratchet/Tests/Session/Serialize/PhpHandlerTest.php index 0528817..c8bf0dc 100644 --- a/tests/Ratchet/Tests/Component/Session/Serialize/PhpHandlerTest.php +++ b/tests/Ratchet/Tests/Session/Serialize/PhpHandlerTest.php @@ -1,9 +1,9 @@ markTestSkipped('Dependency of Symfony HttpFoundation failed'); @@ -31,11 +31,11 @@ class SessionComponentTest extends \PHPUnit_Framework_TestCase { * @dataProvider classCaseProvider */ public function testToClassCase($in, $out) { - $ref = new \ReflectionClass('\\Ratchet\\Component\\Session\\SessionComponent'); + $ref = new \ReflectionClass('\\Ratchet\\Session\\SessionProvider'); $method = $ref->getMethod('toClassCase'); $method->setAccessible(true); - $component = new SessionComponent(new MockComponent, new MemorySessionHandler); + $component = new SessionProvider(new MockComponent, new MemorySessionHandler); $this->assertEquals($out, $method->invokeArgs($component, array($in))); } @@ -56,7 +56,7 @@ class SessionComponentTest extends \PHPUnit_Framework_TestCase { $pdo->exec(vsprintf("CREATE TABLE %s (%s VARCHAR(255) PRIMARY KEY, %s TEXT, %s INTEGER)", $dbOptions)); $pdo->prepare(vsprintf("INSERT INTO %s (%s, %s, %s) VALUES (?, ?, ?)", $dbOptions))->execute(array($sessionId, base64_encode('_sf2_attributes|a:2:{s:5:"hello";s:5:"world";s:4:"last";i:1332872102;}_sf2_flashes|a:0:{}'), time())); - $component = new SessionComponent(new MockComponent, new PdoSessionHandler($pdo, $dbOptions), array('auto_start' => 1)); + $component = new SessionProvider(new MockComponent, new PdoSessionHandler($pdo, $dbOptions), array('auto_start' => 1)); $connection = new Connection(); $headers = $this->getMock('Guzzle\\Http\\Message\\Request', array('getCookie'), array('POST', '/', array())); @@ -83,7 +83,7 @@ class SessionComponentTest extends \PHPUnit_Framework_TestCase { } $mock = new MockComponent; - $comp = new SessionComponent($mock, new NullSessionHandler); + $comp = new SessionProvider($mock, new NullSessionHandler); $comp->onOpen($conns[1]); $comp->onOpen($conns[3]); diff --git a/tests/Ratchet/Tests/Component/WAMP/WampConnectionTest.php b/tests/Ratchet/Tests/Wamp/WampConnectionTest.php similarity index 93% rename from tests/Ratchet/Tests/Component/WAMP/WampConnectionTest.php rename to tests/Ratchet/Tests/Wamp/WampConnectionTest.php index b77cfe5..43a1127 100644 --- a/tests/Ratchet/Tests/Component/WAMP/WampConnectionTest.php +++ b/tests/Ratchet/Tests/Wamp/WampConnectionTest.php @@ -1,10 +1,10 @@ _app = new TestComponent; - $this->_comp = new WAMPServerComponent($this->_app); + $this->_comp = new WampServer($this->_app); } protected function newConn() { @@ -38,7 +38,7 @@ class WAMPServerComponentTest extends \PHPUnit_Framework_TestCase { * @dataProvider invalidMessageProvider */ public function testInvalidMessages($type) { - $this->setExpectedException('\\Ratchet\\Component\\WAMP\\Exception'); + $this->setExpectedException('\\Ratchet\\WAMP\\Exception'); $conn = $this->newConn(); $this->_comp->onOpen($conn); @@ -155,7 +155,7 @@ class WAMPServerComponentTest extends \PHPUnit_Framework_TestCase { $this->_comp->onOpen($conn); $this->_comp->onClose($conn); - $class = new \ReflectionClass('\\Ratchet\\Component\\WAMP\\WampConnection'); + $class = new \ReflectionClass('\\Ratchet\\WAMP\\WampConnection'); $method = $class->getMethod('getConnection'); $method->setAccessible(true); @@ -172,7 +172,7 @@ class WAMPServerComponentTest extends \PHPUnit_Framework_TestCase { $this->_comp->onOpen($conn); $this->_comp->onError($conn, $e); - $class = new \ReflectionClass('\\Ratchet\\Component\\WAMP\\WampConnection'); + $class = new \ReflectionClass('\\Ratchet\\WAMP\\WampConnection'); $method = $class->getMethod('getConnection'); $method->setAccessible(true); @@ -196,7 +196,7 @@ class WAMPServerComponentTest extends \PHPUnit_Framework_TestCase { } public function testMessageMustBeJson() { - $this->setExpectedException('\\Ratchet\\Component\\WAMP\\JsonException'); + $this->setExpectedException('\\Ratchet\\WAMP\\JsonException'); $conn = new Connection; diff --git a/tests/Ratchet/Tests/Component/WebSocket/Guzzle/Http/Message/RequestFactoryTest.php b/tests/Ratchet/Tests/WebSocket/Guzzle/Http/Message/RequestFactoryTest.php similarity index 90% rename from tests/Ratchet/Tests/Component/WebSocket/Guzzle/Http/Message/RequestFactoryTest.php rename to tests/Ratchet/Tests/WebSocket/Guzzle/Http/Message/RequestFactoryTest.php index 1bf54e9..01d5df0 100644 --- a/tests/Ratchet/Tests/Component/WebSocket/Guzzle/Http/Message/RequestFactoryTest.php +++ b/tests/Ratchet/Tests/WebSocket/Guzzle/Http/Message/RequestFactoryTest.php @@ -1,9 +1,9 @@ isInstanceOf('\\Ratchet\\Component\\WebSocket\\Version\\VersionInterface'); + $constraint = $this->isInstanceOf('\\Ratchet\\WebSocket\\Version\\VersionInterface'); $this->assertThat($this->_version, $constraint); } diff --git a/tests/Ratchet/Tests/Component/WebSocket/Version/HyBi10Test.php b/tests/Ratchet/Tests/WebSocket/Version/HyBi10Test.php similarity index 87% rename from tests/Ratchet/Tests/Component/WebSocket/Version/HyBi10Test.php rename to tests/Ratchet/Tests/WebSocket/Version/HyBi10Test.php index cac5280..c8ded8b 100644 --- a/tests/Ratchet/Tests/Component/WebSocket/Version/HyBi10Test.php +++ b/tests/Ratchet/Tests/WebSocket/Version/HyBi10Test.php @@ -1,10 +1,10 @@ isInstanceOf('\\Ratchet\\Component\\WebSocket\\Version\\VersionInterface'); + $constraint = $this->isInstanceOf('\\Ratchet\\WebSocket\\Version\\VersionInterface'); $this->assertThat($this->_version, $constraint); } diff --git a/tests/Ratchet/Tests/Component/WebSocket/Version/RFC6455/FrameTest.php b/tests/Ratchet/Tests/WebSocket/Version/RFC6455/FrameTest.php similarity index 98% rename from tests/Ratchet/Tests/Component/WebSocket/Version/RFC6455/FrameTest.php rename to tests/Ratchet/Tests/WebSocket/Version/RFC6455/FrameTest.php index 820bf6c..84352fb 100644 --- a/tests/Ratchet/Tests/Component/WebSocket/Version/RFC6455/FrameTest.php +++ b/tests/Ratchet/Tests/WebSocket/Version/RFC6455/FrameTest.php @@ -1,9 +1,9 @@ isInstanceOf('\\Ratchet\\Component\\WebSocket\\Version\\VersionInterface'); + $constraint = $this->isInstanceOf('\\Ratchet\\WebSocket\\Version\\VersionInterface'); $this->assertThat($this->_version, $constraint); } @@ -127,10 +127,10 @@ class RFC6455Test extends \PHPUnit_Framework_TestCase { } public function testNewMessage() { - $this->assertInstanceOf('\\Ratchet\\Component\\WebSocket\\Version\\RFC6455\\Message', $this->_version->newMessage()); + $this->assertInstanceOf('\\Ratchet\\WebSocket\\Version\\RFC6455\\Message', $this->_version->newMessage()); } public function testNewFrame() { - $this->assertInstanceOf('\\Ratchet\\Component\\WebSocket\\Version\\RFC6455\\Frame', $this->_version->newFrame()); + $this->assertInstanceOf('\\Ratchet\\WebSocket\\Version\\RFC6455\\Frame', $this->_version->newFrame()); } } \ No newline at end of file