Showing 374 of 649 total issues
Function insert
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function insert(XoopsObject $object, $force = false)
{
if ('xoopsmodules\smartfaq\answer' !== \mb_strtolower(\get_class($object))) {
return false;
}
- 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 insert
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function insert(\XoopsObject $object, $force = false)
{
if ('xoopsmodules\smartfaq\category' !== \mb_strtolower(\get_class($object))) {
return false;
}
- 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 b_faqs_new_edit
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_faqs_new_edit($options)
{
global $xoopsDB, $xoopsModule, $xoopsUser;
// require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';
Method insert
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function insert(XoopsObject $object, $force = false)
{
if ('xoopsmodules\smartfaq\answer' !== \mb_strtolower(\get_class($object))) {
return false;
}
Method getLinkedUnameFromId
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getLinkedUnameFromId($userid = 0, $name = 0, $users = [])
{
if (!\is_numeric($userid)) {
return $userid;
}
Method __construct
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($id = null)
{
$this->db = XoopsDatabaseFactory::getDatabaseConnection();
$this->initVar('faqid', \XOBJ_DTYPE_INT, -1, false);
$this->initVar('categoryid', \XOBJ_DTYPE_INT, 0, false);
Method xoops_module_install_smartfaq
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function xoops_module_install_smartfaq(\XoopsModule $module)
{
require \dirname(__DIR__, 3) . '/mainfile.php';
$moduleDirName = \basename(\dirname(__DIR__));
Method b_faqs_recent_questions_edit
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_faqs_recent_questions_edit($options)
{
// require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';
$form = Smartfaq\Utility::createCategorySelect($options[0]);
Method loadTableFromArrayWithReplace
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function loadTableFromArrayWithReplace($table, $data, $search, $replace)
{
/** @var \XoopsMySQLDatabase $db */
$db = \XoopsDatabaseFactory::getDatabaseConnection();
Method getFaqsAdminSide
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getFaqsAdminSide(
$limit = 0,
$start = 0,
$status = '',
$categoryid = -1,
Method getLastPublishedByCat
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getLastPublishedByCat($status = [Constants::SF_STATUS_PUBLISHED, Constants::SF_STATUS_NEW_ANSWER])
{
$ret = [];
$faqclause = '';
if (!Smartfaq\Utility::userIsAdmin()) {
Function parseShadowExtras
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parseShadowExtras(pf, i, ar) {
var k = i, v;
if (k < ar.length) {
if (ar[k] == SHADOW) {
eval(pf + 'shadow=(' + pf + 'shadow==0)?1:0');
Function parseShadowExtras
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parseShadowExtras(pf, i, ar) {
var k = i, v;
if (k < ar.length) {
if (ar[k] == SHADOW) {
Method getServerStats
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getServerStats()
{
//mb $wfdownloads = WfdownloadsWfdownloads::getInstance();
$moduleDirName = \basename(\dirname(__DIR__, 2));
$moduleDirNameUpper = \mb_strtoupper($moduleDirName);
Method getFaqs
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
$limit = 0,
$start = 0,
$status = '',
$categoryid = -1,
$sort = 'datesub',
Method updateBlock
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
public function updateBlock(int $bid, string $btitle, string $bside, string $bweight, string $bvisible, string $bcachetime, ?array $bmodule, ?array $options, ?array $groups)
Method b_faqs_new_show
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_faqs_new_show($options)
{
// require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';
$block = [];
Method b_faqs_recent_questions_show
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function b_faqs_recent_questions_show($options)
{
// require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';
$block = [];
Method answer
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function answer()
{
$answerHandler = new Smartfaq\AnswerHandler($this->db);
switch ($this->status()) {
case Constants::SF_STATUS_SUBMITTED:
Function parseExclusiveExtras
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function parseExclusiveExtras(pf, i, ar) {
var k = i, v;
olOverrideIsSet = false;
if (k < ar.length) {
if (ar[k] == EXCLUSIVEOVERRIDE) {
- 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"