Passed
Push — master ( 1bc300...987c24 )
by Michael
01:47
created

Configurator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 32
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 17 1
1
<?php namespace XoopsModules\Moduleinstaller\Common;
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 28 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
/*
4
 You may not change or alter any portion of this comment or credits
5
 of supporting developers from this source code or any supporting source code
6
 which is considered copyrighted (c) material of the original comment or credit authors.
7
8
 This program is distributed in the hope that it will be useful,
9
 but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 */
12
/**
13
 * Configurator Class
14
 *
15
 * @copyright   XOOPS Project (https://xoops.org)
16
 * @license     http://www.fsf.org/copyleft/gpl.html GNU public license
17
 * @author      XOOPS Development Team
18
 * @package     Publisher
19
 * @since       1.05
20
 *
21
 */
22
23
require_once __DIR__ . '/../../include/common.php';
24
25
/**
26
 * Class Configurator
27
 */
28
class Configurator
29
{
30
    public $name;
31
    public $paths           = [];
32
    public $uploadFolders   = [];
33
    public $copyBlankFiles  = [];
34
    public $copyTestFolders = [];
35
    public $templateFolders = [];
36
    public $oldFiles        = [];
37
    public $oldFolders      = [];
38
    public $modCopyright;
39
40
    /**
41
     * Configurator constructor.
42
     */
43
    public function __construct()
44
    {
45
        $moduleDirName = basename(dirname(__DIR__));
46
        $capsDirName   = strtoupper($moduleDirName);
0 ignored issues
show
Unused Code introduced by
The assignment to $capsDirName is dead and can be removed.
Loading history...
47
48
        require_once __DIR__ . '/../../include/config.php';
49
        $config = getConfig();
0 ignored issues
show
Bug introduced by
The function getConfig was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

49
        $config = /** @scrutinizer ignore-call */ getConfig();
Loading history...
50
51
        $this->name            = $config->name;
52
        $this->paths           = $config->paths;
53
        $this->uploadFolders   = $config->uploadFolders;
54
        $this->copyBlankFiles  = $config->copyBlankFiles;
55
        $this->copyTestFolders = $config->copyTestFolders;
56
        $this->templateFolders = $config->templateFolders;
57
        $this->oldFiles        = $config->oldFiles;
58
        $this->oldFolders      = $config->oldFolders;
59
        $this->modCopyright    = $config->modCopyright;
60
    }
61
}
62