index.php ➔ loadSampleData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 11
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 11
loc 11
rs 9.9
c 0
b 0
f 0
1
<?php
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
 * 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
 * @copyright       XOOPS Project (https://xoops.org)
12
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
13
 * @package
14
 * @since           2.5.9
15
 * @author          Michael Beck (aka Mamba)
16
 */
17
18
require_once __DIR__ . '/../../../mainfile.php';
19
20
21
$op = \Xmf\Request::getCmd('op', '');
22
23
switch ($op) {
24
    case 'load':
25
        loadSampleData();
26
        break;
27
}
28
29
// XMF TableLoad for SAMPLE data
30
31 View Code Duplication
function loadSampleData()
0 ignored issues
show
Duplication introduced by
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
32
{
33
    //    $moduleDirName = basename(dirname(__DIR__));
34
    xoops_loadLanguage('comment');
35
    $items = \Xmf\Yaml::readWrapped('quotes_data.yml');
36
37
    \Xmf\Database\TableLoad::truncateTable('randomquote_quotes');
38
    \Xmf\Database\TableLoad::loadTableFromArray('randomquote_quotes', $items);
39
40
    redirect_header('../admin/index.php', 1, _CM_ACTIVE);
41
}
42