appserver-io/webserver

View on GitHub

Showing 66 of 68 total issues

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 process has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function process(RequestInterface $request, ResponseInterface $response, RequestContextInterface $requestContext, $hook)
    {

        // if false hook is coming do nothing
        if (ModuleHooks::REQUEST_POST !== $hook) {
Severity: Minor
Found in src/AppserverIo/WebServer/Modules/AuthenticationModule.php - About 1 hr to fix

Method lookup has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function lookup($requestUri)
    {
        // set targetUrl to null by default
        $targetUrl = null;
        // set base to local ref

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();

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

    public function process(RequestInterface $request, ResponseInterface $response, RequestContextInterface $requestContext, $hook)
    {
        // In php an interface is, by definition, a fixed contract. It is immutable.
        // So we have to declair the right ones afterwards...
        /**
Severity: Minor
Found in src/AppserverIo/WebServer/Modules/RewriteMapModule.php - About 1 hr to fix

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

Method process has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function process(RequestInterface $request, ResponseInterface $response, RequestContextInterface $requestContext, $hook)
    {
        // In php an interface is, by definition, a fixed contract. It is immutable.
        // So we have to declare the right ones afterwards...

Severity: Minor
Found in src/AppserverIo/WebServer/Modules/CoreModule.php - About 1 hr to fix

Method process has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function process(RequestInterface $request, ResponseInterface $response, RequestContextInterface $requestContext, $hook)
    {
        // In php an interface is, by definition, a fixed contract. It is immutable.
        // So we have to declare the right ones afterwards...
        /**
Severity: Minor
Found in src/AppserverIo/WebServer/Modules/DeflateModule.php - About 1 hr to fix

Method matches has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function matches()
    {
        // Switching between different actions we have to take.
        // Using an if cascade as it seems to be faster than switch...case
        $result = false;
Severity: Minor
Found in src/AppserverIo/WebServer/Modules/Rewrite/Entities/Condition.php - About 1 hr to fix

Function initCerts has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function initCerts()
    {
        // get stream context to enhance it
        $streamContext = $this->getServerContext()->getStreamContext();
        // get logger
Severity: Minor
Found in src/AppserverIo/WebServer/Modules/VirtualHostModule.php - About 55 mins to fix

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

Function process has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function process(RequestInterface $request, ResponseInterface $response, RequestContextInterface $requestContext, $hook)
    {
        // In php an interface is, by definition, a fixed contract. It is immutable.
        // So we have to declare the right ones afterwards...

Severity: Minor
Found in src/AppserverIo/WebServer/Modules/CoreModule.php - About 55 mins to fix

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

Function process has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function process(RequestInterface $request, ResponseInterface $response, RequestContextInterface $requestContext, $hook)
    {
        // In php an interface is, by definition, a fixed contract. It is immutable.
        // So we have to declare the right ones afterwards...
        /**
Severity: Minor
Found in src/AppserverIo/WebServer/Modules/DeflateModule.php - About 55 mins to fix

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

Avoid deeply nested control flow statements.
Open

                                if (substr($paramValue, 0, 1) !== "/") {
                                    $paramValue = getcwd() . DIRECTORY_SEPARATOR . $paramValue;
                                }
Severity: Major
Found in src/AppserverIo/WebServer/Modules/LocationModule.php - About 45 mins to fix

Function prepareOperandAdditions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    protected function prepareOperandAdditions()
    {
        foreach ($this->htaccessAdditions as $addition) {
            // The string has to start with an addition (any negating ! was cut of before)
            if (strpos($this->action, $addition) === 0) {
Severity: Minor
Found in src/AppserverIo/WebServer/Modules/Rewrite/Entities/Condition.php - About 45 mins to fix

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

Function process has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function process(RequestInterface $request, ResponseInterface $response, RequestContextInterface $requestContext, $hook)
    {
        // In php an interface is, by definition, a fixed contract. It is immutable.
        // So we have to declair the right ones afterwards...
        /**
Severity: Minor
Found in src/AppserverIo/WebServer/Modules/RewriteMapModule.php - About 35 mins to fix

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

Function getBackreferences has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getBackreferences()
    {
        // Iterate over all conditions and collect their backreferences
        $backreferences = array();
        foreach ($this->sortedConditions as $key => $sortedCondition) {
Severity: Minor
Found in src/AppserverIo/WebServer/Modules/Rewrite/Entities/Rule.php - About 35 mins to fix

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

Function resolveConditions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function resolveConditions(array $backreferences)
    {
        // Iterate over all conditions and resolve them too
        foreach ($this->sortedConditions as $key => $sortedCondition) {
            // If we got an array we have to iterate over it separately, but be aware they are or-combined
Severity: Minor
Found in src/AppserverIo/WebServer/Modules/Rewrite/Entities/Rule.php - About 35 mins to fix

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

Function prepareEnvironment has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function prepareEnvironment(RequestInterface $request, RequestContextInterface $requestContext)
    {

        // prepare the Fast-CGI environment variables
        $environment = array(
Severity: Minor
Found in src/AppserverIo/WebServer/Modules/FcgiModule.php - About 35 mins to fix

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

Function getFastCgiClient has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getFastCgiClient(RequestContextInterface $requestContext, LoopInterface $loop)
    {

        // initialize default host/port/DNS server
        $host = FcgiModule::DEFAULT_FAST_CGI_IP;
Severity: Minor
Found in src/AppserverIo/WebServer/Modules/FcgiModule.php - About 35 mins to fix

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

Avoid too many return statements within this method.
Open

            return;
Severity: Major
Found in src/AppserverIo/WebServer/Modules/DeflateModule.php - About 30 mins to fix
Severity
Category
Status
Source
Language