appserver-io/webserver

View on GitHub
src/AppserverIo/WebServer/ConnectionHandlers/HttpConnectionHandler.php

Summary

Maintainability
D
2 days
Test Coverage

Function handle has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function handle(SocketInterface $connection, WorkerInterface $worker)
    {
        // register shutdown handler once to avoid strange memory consumption problems
        $this->registerShutdown();

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File HttpConnectionHandler.php has 334 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * \AppserverIo\WebServer\ConnectionHandlers\HttpConnectionHandler
 *

Method handle has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function handle(SocketInterface $connection, WorkerInterface $worker)
    {
        // register shutdown handler once to avoid strange memory consumption problems
        $this->registerShutdown();

HttpConnectionHandler has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

class HttpConnectionHandler implements ConnectionHandlerInterface
{

    /**
     * Defines the read length for http connections

Method shutdown has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function shutdown()
    {
        // get refs to local vars
        $requestContext = $this->getRequestContext();
        $connection = $this->getConnection();

Method logAccess has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function logAccess()
    {
        // get object refs to local var
        $request = $this->getParser()->getRequest();
        $response = $this->getParser()->getResponse();

Function shutdown has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function shutdown()
    {
        // get refs to local vars
        $requestContext = $this->getRequestContext();
        $connection = $this->getConnection();

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

There are no issues that match your filters.

Category
Status