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.
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');
}
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');
}
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');
}
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');
}
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');
}
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');
}
- Read upRead up
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');
}
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');
}
- Read upRead up
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');
}
- Read upRead up
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');
}
- Read upRead up
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"