JBlond/apache_log_parser

View on GitHub
ApacheLogParser.php

Summary

Maintainability
B
5 hrs
Test Coverage

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

    public function table(): string
    {
        $out = '<br /><br />Parsed '
            . $this->stats['rows']
            . ' lines. Found <b>'
Severity: Minor
Found in ApacheLogParser.php - About 1 hr to fix

    Method paralyseLog has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function paralyseLog(): void
        {
            $this->parseData();
            $type = array();
            $detail = array();
    Severity: Minor
    Found in ApacheLogParser.php - About 1 hr to fix

      Method output has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function output(): string
          {
              return '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
              "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' .
                  '<html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><title>apache log parser</title>
      Severity: Minor
      Found in ApacheLogParser.php - About 1 hr to fix

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

            protected function parseData(): void
            {
                $input = explode("\n", $this->content);
                $this->stats['rows'] = 0;
                $array_size = sizeof($input);
        Severity: Minor
        Found in ApacheLogParser.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 paralyseLog has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function paralyseLog(): void
            {
                $this->parseData();
                $type = array();
                $detail = array();
        Severity: Minor
        Found in ApacheLogParser.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 table has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function table(): string
            {
                $out = '<br /><br />Parsed '
                    . $this->stats['rows']
                    . ' lines. Found <b>'
        Severity: Minor
        Found in ApacheLogParser.php - About 25 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

        There are no issues that match your filters.

        Category
        Status