mambax7/songlist

View on GitHub
admin/export.php

Summary

Maintainability
F
1 wk
Test Coverage

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;
Severity: Minor
Found in admin/export.php - About 2 hrs to fix

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

                            if (mb_strlen($_POST['songid']) > 0 && !empty($data[$_POST['songid']])) {
                                $criteria = new \Criteria('songid', $data[$_POST['songid']]);
                                if ($songsHandler->getCount($criteria) > 0) {
                                    $objects = $songsHandler->getObjects($criteria, false);
                                    $object  = $objects[0]->getVar('sid');
    Severity: Major
    Found in admin/export.php and 1 other location - About 1 day to fix
    admin/export.php on lines 188..204

    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 259.

    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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

                                if (mb_strlen($_POST['songid']) > 0 && !empty($data[$_POST['songid']])) {
                                    $criteria = new \Criteria('songid', $data[$_POST['songid']]);
                                    if ($songsHandler->getCount($criteria) > 0) {
                                        $objects = $songsHandler->getObjects($criteria, false);
                                        $object  = $objects[0]->getVar('sid');
    Severity: Major
    Found in admin/export.php and 1 other location - About 1 day to fix
    admin/export.php on lines 284..300

    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 259.

    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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

                                if (mb_strlen($_POST['album']) > 0 && !empty($data[$_POST['album']])) {
                                    $criteria = new \Criteria('name', $data[$_POST['album']]);
                                    if ($albumsHandler->getCount($criteria) > 0) {
                                        $objects = $albumsHandler->getObjects($criteria, false);
                                        $abid    = $objects[0]->getVar('aid');
    Severity: Major
    Found in admin/export.php and 1 other location - About 4 hrs to fix
    admin/export.php on lines 270..282

    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 182.

    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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

                            if (mb_strlen($_POST['album']) > 0 && !empty($data[$_POST['album']])) {
                                $criteria = new \Criteria('name', $data[$_POST['album']]);
                                if ($albumsHandler->getCount($criteria) > 0) {
                                    $objects = $albumsHandler->getObjects($criteria, false);
                                    $abid    = $objects[0]->getVar('aid');
    Severity: Major
    Found in admin/export.php and 1 other location - About 4 hrs to fix
    admin/export.php on lines 174..186

    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 182.

    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

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

                                if (mb_strlen($_POST['genre']) > 0 && !empty($data[$_POST['genre']])) {
                                    $criteria = new \Criteria('name', $data[$_POST['genre']]);
                                    if ($genreHandler->getCount($criteria) > 0) {
                                        $objects = $genreHandler->getObjects($criteria, false);
                                        $gid     = $objects[0]->getVar('gid');
    Severity: Major
    Found in admin/export.php and 5 other locations - About 3 hrs to fix
    admin/export.php on lines 125..135
    admin/export.php on lines 138..148
    admin/export.php on lines 210..220
    admin/export.php on lines 222..232
    admin/export.php on lines 234..244

    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 158.

    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

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

                            if (mb_strlen($_POST['category']) > 0 && !empty($data[$_POST['category']])) {
                                $criteria = new \Criteria('name', $data[$_POST['category']]);
                                if ($categoryHandler->getCount($criteria) > 0) {
                                    $objects = $categoryHandler->getObjects($criteria, false);
                                    $cid     = $objects[0]->getVar('cid');
    Severity: Major
    Found in admin/export.php and 5 other locations - About 3 hrs to fix
    admin/export.php on lines 112..122
    admin/export.php on lines 125..135
    admin/export.php on lines 138..148
    admin/export.php on lines 210..220
    admin/export.php on lines 222..232

    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 158.

    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

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

                                if (mb_strlen($_POST['category']) > 0 && !empty($data[$_POST['category']])) {
                                    $criteria = new \Criteria('name', $data[$_POST['category']]);
                                    if ($categoryHandler->getCount($criteria) > 0) {
                                        $objects = $categoryHandler->getObjects($criteria, false);
                                        $cid     = $objects[0]->getVar('cid');
    Severity: Major
    Found in admin/export.php and 5 other locations - About 3 hrs to fix
    admin/export.php on lines 112..122
    admin/export.php on lines 125..135
    admin/export.php on lines 210..220
    admin/export.php on lines 222..232
    admin/export.php on lines 234..244

    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 158.

    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

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

                            if (mb_strlen($_POST['genre']) > 0 && !empty($data[$_POST['genre']])) {
                                $criteria = new \Criteria('name', $data[$_POST['genre']]);
                                if ($genreHandler->getCount($criteria) > 0) {
                                    $objects = $genreHandler->getObjects($criteria, false);
                                    $gid     = $objects[0]->getVar('gid');
    Severity: Major
    Found in admin/export.php and 5 other locations - About 3 hrs to fix
    admin/export.php on lines 112..122
    admin/export.php on lines 125..135
    admin/export.php on lines 138..148
    admin/export.php on lines 222..232
    admin/export.php on lines 234..244

    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 158.

    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

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

                                if (mb_strlen($_POST['voice']) > 0 && !empty($data[$_POST['voice']])) {
                                    $criteria = new \Criteria('name', $data[$_POST['voice']]);
                                    if ($voiceHandler->getCount($criteria) > 0) {
                                        $objects = $voiceHandler->getObjects($criteria, false);
                                        $gid     = $objects[0]->getVar('vid');
    Severity: Major
    Found in admin/export.php and 5 other locations - About 3 hrs to fix
    admin/export.php on lines 112..122
    admin/export.php on lines 138..148
    admin/export.php on lines 210..220
    admin/export.php on lines 222..232
    admin/export.php on lines 234..244

    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 158.

    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

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

                            if (mb_strlen($_POST['voice']) > 0 && !empty($data[$_POST['voice']])) {
                                $criteria = new \Criteria('name', $data[$_POST['voice']]);
                                if ($voiceHandler->getCount($criteria) > 0) {
                                    $objects = $voiceHandler->getObjects($criteria, false);
                                    $gid     = $objects[0]->getVar('vid');
    Severity: Major
    Found in admin/export.php and 5 other locations - About 3 hrs to fix
    admin/export.php on lines 112..122
    admin/export.php on lines 125..135
    admin/export.php on lines 138..148
    admin/export.php on lines 210..220
    admin/export.php on lines 234..244

    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 158.

    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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

                case 'actiona':
                    if (Request::hasVar('xmlfile', 'SESSION')) {
                        redirect_header($_SERVER['SCRIPT_NAME'] . '?file=' . $_SESSION['xmlfile'] . '&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED);
                    }
                    $adminObject = Admin::getInstance();
    Severity: Major
    Found in admin/export.php and 1 other location - About 3 hrs to fix
    admin/import.php on lines 29..39

    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 145.

    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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

                case 'actionb':
                    $adminObject = Admin::getInstance();
                    $adminObject->displayNavigation(basename(__FILE__));
    
                    $GLOBALS['xoopsTpl']->assign('form', FormController::getFormImportb($_SESSION['xmlfile']));
    Severity: Minor
    Found in admin/export.php and 1 other location - About 35 mins to fix
    admin/import.php on lines 100..107

    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 92.

    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

    The CASE body must start on the line following the statement
    Open

                case 'import':
    Severity: Minor
    Found in admin/export.php by phpcodesniffer

    Line exceeds 120 characters; contains 135 characters
    Open

                    $filesize = filesize($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile']));
    Severity: Minor
    Found in admin/export.php by phpcodesniffer

    Line exceeds 120 characters; contains 138 characters
    Open

    //                        foreach (explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) {
    Severity: Minor
    Found in admin/export.php by phpcodesniffer

    Line exceeds 120 characters; contains 164 characters
    Open

                            ['application/xml', 'application/xml-dtd', 'application/xml-external-parsed-entity', 'text/xml xml xsl', 'text/xml-external-parsed-entity'],
    Severity: Minor
    Found in admin/export.php by phpcodesniffer

    Line exceeds 120 characters; contains 170 characters
    Open

                            redirect_header($_SERVER['SCRIPT_NAME'] . '?file=' . $uploader->getSavedFileName() . '&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED);
    Severity: Minor
    Found in admin/export.php by phpcodesniffer

    Line exceeds 120 characters; contains 178 characters
    Open

                    $xmlarray = Utility::xml2array(file_get_contents($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])), false, 'tag');
    Severity: Minor
    Found in admin/export.php by phpcodesniffer

    Line exceeds 120 characters; contains 122 characters
    Open

                                            $objects                          = $artistsHandler->getObjects($criteria, false);
    Severity: Minor
    Found in admin/export.php by phpcodesniffer

    Line exceeds 120 characters; contains 121 characters
    Open

                    unlink($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile']));
    Severity: Minor
    Found in admin/export.php by phpcodesniffer

    Line exceeds 120 characters; contains 157 characters
    Open

                        redirect_header($_SERVER['SCRIPT_NAME'] . '?file=' . $_SESSION['xmlfile'] . '&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED);
    Severity: Minor
    Found in admin/export.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status