AlumniGroupPermHandler   A
last analyzed

Complexity

Total Complexity 14

Size/Duplication

Total Lines 96
Duplicated Lines 28.13 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 27
loc 96
rs 10
c 0
b 0
f 0
wmc 14
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A checkRight() 0 4 1
D updatePerms() 27 73 13

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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

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
/**
13
 * page module
14
 *
15
 * @copyright       XOOPS Project https://xoops.org/
16
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
17
 * @package         page
18
 * @since           2.6.0
19
 * @author          DuGris (aka Laurent JEN)
20
 * @author          John Mordo (jlm69)
21
 * @version         $Id$
22
 */
23
24
use Xoops\Core\Kernel\Handlers\XoopsGroupPermHandler;
25
26
defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
27
28
/**
29
 * Class AlumniGroupPermHandler
30
 */
31
class AlumniGroupPermHandler extends XoopsGroupPermHandler
0 ignored issues
show
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...
32
{
33
    /**
34
     * Check permission
35
     *
36
     * @param string    $gperm_name
37
     * @param int       $gperm_itemid
38
     * @param array|int $gperm_groupid
39
     * @param int       $gperm_modid
40
     * @param bool      $trueifadmin
41
     *
42
     * @return bool
43
     */
44
    public function checkRight($gperm_name, $gperm_itemid, $gperm_groupid, $gperm_modid = 1, $trueifadmin = true)
0 ignored issues
show
Coding Style introduced by
function checkRight() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Coding Style introduced by
$gperm_name does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
45
    {
46
        return parent::checkRight($gperm_name, $gperm_itemid, $gperm_groupid, $gperm_modid, $trueifadmin);
0 ignored issues
show
Coding Style introduced by
$gperm_name does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
47
    }
48
49
    /**
50
     * @param       $cid
51
     * @param array $groups
52
     */
53
    public function updatePerms($cid, $groups = [])
54
    {
55
        $module_id = Alumni::getInstance()->getModule()->getVar('mid');
0 ignored issues
show
Coding Style introduced by
$module_id does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
56
57
        $groups_exists = parent::getGroupIds('alumni_view', $cid, $module_id);
0 ignored issues
show
Coding Style introduced by
$groups_exists does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility Bug introduced by
It seems like you call parent on a different method (getGroupIds() instead of updatePerms()). Are you sure this is correct? If so, you might want to change this to $this->getGroupIds().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
58
        $groups_exists = array_values($groups_exists);
0 ignored issues
show
Coding Style introduced by
$groups_exists does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
59
        $groups_delete = array_diff(array_values($groups_exists), $groups);
0 ignored issues
show
Coding Style introduced by
$groups_delete does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
60
        $groups_add    = array_diff($groups, array_values($groups_exists));
0 ignored issues
show
Coding Style introduced by
$groups_add does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
61
62
        $groups1_exists = parent::getGroupIds('alumni_submit', $cid, $module_id);
0 ignored issues
show
Coding Style introduced by
$groups1_exists does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility Bug introduced by
It seems like you call parent on a different method (getGroupIds() instead of updatePerms()). Are you sure this is correct? If so, you might want to change this to $this->getGroupIds().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
63
        $groups1_exists = array_values($groups1_exists);
0 ignored issues
show
Coding Style introduced by
$groups1_exists does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
64
        $groups1_delete = array_diff(array_values($groups1_exists), $groups);
0 ignored issues
show
Coding Style introduced by
$groups1_delete does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
65
        $groups1_add    = array_diff($groups, array_values($groups1_exists));
0 ignored issues
show
Coding Style introduced by
$groups1_add does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
66
67
        $groups2_exists = parent::getGroupIds('alumni_premium', $cid, $module_id);
0 ignored issues
show
Coding Style introduced by
$groups2_exists does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility Bug introduced by
It seems like you call parent on a different method (getGroupIds() instead of updatePerms()). Are you sure this is correct? If so, you might want to change this to $this->getGroupIds().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
68
        $groups2_exists = array_values($groups2_exists);
0 ignored issues
show
Coding Style introduced by
$groups2_exists does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
69
        $groups2_delete = array_diff(array_values($groups2_exists), $groups);
0 ignored issues
show
Coding Style introduced by
$groups2_delete does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
70
        $groups2_add    = array_diff($groups, array_values($groups2_exists));
0 ignored issues
show
Coding Style introduced by
$groups2_add does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
71
72
        // delete alumni_view
73 View Code Duplication
        if (0 != count($groups_delete)) {
0 ignored issues
show
Coding Style introduced by
$groups_delete does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Duplication introduced by
This code seems to be duplicated across 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...
74
            $criteria = $criteria = new CriteriaCompo();
75
            $criteria->add(new Criteria('gperm_itemid', $cid));
76
            $criteria->add(new Criteria('gperm_modid', $module_id));
0 ignored issues
show
Coding Style introduced by
$module_id does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
77
            $criteria->add(new Criteria('gperm_name', 'alumni_view', '='));
78
            $criteria->add(new Criteria('gperm_groupid', '(' . implode(', ', $groups_delete) . ')', 'IN'));
0 ignored issues
show
Coding Style introduced by
$groups_delete does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
79
            if (parent::deleteAll($criteria)) {
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (deleteAll() instead of updatePerms()). Are you sure this is correct? If so, you might want to change this to $this->deleteAll().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
Unused Code introduced by
This if statement is empty and can be removed.

This check looks for the bodies of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These if bodies can be removed. If you have an empty if but statements in the else branch, consider inverting the condition.

if (rand(1, 6) > 3) {
//print "Check failed";
} else {
    print "Check succeeded";
}

could be turned into

if (rand(1, 6) <= 3) {
    print "Check succeeded";
}

This is much more concise to read.

Loading history...
80
            }
81
        }
82
83
        // delete alumni_view
84 View Code Duplication
        if (0 != count($groups1_delete)) {
0 ignored issues
show
Coding Style introduced by
$groups1_delete does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Duplication introduced by
This code seems to be duplicated across 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...
85
            $criteria = $criteria = new CriteriaCompo();
86
            $criteria->add(new Criteria('gperm_itemid', $cid));
87
            $criteria->add(new Criteria('gperm_modid', $module_id));
0 ignored issues
show
Coding Style introduced by
$module_id does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
88
            $criteria->add(new Criteria('gperm_name', 'alumni_submit', '='));
89
            $criteria->add(new Criteria('gperm_groupid', '(' . implode(', ', $groups1_delete) . ')', 'IN'));
0 ignored issues
show
Coding Style introduced by
$groups1_delete does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
90
            if (parent::deleteAll($criteria)) {
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (deleteAll() instead of updatePerms()). Are you sure this is correct? If so, you might want to change this to $this->deleteAll().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
Unused Code introduced by
This if statement is empty and can be removed.

This check looks for the bodies of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These if bodies can be removed. If you have an empty if but statements in the else branch, consider inverting the condition.

if (rand(1, 6) > 3) {
//print "Check failed";
} else {
    print "Check succeeded";
}

could be turned into

if (rand(1, 6) <= 3) {
    print "Check succeeded";
}

This is much more concise to read.

Loading history...
91
            }
92
        }
93
94
        // delete alumni_view
95 View Code Duplication
        if (0 != count($groups2_delete)) {
0 ignored issues
show
Coding Style introduced by
$groups2_delete does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Duplication introduced by
This code seems to be duplicated across 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...
96
            $criteria = $criteria = new CriteriaCompo();
97
            $criteria->add(new Criteria('gperm_itemid', $cid));
98
            $criteria->add(new Criteria('gperm_modid', $module_id));
0 ignored issues
show
Coding Style introduced by
$module_id does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
99
            $criteria->add(new Criteria('gperm_name', 'alumni_premium', '='));
100
            $criteria->add(new Criteria('gperm_groupid', '(' . implode(', ', $groups2_delete) . ')', 'IN'));
0 ignored issues
show
Coding Style introduced by
$groups2_delete does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
101
            if (parent::deleteAll($criteria)) {
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (deleteAll() instead of updatePerms()). Are you sure this is correct? If so, you might want to change this to $this->deleteAll().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
Unused Code introduced by
This if statement is empty and can be removed.

This check looks for the bodies of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These if bodies can be removed. If you have an empty if but statements in the else branch, consider inverting the condition.

if (rand(1, 6) > 3) {
//print "Check failed";
} else {
    print "Check succeeded";
}

could be turned into

if (rand(1, 6) <= 3) {
    print "Check succeeded";
}

This is much more concise to read.

Loading history...
102
            }
103
        }
104
105
        // Add alumni_view
106
        if (0 != count($groups_add)) {
0 ignored issues
show
Coding Style introduced by
$groups_add does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
107
            foreach ($groups_add as $group_id) {
0 ignored issues
show
Coding Style introduced by
$groups_add does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
108
                parent::addRight('alumni_view', $cid, $group_id, $module_id);
0 ignored issues
show
Coding Style introduced by
$group_id does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility Bug introduced by
It seems like you call parent on a different method (addRight() instead of updatePerms()). Are you sure this is correct? If so, you might want to change this to $this->addRight().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
109
            }
110
        }
111
112
        // Add alumni_submit
113
        if (0 != count($groups1_add)) {
0 ignored issues
show
Coding Style introduced by
$groups1_add does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
114
            foreach ($groups1_add as $group_id) {
0 ignored issues
show
Coding Style introduced by
$groups1_add does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
115
                parent::addRight('alumni_submit', $cid, $group_id, $module_id);
0 ignored issues
show
Coding Style introduced by
$group_id does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility Bug introduced by
It seems like you call parent on a different method (addRight() instead of updatePerms()). Are you sure this is correct? If so, you might want to change this to $this->addRight().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
116
            }
117
        }
118
119
        // Add alumni_submit
120
        if (0 != count($groups2_add)) {
0 ignored issues
show
Coding Style introduced by
$groups2_add does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
121
            foreach ($groups2_add as $group_id) {
0 ignored issues
show
Coding Style introduced by
$groups2_add does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
122
                parent::addRight('alumni_premium', $cid, $group_id, $module_id);
0 ignored issues
show
Coding Style introduced by
$group_id does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility Bug introduced by
It seems like you call parent on a different method (addRight() instead of updatePerms()). Are you sure this is correct? If so, you might want to change this to $this->addRight().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
123
            }
124
        }
125
    }
126
}
127