mambax7/gwiki

View on GitHub
testing/LoremIpsumGenerator.php

Summary

Maintainability
D
1 day
Test Coverage

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

    public function __construct($wordsPer = 100)
    {
        $this->wordsPerParagraph = $wordsPer;
        $this->wordsPerSentence  = 24.460;
        $this->words             = [
Severity: Major
Found in testing/LoremIpsumGenerator.php - About 7 hrs to fix

    File LoremIpsumGenerator.php has 357 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    // from http://snipplr.com/view.php?codeview&id=66113
    
    //if(!defined('BASEPATH'))
    //    exit('No direct script access allowed');
    Severity: Minor
    Found in testing/LoremIpsumGenerator.php - About 4 hrs to fix

      Function getPlain has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          private function getPlain($count, $loremipsum, $returnStr = true)
          {
              $words = [];
              $this->getWords($words, $count, $loremipsum);
              //print_r($words);
      Severity: Minor
      Found in testing/LoremIpsumGenerator.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 getPlain has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function getPlain($count, $loremipsum, $returnStr = true)
          {
              $words = [];
              $this->getWords($words, $count, $loremipsum);
              //print_r($words);
      Severity: Minor
      Found in testing/LoremIpsumGenerator.php - About 1 hr to fix

        Function getWords has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            private function getWords(&$arr, $count, $loremipsum)
            {
                $i = 0;
                if ($loremipsum) {
                    $i      = 2;
        Severity: Minor
        Found in testing/LoremIpsumGenerator.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