skybluesofa/onthisday

View on GitHub

Showing 97 of 97 total issues

Avoid excessively long variable names like $configurationHolidays. Keep variable name length under 20.
Open

    public static $configurationHolidays = [];
Severity: Minor
Found in src/Data/Region/En/Us/Month/March.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $configurationHolidays. Keep variable name length under 20.
Open

    public static $configurationHolidays = [];
Severity: Minor
Found in src/Data/Contract/Month.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $configurationHolidays. Keep variable name length under 20.
Open

    public static $configurationHolidays = [];

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

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

    public static function getRecurringAdvancedConfigurationBasedEvents(\Carbon\Carbon $date) {
        $events = [];

        if ($date->day == 13 && $date->isFriday()) {
            $events[] = "Friday the 13th";
Severity: Minor
Found in src/Data/Region/En/Us/Month/August.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 getRecurringAdvancedConfigurationBasedEvents has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getRecurringAdvancedConfigurationBasedEvents(\Carbon\Carbon $date) {
        $events = [];

        if ($date->day == 13 && $date->isFriday()) {
            $events[] = "Friday the 13th";
Severity: Minor
Found in src/Data/Region/En/Us/Month/August.php - About 1 hr to fix

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

        public static function getRecurringAdvancedConfigurationBasedEvents(\Carbon\Carbon $date) {
            $events = [];
    
            if ($date->day == 13 && $date->isFriday()) {
                $events[] = "Friday the 13th";
    Severity: Minor
    Found in src/Data/Region/En/Us/Month/September.php - About 1 hr to fix

      Avoid using undefined variables such as '$laborDay' which will lead to PHP notices.
      Open

              if ($date->day == $laborDay->day) {

      UndefinedVariable

      Since: 2.8.0

      Detects when a variable is used that has not been defined before.

      Example

      class Foo
      {
          private function bar()
          {
              // $message is undefined
              echo $message;
          }
      }

      Source https://phpmd.org/rules/cleancode.html#undefinedvariable

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

        private function getRecurringConfigurationBasedItems($type=null) {
          $propertyName = 'configuration'.ucfirst(strtolower($type));
          $items = [];
          foreach ($this->getMonthClasses() as $monthClass) {
            if (property_exists($monthClass, $propertyName)) {
      Severity: Minor
      Found in src/Data/Parser.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 getRecurringAdvancedConfigurationBasedEvents has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function getRecurringAdvancedConfigurationBasedEvents(\Carbon\Carbon $date) {
              $events = [];
      
              if ($date->day == 13 && $date->isFriday()) {
                  $events[] = "Friday the 13th";
      Severity: Minor
      Found in src/Data/Region/En/Us/Month/June.php - About 1 hr to fix

        Avoid variables with short names like $H. Configured minimum length is 3.
        Open

                $H = (int)($C - (int)($C / 4) - (int)((8*$C+13) / 25) + 19*$G + 15) % 30;
        Severity: Minor
        Found in src/Data/Contract/Month.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $E. Configured minimum length is 3.
        Open

                $E = mktime(0,0,0, $m, $d, $y);
        Severity: Minor
        Found in src/Data/Contract/Month.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $I. Configured minimum length is 3.
        Open

                $I = (int)$H - (int)($H / 28)*(1 - (int)($H / 28)*(int)(29 / ($H + 1))*((int)(21 - $G) / 11));
        Severity: Minor
        Found in src/Data/Contract/Month.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $L. Configured minimum length is 3.
        Open

                $L = $I - $J;
        Severity: Minor
        Found in src/Data/Contract/Month.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $C. Configured minimum length is 3.
        Open

                $C = (int)($year / 100);
        Severity: Minor
        Found in src/Data/Contract/Month.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $m. Configured minimum length is 3.
        Open

                $m = 3 + (int)(($L + 40) / 44);
        Severity: Minor
        Found in src/Data/Contract/Month.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $d. Configured minimum length is 3.
        Open

                $d = $L + 28 - 31 * ((int)($m / 4));
        Severity: Minor
        Found in src/Data/Contract/Month.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $J. Configured minimum length is 3.
        Open

                $J = ($year + (int)($year/4) + $I + 2 - $C + (int)($C/4)) % 7;
        Severity: Minor
        Found in src/Data/Contract/Month.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $G. Configured minimum length is 3.
        Open

                $G = $year % 19;
        Severity: Minor
        Found in src/Data/Contract/Month.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Avoid variables with short names like $y. Configured minimum length is 3.
        Open

                $y = $year;
        Severity: Minor
        Found in src/Data/Contract/Month.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#shortvariable

        Consider simplifying this complex logical expression.
        Open

                if (($date->day==1 && $date->isFriday())
                    || $date->day==2 && in_array($date->englishDayOfWeek, ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"])
                    || ($date->day==3 && $date->isMonday())
                    ) {
                    $events[] = "National Leave the Office Early Day";
        Severity: Major
        Found in src/Data/Region/En/Us/Month/June.php - About 40 mins to fix
          Severity
          Category
          Status
          Source
          Language