gomoob/php-websocket-server

View on GitHub

Showing 128 of 128 total issues

Avoid using static access to class '\Gomoob\WebSocket\Request\WebSocketRequest' in method 'testAuthorizeSend'.
Open

                WebSocketRequest::factory('Hello !')

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid unused local variables such as '$ioConnection'.
Open

        $ioConnection = $this->createIoConnection();

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid using static access to class 'Gomoob\WebSocket\Server\WebSocketServer' in method 'testCreate'.
Open

        $webSockerServer = WebSocketServer::create();

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\Ratchet\Server\IoServer' in method 'run'.
Open

        $this->ratchetServer = IoServer::factory(
            new HttpServer(
                new WsServer($this->ratchetApplication)
            ),
            $this->options['port'],

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\Gomoob\WebSocket\Request\WebSocketRequest' in method 'testCount'.
Open

        $webSocketRequest0 = WebSocketRequest::create('Message 0.');

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\Gomoob\WebSocket\Request\WebSocketRequest' in method 'testReset'.
Open

        $webSocketRequest0 = WebSocketRequest::create('Message 0.');

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\Gomoob\WebSocket\Message\Message' in method 'testSend'.
Open

            WebSocketRequest::factory(Message::create())

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\Gomoob\WebSocket\Request\WebSocketRequest' in method 'testCreateFromArray'.
Open

        $webSocketRequest = WebSocketRequest::createFromArray(
            [
                'message' => [
                    'type' => 'MY_TYPE',
                    'metadata' => [

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

The method testSend() has 172 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function testSend()
    {
        $webSocketClient = new WebSocketClient('ws://localhost:8080');
        
        // Backup the Textalk WebSocket client

Avoid using static access to class '\Gomoob\WebSocket\Request\WebSocketRequest' in method 'testCreateFromArray'.
Open

            WebSocketRequest::createFromArray(
                [
                    'tags' => [
                        'tag1' => 'tag1Value',
                        'tag2' => 'tag2Value'

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Gomoob\WebSocket\Server\QueryStringTagsParser' in method 'testParse'.
Open

            QueryStringTagsParser::parse($queryString);

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

The method createFromArray() has an NPath complexity of 512. The configured NPath complexity threshold is 200.
Open

    public static function createFromArray(array $jsonArray, IMessageParser $messageParser = null)
    {
        // Ensure the array contains only valid key names
        foreach (array_keys($jsonArray) as $key) {
            if (!is_string($key) || !in_array($key, ['message', 'tags', 'metadata'])) {

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

Avoid using static access to class '\Gomoob\WebSocket\Request\WebSocketRequest' in method 'onMessage'.
Open

            $webSocketRequest = WebSocketRequest::createFromJSON($strMessage, $this->messageParser);

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\Gomoob\WebSocket\Request\WebSocketRequest' in method 'testCount'.
Open

        $webSocketRequest2 = WebSocketRequest::create('Message 2.');

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\Gomoob\WebSocket\Request\WebSocketRequest' in method 'testReset'.
Open

        $webSocketRequest1 = WebSocketRequest::create('Message 1.');

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\Gomoob\WebSocket\Request\WebSocketRequest' in method 'testCreateFromJSON'.
Open

        $webSocketRequest = WebSocketRequest::createFromJSON(
            '{
                "message" : {
                    "type" : "MY_TYPE",
                    "metadata" : {

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Gomoob\WebSocket\Server\QueryStringTagsParser' in method 'testParse'.
Open

        $tags = QueryStringTagsParser::parse($queryString);

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\Gomoob\WebSocket\Message\Message' in method 'testSend'.
Open

            WebSocketRequest::factory(Message::create('MY_TYPE'))

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\Gomoob\WebSocket\Request\WebSocketRequest' in method 'testCreateFromArray'.
Open

            WebSocketRequest::createFromArray(
                [
                    'message' => [
                        'a' => 'b'
                    ],

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Gomoob\WebSocket\Server\QueryStringTagsParser' in method 'testParse'.
Open

            QueryStringTagsParser::parse($queryString);

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Severity
Category
Status
Source
Language