Completed
Branch master (c921ab)
by Michael
109:50 queued 98:29
created

Extcal_2_33::alterTable_cat()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 12
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
c 0
b 0
f 0
nc 1
nop 0
dl 12
loc 12
rs 9.4285
1
<?php
2
/**
3
 * extcal module.
4
 *
5
 * You may not change or alter any portion of this comment or credits
6
 * of supporting developers from this source code or any supporting source code
7
 * which is considered copyrighted (c) material of the original comment or credit authors.
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
 * @copyright           XOOPS Project (http://xoops.org)
13
 * @license             http://www.fsf.org/copyleft/gpl.html GNU public license
14
 *
15
 * @since               2.2
16
 *
17
 * @author              JJDai <http://xoops.kiolo.com>
18
 **/
19
//----------------------------------------------------
20 View Code Duplication
class Extcal_2_33
0 ignored issues
show
Duplication introduced by
This class 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...
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
21
{
22
    //----------------------------------------------------
23
24
    /**
25
     * @param XoopsModule $module
26
     * @param             $options
27
     */
28
    public function __construct(XoopsModule $module, $options)
0 ignored issues
show
Unused Code introduced by
The parameter $module is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $options is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
29
    {
30
        global $xoopsDB;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
31
32
        $this->alterTable_cat();
33
        $this->alterTable_eventmember();
34
    }
35
36
    //----------------------------------------------------
37
    public function alterTable_cat()
38
    {
39
        global $xoopsDB;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
40
        $tbl = $xoopsDB->prefix('extcal_cat');
41
42
        $sql = <<<__sql__
43
ALTER TABLE `{$tbl}`
44
  ADD `cat_weight` INT NOT NULL DEFAULT '0';
45
__sql__;
46
47
        $xoopsDB->queryF($sql);
48
    }
49
50
    //----------------------------------------------------
51
    public function alterTable_eventmember()
52
    {
53
        global $xoopsDB;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
54
        $tbl = $xoopsDB->prefix('eventmember');
55
56
        $sql = <<<__sql__
57
ALTER TABLE `{$tbl}`
58
  ADD `status` INT NOT NULL DEFAULT '0';
59
__sql__;
60
61
        $xoopsDB->queryF($sql);
62
    }
63
64
    //-----------------------------------------------------------------
65
}   // fin de la classe
66