mambax7/songlist

View on GitHub
admin/genre.php

Summary

Maintainability
F
1 wk
Test Coverage

Similar blocks of code found in 3 locations. Consider refactoring.
Open

<?php declare(strict_types=1);

use Xmf\Module\Admin;
use Xmf\Request;
use XoopsModules\Songlist\{
Severity: Major
Found in admin/genre.php and 2 other locations - About 1 wk to fix
admin/requests.php on lines 1..178
admin/voice.php on lines 1..177

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 2375.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

There must be one USE keyword per declaration
Open

use XoopsModules\Songlist\{
Severity: Minor
Found in admin/genre.php by phpcodesniffer

Each PHP statement must be on a line by itself
Open

                $GLOBALS['sort'] = Request::getString('sort', 'created', 'REQUEST');;
Severity: Minor
Found in admin/genre.php by phpcodesniffer

Line exceeds 120 characters; contains 294 characters
Open

                    redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_GENRE_SAVEDOKEY);
Severity: Minor
Found in admin/genre.php by phpcodesniffer

Line exceeds 120 characters; contains 297 characters
Open

                    redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_GENRE_FAILEDTOSAVE);
Severity: Minor
Found in admin/genre.php by phpcodesniffer

Line exceeds 120 characters; contains 247 characters
Open

                            $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
Severity: Minor
Found in admin/genre.php by phpcodesniffer

Line exceeds 120 characters; contains 247 characters
Open

                            $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
Severity: Minor
Found in admin/genre.php by phpcodesniffer

Line exceeds 120 characters; contains 292 characters
Open

                    redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_GENRE_DELETED);
Severity: Minor
Found in admin/genre.php by phpcodesniffer

Line exceeds 120 characters; contains 245 characters
Open

                        . (defined('_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key))) ? constant('_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key))) : '_AM_SONGLIST_TH_' . \mb_strtoupper(str_replace('-', '_', $key)))
Severity: Minor
Found in admin/genre.php by phpcodesniffer

Line exceeds 120 characters; contains 270 characters
Open

                        $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=edit&id=' . $_REQUEST['id'] . '&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
Severity: Minor
Found in admin/genre.php by phpcodesniffer

Line exceeds 120 characters; contains 221 characters
Open

                    $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $genreHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct']));
Severity: Minor
Found in admin/genre.php by phpcodesniffer

Line exceeds 120 characters; contains 290 characters
Open

                redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_GENRE_SAVEDOKEY);
Severity: Minor
Found in admin/genre.php by phpcodesniffer

Line exceeds 120 characters; contains 278 characters
Open

                $pagenav = new \XoopsPageNav($ttl, $GLOBALS['limit'], $GLOBALS['start'], 'start', 'limit=' . $GLOBALS['limit'] . '&sort=' . $GLOBALS['sort'] . '&order=' . $GLOBALS['order'] . '&op=' . $GLOBALS['op'] . '&fct=' . $GLOBALS['fct'] . '&filter=' . $GLOBALS['filter']);
Severity: Minor
Found in admin/genre.php by phpcodesniffer

Line exceeds 120 characters; contains 124 characters
Open

                        . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order'])
Severity: Minor
Found in admin/genre.php by phpcodesniffer

Line exceeds 120 characters; contains 253 characters
Open

                    ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']],
Severity: Minor
Found in admin/genre.php by phpcodesniffer

There are no issues that match your filters.

Category
Status