File manage.php
has 574 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
require(LanguagePath . 'manage.php');
SetStyle('api', 'API');
$ID = intval(Request('Post', 'ID', 0));
Method favorite
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function favorite($IsFavorite, $FavoriteType)
{
global $TimeStamp, $CurUserID;
Auth(1);
//$IsFavorite: 检查主题/标签/用户/帖子是否存在
Function favorite
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
private function favorite($IsFavorite, $FavoriteType)
{
global $TimeStamp, $CurUserID;
Auth(1);
//$IsFavorite: 检查主题/标签/用户/帖子是否存在
- 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
Manage
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class Manage
{
private $id;
private $action;
private $db;
Method topicAddTag
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function topicAddTag($TopicInfo)
{
global $TimeStamp;
Auth(4, $TopicInfo['UserID'], true);
$TagName = TagsDiff(array(
Function topicAddTag
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function topicAddTag($TopicInfo)
{
global $TimeStamp;
Auth(4, $TopicInfo['UserID'], true);
$TagName = TagsDiff(array(
- 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 postEdit
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function postEdit($PostInfo)
{
global $CurUserRole, $CurUserName, $TimeStamp;
if ($this->config['AllowEditing'] === 'true') {
Auth(4, $PostInfo['UserID'], true);
Method getManageInfo
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getManageInfo($manageType)
{
global $CurUserID;
switch ($manageType) {
case 'topic':
Function postEdit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function postEdit($PostInfo)
{
global $CurUserRole, $CurUserName, $TimeStamp;
if ($this->config['AllowEditing'] === 'true') {
Auth(4, $PostInfo['UserID'], true);
- 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 getManageInfo
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getManageInfo($manageType)
{
global $CurUserID;
switch ($manageType) {
case 'topic':
- 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
Avoid too many return
statements within this method. Open
return $this->db->row("SELECT * FROM " . PREFIX . "tags WHERE ID=:ID", array(
"ID" => $this->id
));
Avoid too many return
statements within this method. Open
return [];
Function tagUploadIcon
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function tagUploadIcon($TagInfo)
{
Auth(3);
if ($_FILES['TagIcon']['size'] && $_FILES['TagIcon']['size'] < 1048576) {
require(LibraryPath . "ImageResize.class.php");
- 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 deleteUpload
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function deleteUpload($uploadRecordList)
{
foreach ($uploadRecordList as $uploadRecord) {
$numberDuplicateFiles = $this->db->single('SELECT count(*) FROM ' . PREFIX . 'upload
WHERE
- 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"