appserver-io/webserver

View on GitHub

Showing 66 of 68 total issues

Method apply has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function apply(RequestContextInterface $requestContext, ResponseInterface $response, array $serverBackreferences)
    {
        // First of all we have to resolve the target string with the backreferences of the matching condition
        // Separate the keys from the values so we can use them in str_replace
        // And also mix in the server's backreferences for good measure
Severity: Major
Found in src/AppserverIo/WebServer/Modules/Rewrite/Entities/Rule.php - About 2 hrs to fix

Method process has 47 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/AccessModule.php - About 1 hr to fix

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

    public function process(RequestInterface $request, ResponseInterface $response, RequestContextInterface $requestContext, $hook)
    {
        // if false hook is comming do nothing
        if (ModuleHooks::REQUEST_POST !== $hook) {
            return;
Severity: Minor
Found in src/AppserverIo/WebServer/Modules/VirtualHostModule.php - About 1 hr to fix

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

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

        /**
         * @var $request \AppserverIo\Psr\HttpMessage\RequestInterface
Severity: Minor
Found in src/AppserverIo/WebServer/Modules/LocationModule.php - About 1 hr to fix

Function lookup has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

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

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

    protected function formatResponse($stdout)
    {

        // split the header from the body. Split on \n\n.
        $splitter = "\r\n\r\n";
Severity: Minor
Found in src/AppserverIo/WebServer/Modules/FcgiModule.php - About 1 hr to fix

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

    public function process(RequestInterface $request, ResponseInterface $response, RequestContextInterface $requestContext, $hook)
    {
        try {
            // 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/FcgiModule.php - About 1 hr to fix

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

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

        /**
         * @var $request \AppserverIo\Psr\HttpMessage\RequestInterface
Severity: Minor
Found in src/AppserverIo/WebServer/Modules/AutoIndexModule.php - About 1 hr 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 13 (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/DirectoryModule.php - About 1 hr 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 13 (exceeds 5 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

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 39 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) {
            return;
Severity: Minor
Found in src/AppserverIo/WebServer/Modules/RewriteModule.php - About 1 hr to fix

Method prepareEnvironment has 39 lines of code (exceeds 25 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 1 hr to fix

Method __construct has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __construct($operand, $action, $flags = array())
    {
        // Fill the default values for our members here
        $this->allowedTypes = array(
            'regex',
Severity: Minor
Found in src/AppserverIo/WebServer/Modules/Rewrite/Entities/Condition.php - About 1 hr to fix

Function lookup has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

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

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

    public function process(RequestInterface $request, ResponseInterface $response, RequestContextInterface $requestContext, $hook)
    {
        try {
            // if false hook is coming do nothing
            if (ModuleHooks::RESPONSE_POST !== $hook) {
Severity: Minor
Found in src/AppserverIo/WebServer/Modules/AnalyticsModule.php - About 1 hr to fix

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

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

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

    public function __construct($conditionString, $target, $flagString)
    {
        // Set the raw string properties and append our default operand to the condition string
        $this->conditionString = $conditionString;
        $conditionString .= $this->getDefaultOperand();
Severity: Minor
Found in src/AppserverIo/WebServer/Modules/Rewrite/Entities/Rule.php - About 1 hr to fix

Function matches has a Cognitive Complexity of 11 (exceeds 5 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

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 __construct has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct($conditionString, $target, $flagString)
    {
        // Set the raw string properties and append our default operand to the condition string
        $this->conditionString = $conditionString;
        $conditionString .= $this->getDefaultOperand();
Severity: Minor
Found in src/AppserverIo/WebServer/Modules/Rewrite/Entities/Rule.php - About 1 hr 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 checkInputParameters has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function checkInputParameters(array $params)
    {
        // we only check if we know the requirements
        if (isset($this->requiredParameters[$params['t']])) {
            foreach ($this->requiredParameters[$params['t']] as $requirement) {

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

Severity
Category
Status
Source
Language