Showing 910 of 910 total issues

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

    function filter()
    {
        if (strlen($this->where_clause) > 0) {
            return $this->where_clause;
        }
Severity: Minor
Found in src/ELearn/Searcher.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 find has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function find($request, $match)
    {
        // check for domain
        if (isset($match['domainId'])) {
            $domainId = $match['domainId'];
Severity: Minor
Found in src/ELearn/Views/Topic.php - About 1 hr to fix

    Method find has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function find($request, $match)
        {
            // check for topic
            if (isset($match['topicId'])) {
                $topicId = $match['topicId'];
    Severity: Minor
    Found in src/ELearn/Views/Course.php - About 1 hr to fix

      Method findAll has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function findAll($request, $match)
          {
              // check for domain
              if (isset($match['domainId'])) {
                  $domainId = $match['domainId'];
      Severity: Minor
      Found in src/ELearn/Views/Topic.php - About 1 hr to fix

        Method find has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function find($request, $match)
            {
                // check for course
                if (isset($match['courseId'])) {
                    $courseId = $match['courseId'];
        Severity: Minor
        Found in src/ELearn/Views/Lesson.php - About 1 hr to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              public static function create($request, $match, $p)
              {
                  // check topic
                  if (isset($match['topicId'])) {
                      $topicId = $match['topicId'];
          Severity: Major
          Found in src/ELearn/Views/Course.php and 1 other location - About 1 hr to fix
          src/ELearn/Views/Lesson.php on lines 18..31

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 106.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              public static function create($request, $match, $p)
              {
                  // check course
                  if (isset($match['courseId'])) {
                      $courseId = $match['courseId'];
          Severity: Major
          Found in src/ELearn/Views/Lesson.php and 1 other location - About 1 hr to fix
          src/ELearn/Views/Course.php on lines 18..31

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 106.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                  if (count($this->sort_order) != 2) {
                      $order = null;
                  } else {
                      $s = $this->sort_order[1];
                      if (in_array($this->sort_order[0], $this->sort_reverse_order)) {
          Severity: Major
          Found in src/ELearn/Searcher.php and 1 other location - About 1 hr to fix
          src/ELearn/Searcher.php on lines 226..234

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 105.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                  if (count($this->sort_order) != 2) {
                      $order = null;
                  } else {
                      $s = $this->sort_order[1];
                      if (in_array($this->sort_order[0], $this->sort_reverse_order)) {
          Severity: Major
          Found in src/ELearn/Searcher.php and 1 other location - About 1 hr to fix
          src/ELearn/Searcher.php on lines 190..198

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 105.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Each class must be in a namespace of at least one level (a top-level vendor name)
          Open

          class ELearn_Domain extends Pluf_Model
          Severity: Minor
          Found in src/ELearn/Domain.php by phpcodesniffer

          Each class must be in a namespace of at least one level (a top-level vendor name)
          Open

          class ELearn_Form_PartUpdate extends Pluf_Form_Model

          Each class must be in a namespace of at least one level (a top-level vendor name)
          Open

          class ELearn_Grade extends Pluf_Model
          Severity: Minor
          Found in src/ELearn/Grade.php by phpcodesniffer

          Each class must be in a namespace of at least one level (a top-level vendor name)
          Open

          class ELearn_PartHistory extends Pluf_Model
          Severity: Minor
          Found in src/ELearn/PartHistory.php by phpcodesniffer

          Each class must be in a namespace of at least one level (a top-level vendor name)
          Open

          class ELearn_Part extends Pluf_Model
          Severity: Minor
          Found in src/ELearn/Part.php by phpcodesniffer

          Each class must be in a namespace of at least one level (a top-level vendor name)
          Open

          class ELearn_Lesson extends Pluf_Model
          Severity: Minor
          Found in src/ELearn/Lesson.php by phpcodesniffer

          Each class must be in a namespace of at least one level (a top-level vendor name)
          Open

          class ELearn_Course extends Pluf_Model
          Severity: Minor
          Found in src/ELearn/Course.php by phpcodesniffer

          Each class must be in a namespace of at least one level (a top-level vendor name)
          Open

          class ELearn_Searcher
          Severity: Minor
          Found in src/ELearn/Searcher.php by phpcodesniffer

          Each class must be in a namespace of at least one level (a top-level vendor name)
          Open

          class ELearn_Comment extends Pluf_Model
          Severity: Minor
          Found in src/ELearn/Comment.php by phpcodesniffer

          Each class must be in a namespace of at least one level (a top-level vendor name)
          Open

          class ELearn_Form_PartCreate extends Pluf_Form_Model

          Each class must be in a namespace of at least one level (a top-level vendor name)
          Open

          class ELearn_Topic extends Pluf_Model
          Severity: Minor
          Found in src/ELearn/Topic.php by phpcodesniffer
          Severity
          Category
          Status
          Source
          Language