Completed
Push — master ( ebae0d...d3e687 )
by Michael
02:49
created

config.php ➔ getConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 60
Code Lines 39

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 39
nc 1
nop 0
dl 0
loc 60
rs 9.5555
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 31 and the first side effect is on line 23.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/*
3
 You may not change or alter any portion of this comment or credits
4
 of supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit authors.
6
7
 This program is distributed in the hope that it will be useful,
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
*/
11
/**
12
 * animal module for xoops
13
 *
14
 * @copyright       XOOPS Project (https://xoops.org)
15
 * @license         GPL 2.0 or later
16
 * @package         Publisher
17
 * @subpackage      Config
18
 * @since           1.03
19
 * @author          XOOPS Development Team - ( https://xoops.org )
20
 */
21
22
// defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
23
include_once __DIR__ . '/common.php';
24
25
$moduleDirName = basename(dirname(__DIR__));
26
$uploadFolders = [
27
    NEWBB_UPLOAD_PATH,
28
    NEWBB_UPLOAD_PATH . '/thumbs'
29
];
30
31
function getConfig()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
32
{
33
    $moduleDirName      = basename(dirname(__DIR__));
34
    $moduleDirNameUpper = strtoupper($moduleDirName);
35
    return (object)[
36
        'name'           => strtoupper($moduleDirName) . ' Module Configurator',
37
        'paths'          => [
38
            'dirname'    => $moduleDirName,
39
            'admin'      => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin',
40
            'modPath'    => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName,
41
            'modUrl'     => XOOPS_URL . '/modules/' . $moduleDirName,
42
            'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName,
43
            'uploadUrl'  => XOOPS_UPLOAD_URL . '/' . $moduleDirName,
44
        ],
45
        'uploadFolders'  => [
46
            constant($moduleDirNameUpper . '_UPLOAD_PATH'),
47
            constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/thumbs',
48
49
            //XOOPS_UPLOAD_PATH . '/flags'
50
        ],
51
        'copyBlankFiles' => [
52
            constant($moduleDirNameUpper . '_UPLOAD_PATH'),
53
            constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/thumbs',
54
            //XOOPS_UPLOAD_PATH . '/flags'
55
        ],
56
57
        'copyTestFolders' => [
58
            //        constant($moduleDirNameUpper . '_UPLOAD_PATH'),
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
59
            //[
60
            //    constant($moduleDirNameUpper . '_PATH') . '/testdata/images',
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
61
            //    constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/images',
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
62
            //]
63
        ],
64
65
        'templateFolders' => [
66
            '/templates/',
67
            '/templates/blocks/',
68
            '/templates/admin/'
69
70
        ],
71
        'oldFiles'        => [
72
            '/class/request.php',
73
            '/class/registry.php',
74
            '/class/utilities.php',
75
            '/class/util.php',
76
            '/include/constants.php',
77
            '/include/functions.php',
78
            '/ajaxrating.txt',
79
        ],
80
        'oldFolders'      => [
81
            '/images',
82
            '/css',
83
            '/js',
84
            '/tcpdf',
85
            '/images',
86
        ],
87
        'modCopyright'    => "<a href='https://xoops.org' title='XOOPS Project' target='_blank'>
88
                     <img src='" . constant($moduleDirNameUpper . '_AUTHOR_LOGOIMG') . '\' alt=\'XOOPS Project\' /></a>',
89
    ];
90
}
91
92