gomoob/php-websocket-server

View on GitHub
src/main/php/Gomoob/WebSocket/Server/Ratchet/RatchetApplication.php

Summary

Maintainability
A
1 hr
Test Coverage

Method onMessage has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function onMessage(ConnectionInterface $connection, $strMessage)
    {
        // In development mode we log a message
        $this->logger->debug(
            'Receiving message on WebSocket connection with resource id \'{resourceId}\'.',
Severity: Minor
Found in src/main/php/Gomoob/WebSocket/Server/Ratchet/RatchetApplication.php - About 1 hr to fix

    Missing class import via use statement (line '137', column '23').
    Open

                throw new \InvalidArgumentException($errorMessage, -1, $iaex);

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '152', column '23').
    Open

                throw new \InvalidArgumentException($errorMessage);

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Missing class import via use statement (line '97', column '23').
    Open

                throw new \InvalidArgumentException('Connection opening is not authorized !');

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

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

            $tags = QueryStringTagsParser::parse($connection->WebSocket->request->getQuery());

    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 '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

    There are no issues that match your filters.

    Category
    Status