vijos/openvj

View on GitHub
src/Comment/CommentUtil.php

Summary

Maintainability
D
2 days
Test Coverage

File CommentUtil.php has 374 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * This file is part of openvj project.
 *
 * Copyright 2013-2015 openvj dev team.
Severity: Minor
Found in src/Comment/CommentUtil.php - About 5 hrs to fix

    Method createReply has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function createReply(\MongoId $commentId, $ref, $owner, $markdown)
        {
            if (!is_string($ref)) {
                throw new InvalidArgumentException('ref', 'type_invalid');
            }
    Severity: Major
    Found in src/Comment/CommentUtil.php - About 2 hrs to fix

      Method modifyReply has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function modifyReply(\MongoId $commentId, $ref, \MongoId $replyId, $markdown)
          {
              if (!is_string($ref)) {
                  throw new InvalidArgumentException('ref', 'type_invalid');
              }
      Severity: Minor
      Found in src/Comment/CommentUtil.php - About 1 hr to fix

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

            public static function createComment($ref, $owner, $markdown)
            {
                if (!is_string($ref)) {
                    throw new InvalidArgumentException('ref', 'type_invalid');
                }
        Severity: Minor
        Found in src/Comment/CommentUtil.php - About 1 hr to fix

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

              public static function modifyComment(\MongoId $commentId, $ref, $markdown)
              {
                  if (!is_string($ref)) {
                      throw new InvalidArgumentException('ref', 'type_invalid');
                  }
          Severity: Minor
          Found in src/Comment/CommentUtil.php - About 1 hr to fix

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

                public static function queryComment($ref, \MongoId $after = null)
                {
                    if (!is_string($ref)) {
                        throw new InvalidArgumentException('ref', 'type_invalid');
                    }
            Severity: Minor
            Found in src/Comment/CommentUtil.php - About 1 hr to fix

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

                  public static function createReply(\MongoId $commentId, $ref, $owner, $markdown)
                  {
                      if (!is_string($ref)) {
                          throw new InvalidArgumentException('ref', 'type_invalid');
                      }
              Severity: Minor
              Found in src/Comment/CommentUtil.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 deleteReply has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function deleteReply(\MongoId $commentId, $ref, \MongoId $replyId)
                  {
                      if (!is_string($ref)) {
                          throw new InvalidArgumentException('ref', 'type_invalid');
                      }
              Severity: Minor
              Found in src/Comment/CommentUtil.php - About 1 hr to fix

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

                    public static function modifyReply(\MongoId $commentId, $ref, \MongoId $replyId, $markdown)
                    {
                        if (!is_string($ref)) {
                            throw new InvalidArgumentException('ref', 'type_invalid');
                        }
                Severity: Minor
                Found in src/Comment/CommentUtil.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 modifyComment has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function modifyComment(\MongoId $commentId, $ref, $markdown)
                    {
                        if (!is_string($ref)) {
                            throw new InvalidArgumentException('ref', 'type_invalid');
                        }
                Severity: Minor
                Found in src/Comment/CommentUtil.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 createComment has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function createComment($ref, $owner, $markdown)
                    {
                        if (!is_string($ref)) {
                            throw new InvalidArgumentException('ref', 'type_invalid');
                        }
                Severity: Minor
                Found in src/Comment/CommentUtil.php - About 35 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