Skip to content

Commit 9796e45

Browse files
committed
change namespace and class name to upper
1 parent ca5dcba commit 9796e45

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+183
-179
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ run: `composer up`
1717
### only use webSocket server
1818

1919
```php
20-
use inhere\webSocket\WebSocketServer;
20+
use Inhere\WebSocket\WebSocketServer;
2121

2222
$ws = new WebSocketServer();
2323

@@ -34,8 +34,8 @@ $ws->start();
3434
### use the webSocket application
3535

3636
```php
37-
use inhere\webSocket\Application;
38-
use inhere\webSocket\WebSocketServer;
37+
use Inhere\WebSocket\Application;
38+
use Inhere\WebSocket\WebSocketServer;
3939

4040
$app = new Application('', 9501);
4141

@@ -51,7 +51,7 @@ $app->onClose(function (WebSocketServer $ws, Application $app) {
5151
]);
5252
});
5353

54-
$rootHandler = $app->route('/', new \inhere\webSocket\handlers\RootHandler());
54+
$rootHandler = $app->route('/', new \Inhere\WebSocket\handlers\RootHandler());
5555

5656
// commands
5757
$rootHandler->add('test', function ($data, $index, Application $app) {

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
},
2222
"autoload": {
2323
"psr-4": {
24-
"inhere\\webSocket\\" : "src/"
24+
"Inhere\\WebSocket\\" : "src/"
2525
}
2626
},
2727
"suggest": {

examples/app_server

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
* RUN `server/ws_server`
99
*/
1010

11-
use inhere\webSocket\Application;
12-
use inhere\webSocket\http\Request;
13-
use inhere\webSocket\server\ClientMetadata;
11+
use Inhere\WebSocket\Application;
12+
use Inhere\WebSocket\Http\Request;
13+
use Inhere\WebSocket\Server\ClientMetadata;
1414

1515
define('PROJECT_PATH', __DIR__);
1616

examples/base_server

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
require __DIR__ . '/../../../autoload.php';
55

6-
use inhere\webSocket\WSInterface;
7-
use inhere\webSocket\server\ServerFactory;
8-
use inhere\webSocket\server\ServerInterface;
6+
use Inhere\WebSocket\WSInterface;
7+
use Inhere\WebSocket\Server\ServerFactory;
8+
use Inhere\WebSocket\Server\ServerInterface;
99

1010
define('PROJECT_PATH', __DIR__);
1111

examples/chatRoom/website/ChatRoom.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
* Time: 9:44
77
*/
88

9-
namespace inhere\webSocket\examples\charRoom\webSite;
9+
namespace Inhere\WebSocket\examples\charRoom\webSite;
1010

1111

1212
class ChatRoom
1313
{
1414

15-
}
15+
}

examples/deprecated/BaseWebSocket.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
* Time: 13:01
77
*/
88

9-
namespace inhere\webSocket\server\deprecated;
9+
namespace Inhere\WebSocket\Server\deprecated;
1010

1111
use inhere\library\traits\FixedEventTrait;
1212
use inhere\library\traits\OptionsTrait;
1313

1414
/**
1515
* Class BaseWebSocket
16-
* @package inhere\webSocket\server\deprecated
16+
* @package Inhere\WebSocket\Server\deprecated
1717
*/
1818
abstract class BaseWebSocket
1919
{

examples/deprecated/WebSocketServer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Time: 下午8:29
77
*/
88

9-
namespace inhere\webSocket\server\deprecated;
9+
namespace Inhere\WebSocket\Server\deprecated;
1010

1111
use Inhere\Http\Request;
1212
use Inhere\Http\Response;

examples/modules.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
* @var $app Application
99
*/
1010

11-
use inhere\webSocket\Application;
12-
use inhere\webSocket\module\ModuleInterface;
11+
use Inhere\WebSocket\Application;
12+
use Inhere\WebSocket\Module\ModuleInterface;
1313

14-
$rootModule = $app->module('/', new \inhere\webSocket\module\RootModule());
14+
$rootModule = $app->module('/', new \Inhere\WebSocket\Module\RootModule());
1515

1616
// commands
1717
$rootModule->add('test', function ($data, $index, ModuleInterface $module) {

examples/old_server

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
require __DIR__ . '/../../../autoload.php';
1111

12-
use inhere\webSocket\server\deprecated\WebSocketServer;
12+
use Inhere\WebSocket\Server\deprecated\WebSocketServer;
1313

1414
$ws = new WebSocketServer('', 9501);
1515

examples/test_server

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
require __DIR__ . '/../../../autoload.php';
55

6-
use inhere\webSocket\WSInterface;
7-
use inhere\webSocket\server\ServerFactory;
8-
use inhere\webSocket\server\ServerInterface;
6+
use Inhere\WebSocket\WSInterface;
7+
use Inhere\WebSocket\Server\ServerFactory;
8+
use Inhere\WebSocket\Server\ServerInterface;
99

1010
define('PROJECT_PATH', __DIR__);
1111

src/Application.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Time: 23:13
77
*/
88

9-
namespace inhere\webSocket;
9+
namespace Inhere\WebSocket;
1010

1111
use inhere\console\io\Input;
1212
use inhere\console\io\Output;
@@ -16,15 +16,15 @@
1616
use inhere\library\traits\EventTrait;
1717
use inhere\library\traits\OptionsTrait;
1818
use inhere\library\log\FileLogger;
19-
use inhere\webSocket\module\ModuleInterface;
20-
use inhere\webSocket\module\RootModule;
21-
use inhere\webSocket\http\WSResponse;
19+
use Inhere\WebSocket\Module\ModuleInterface;
20+
use Inhere\WebSocket\Module\RootModule;
21+
use Inhere\WebSocket\Http\WSResponse;
2222
use Inhere\Http\Request;
2323
use Inhere\Http\Response;
24-
use inhere\webSocket\server\ClientMetadata;
25-
use inhere\webSocket\server\ServerAbstracter;
26-
use inhere\webSocket\server\ServerFactory;
27-
use inhere\webSocket\server\ServerInterface;
24+
use Inhere\WebSocket\Server\ClientMetadata;
25+
use Inhere\WebSocket\Server\ServerAbstracter;
26+
use Inhere\WebSocket\Server\ServerFactory;
27+
use Inhere\WebSocket\Server\ServerInterface;
2828

2929
/**
3030
* Class Application

src/client/ClientAbstracter.php renamed to src/Client/ClientAbstracter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
* Time: 15:55
77
*/
88

9-
namespace inhere\webSocket\client;
9+
namespace Inhere\WebSocket\Client;
1010

1111
use inhere\exceptions\ConnectException;
1212
use inhere\library\utils\LiteLogger;
13-
use inhere\webSocket\WSAbstracter;
13+
use Inhere\WebSocket\WSAbstracter;
1414
use Inhere\Http\Request;
1515
use Inhere\Http\Response;
1616
use Inhere\Http\Uri;
1717

1818
/**
1919
* Class ClientAbstracter
20-
* @package inhere\webSocket\client
20+
* @package Inhere\WebSocket\Client
2121
*/
2222
abstract class ClientAbstracter extends WSAbstracter implements ClientInterface
2323
{

src/client/ClientFactory.php renamed to src/Client/ClientFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
* Time: 9:14
77
*/
88

9-
namespace inhere\webSocket\client;
9+
namespace Inhere\WebSocket\Client;
1010

1111
/**
1212
* Class WebSocketClient
13-
* @package inhere\webSocket\client
13+
* @package Inhere\WebSocket\Client
1414
*/
1515
final class ClientFactory
1616
{

src/client/ClientInterface.php renamed to src/Client/ClientInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
* Time: 12:41
77
*/
88

9-
namespace inhere\webSocket\client;
9+
namespace Inhere\WebSocket\Client;
1010

1111
/**
1212
* Interface ClientInterface
13-
* @package inhere\webSocket\client
13+
* @package Inhere\WebSocket\Client
1414
*/
1515
interface ClientInterface
1616
{

src/client/InteractiveClient.php renamed to src/Client/InteractiveClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
* Time: 13:26
77
*/
88

9-
namespace inhere\webSocket\client;
9+
namespace Inhere\WebSocket\Client;
1010

1111
/**
1212
* Class InteractiveClient
1313
* Interactive Terminal environment
14-
* @package inhere\webSocket\client
14+
* @package Inhere\WebSocket\Client
1515
*/
1616
class InteractiveClient
1717
{

src/client/SocketsClient.php renamed to src/Client/SocketsClient.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
* Time: 11:13
77
*/
88

9-
namespace inhere\webSocket\client;
9+
namespace Inhere\WebSocket\Client;
1010

1111
use inhere\library\helpers\PhpHelper;
12-
use inhere\webSocket\traits\SocketsTrait;
13-
use inhere\webSocket\WSHelper;
12+
use Inhere\WebSocket\Traits\SocketsTrait;
13+
use Inhere\WebSocket\WSHelper;
1414

1515
/**
1616
* Class SocketsClient
1717
* power by `sockets` extension
18-
* @package inhere\webSocket\client
18+
* @package Inhere\WebSocket\Client
1919
*/
2020
class SocketsClient extends ClientAbstracter
2121
{

src/client/StreamsClient.php renamed to src/Client/StreamsClient.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
* Time: 12:44
77
*/
88

9-
namespace inhere\webSocket\client;
9+
namespace Inhere\WebSocket\Client;
1010

1111
use inhere\exceptions\ConnectException;
12-
use inhere\webSocket\traits\StreamsTrait;
12+
use Inhere\WebSocket\Traits\StreamsTrait;
1313

1414
/**
1515
* Class StreamsClient
1616
* power by `streams` extension(php built-in)
17-
* @package inhere\webSocket\client
17+
* @package Inhere\WebSocket\Client
1818
*/
1919
class StreamsClient extends ClientAbstracter
2020
{

src/client/SwooleClient.php renamed to src/Client/SwooleClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Time: 12:46
77
*/
88

9-
namespace inhere\webSocket\client;
9+
namespace Inhere\WebSocket\Client;
1010

1111
use inhere\exceptions\ConnectException;
1212
use inhere\exceptions\UnknownCalledException;
@@ -15,7 +15,7 @@
1515
/**
1616
* Class SwooleDriver
1717
* power by `swoole` extension
18-
* @package inhere\webSocket\client
18+
* @package Inhere\WebSocket\Client
1919
*/
2020
class SwooleClient extends ClientAbstracter
2121
{

src/helpers/DataHelper.php renamed to src/Helpers/DataHelper.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
* Time: 13:50
77
*/
88

9-
namespace inhere\webSocket\utils;
9+
namespace Inhere\WebSocket\Helpers;
1010

1111
/**
1212
* Class DataHelper
13-
* @package inhere\webSocket\utils
13+
* @package Inhere\WebSocket\Helpers
1414
*/
1515
class DataHelper
1616
{
@@ -110,7 +110,7 @@ protected function split_packet($length, $packet, $user)
110110

111111
//split frame from packet and process it
112112
$frame = substr($fullpacket, $frame_pos, $frameSize);
113-
113+
114114
if (($message = $this->deFrame($frame, $user, $headers)) !== FALSE) {
115115
if ($user->hasSentClose) {
116116
$this->disconnect($user->socket);
@@ -123,7 +123,7 @@ protected function split_packet($length, $packet, $user)
123123
}
124124
}
125125
}
126-
126+
127127
//get the new position also modify packet data
128128
$frame_pos += $frameSize;
129129
$packet = substr($fullpacket, $frame_pos);
@@ -151,7 +151,7 @@ protected function deFrame($message, &$user)
151151
//echo $this->strToHex($message);
152152
$headers = $this->extractHeaders($message);
153153
$pongReply = $willClose = false;
154-
154+
155155
switch ($headers['opcode']) {
156156
case 0:
157157
case 1:
@@ -337,4 +337,4 @@ protected function strToHex($str)
337337

338338
return $strOut . "\n";
339339
}
340-
}
340+
}

src/helpers/exceptions/BadRequestException.php renamed to src/Helpers/Exceptions/BadRequestException.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
* Time: 9:14
77
*/
88

9-
namespace inhere\webSocket\helpers\exceptions;
9+
namespace Inhere\WebSocket\Helpers\Exceptions;
1010

11-
use inhere\webSocket\protocols\Protocol;
11+
use Inhere\WebSocket\Protocols\Protocol;
1212

1313
/**
1414
* Class BadRequestException
15-
* @package inhere\webSocket\client
15+
* @package Inhere\WebSocket\client
1616
*/
1717
class BadRequestException extends \Exception
1818
{

src/helpers/exceptions/CloseException.php renamed to src/Helpers/Exceptions/CloseException.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
* Time: 9:14
77
*/
88

9-
namespace inhere\webSocket\helpers\exceptions;
9+
namespace Inhere\WebSocket\Helpers\Exceptions;
1010

11-
use inhere\webSocket\protocols\Protocol;
11+
use Inhere\WebSocket\Protocols\Protocol;
1212

1313
/**
1414
* Class CloseException
15-
* @package inhere\webSocket\client
15+
* @package Inhere\WebSocket\client
1616
*/
1717
class CloseException extends \Exception
1818
{

src/helpers/exceptions/ConnectionException.php renamed to src/Helpers/Exceptions/ConnectionException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
* Time: 9:14
77
*/
88

9-
namespace inhere\webSocket\helpers\exceptions;
9+
namespace Inhere\WebSocket\Helpers\Exceptions;
1010

1111
/**
1212
* Class ConnectionException
13-
* @package inhere\webSocket\client
13+
* @package Inhere\WebSocket\client
1414
*/
1515
class ConnectionException extends \Exception
1616
{

0 commit comments

Comments
 (0)