Showing 264 of 3,642 total issues
Function toArray
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public function toArray($extra = false): array
{
$ret = parent::toArray();
$form = $this->getForm(true);
foreach ($form as $key => $element) {
- 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
File SongsHandler.php
has 307 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php declare(strict_types=1);
namespace XoopsModules\Songlist;
require_once \dirname(__DIR__) . '/include/songlist.object.php';
Consider simplifying this complex logical expression. Open
if (($c == $strlen_chrs) || ((',' === $chrs[$c]) && (SERVICES_JSON_SLICE == $top['what']))) {
// found a comma that is not inside a string, array, etc.,
// OR we've reached the end of the character list
$slice = mb_substr($chrs, $top['where'], $c - $top['where']);
array_push($stk, ['what' => SERVICES_JSON_SLICE, 'where' => $c + 1, 'delim' => false]);
File field.php
has 289 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php declare(strict_types=1);
use Xmf\Module\Admin;
use Xmf\Request;
use XoopsModules\Songlist\Helper;
Method getFormCategory
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getFormCategory($object, $as_array = false)
{
if (!\is_object($object)) {
$handler = Helper::getInstance()
->getHandler('Category');
Function updateBlock
has a Cognitive Complexity of 21 (exceeds 5 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): void
{
$myblock = new \XoopsBlock($bid);
$myblock->setVar('title', $btitle);
$myblock->setVar('weight', $bweight);
- 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 checkVerModule
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public static function checkVerModule(\Xmf\Module\Helper $helper, ?string $source = 'github', ?string $default = 'master'): ?array
{
$moduleDirName = \basename(\dirname(__DIR__, 2));
$moduleDirNameUpper = \mb_strtoupper($moduleDirName);
$update = '';
- 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 orderBlock
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function orderBlock(
array $bid,
array $oldtitle,
array $oldside,
array $oldweight,
- 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 checkVerModule
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public static function checkVerModule(\Xmf\Module\Helper $helper, ?string $source = 'github', ?string $default = 'master'): ?array
{
$moduleDirName = \basename(\dirname(__DIR__, 2));
$moduleDirNameUpper = \mb_strtoupper($moduleDirName);
$update = '';
- 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 insert
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function insert(XoopsObject $obj, $force = true, $object = null)
{
if ($obj->isNew()) {
$new = true;
$old = $this->create();
Method getOutputValue
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getOutputValue($user, $profile)
{
\xoops_loadLanguage('modinfo', 'objects');
$value = \in_array($this->getVar('field_name'), $this->getPostVars(), true) ? $user->getVar($this->getVar('field_name')) : $profile->getVar($this->getVar('field_name'));
Method getFormRequests
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getFormRequests($object, $as_array = false)
{
if (!\is_object($object)) {
$handler = Helper::getInstance()
->getHandler('Requests');
File export.php
has 283 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php declare(strict_types=1);
use Xmf\Module\Admin;
use Xmf\Request;
use XoopsModules\Songlist\Helper;
Function toArray
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function toArray($extra = true): array
{
$ret = parent::toArray();
$form = $this->getForm(true);
foreach ($form as $key => $element) {
- 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 getFormImportb
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getFormImportb($file, $as_array = false): string
{
\xoops_loadLanguage('forms', 'songlist');
$sform = new \XoopsThemeForm(\_FRM_SONGLIST_FORM_ISNEW_ELEMENTS, 'elements', $_SERVER['SCRIPT_NAME'], 'post', true);
Method getUserSearchForm
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getUserSearchForm($action = false)
{
\xoops_loadLanguage('forms', 'songlist');
if (!$action) {
Method getFormAlbums
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getFormAlbums($object, $as_array = false)
{
if (!\is_object($object)) {
$handler = Helper::getInstance()
->getHandler('Albums');
Method insert
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function insert(\XoopsObject $obj, $force = true, $object = null)
{
if ($obj->isNew()) {
$new = true;
$old = $this->create();
Method truncateHtml
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true): string
{
if ($considerHtml) {
// if the plain text is shorter than the maximum length, return the whole text
if (mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) {
Method getFormVotes
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getFormVotes($object, $as_array = false)
{
if (!\is_object($object)) {
$handler = Helper::getInstance()
->getHandler('Votes');