midasplatform/Midas

View on GitHub
core/GlobalController.php

Summary

Maintainability
D
2 days
Test Coverage

Function preDispatch has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    public function preDispatch()
    {
        UtilityComponent::setTimeLimit(0);
        $enabledModules = Zend_Registry::get('modulesEnable');

Severity: Minor
Found in core/GlobalController.php - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method preDispatch has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function preDispatch()
    {
        UtilityComponent::setTimeLimit(0);
        $enabledModules = Zend_Registry::get('modulesEnable');

Severity: Major
Found in core/GlobalController.php - About 3 hrs to fix

Function loadElements has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function loadElements()
    {
        Zend_Registry::set('models', array());
        if (isset($this->_models)) {
            MidasLoader::loadModels($this->_models);
Severity: Minor
Found in core/GlobalController.php - About 3 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method loadElements has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function loadElements()
    {
        Zend_Registry::set('models', array());
        if (isset($this->_models)) {
            MidasLoader::loadModels($this->_models);
Severity: Minor
Found in core/GlobalController.php - About 1 hr to fix

The method loadElements() has an NPath complexity of 432. The configured NPath complexity threshold is 200.
Open

    public function loadElements()
    {
        Zend_Registry::set('models', array());
        if (isset($this->_models)) {
            MidasLoader::loadModels($this->_models);
Severity: Minor
Found in core/GlobalController.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method loadElements() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
Open

    public function loadElements()
    {
        Zend_Registry::set('models', array());
        if (isset($this->_models)) {
            MidasLoader::loadModels($this->_models);
Severity: Minor
Found in core/GlobalController.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

The method preDispatch() has a Cyclomatic Complexity of 16. The configured cyclomatic complexity threshold is 10.
Open

    public function preDispatch()
    {
        UtilityComponent::setTimeLimit(0);
        $enabledModules = Zend_Registry::get('modulesEnable');

Severity: Minor
Found in core/GlobalController.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

Missing class import via use statement (line '196', column '44').
Open

                    $this->Component = new stdClass();
Severity: Minor
Found in core/GlobalController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '86', column '48').
Open

                $configs[$enabledModule] = new Zend_Config_Ini(LOCAL_CONFIGS_PATH.'/'.$enabledModule.'.local.ini', 'global');
Severity: Minor
Found in core/GlobalController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '215', column '31').
Open

                    throw new Zend_Exception('Unable to find '.$nameForm);
Severity: Minor
Found in core/GlobalController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '88', column '48').
Open

                $configs[$enabledModule] = new Zend_Config_Ini(
Severity: Minor
Found in core/GlobalController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '199', column '31').
Open

                    throw new Zend_Exception('Unable to find '.$nameComponent);
Severity: Minor
Found in core/GlobalController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '92', column '48').
Open

                $configs[$enabledModule] = new Zend_Config_Ini(
Severity: Minor
Found in core/GlobalController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

The method getSafeParam has a boolean flag argument $trim, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function getSafeParam($paramName, $trim = false)
Severity: Minor
Found in core/GlobalController.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

Missing class import via use statement (line '212', column '39').
Open

                    $this->Form = new stdClass();
Severity: Minor
Found in core/GlobalController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

The method getTempDirectory has a boolean flag argument $createDirectory, which is a certain sign of a Single Responsibility Principle violation.
Open

    protected function getTempDirectory($subDirectory = 'misc', $createDirectory = true)
Severity: Minor
Found in core/GlobalController.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

Missing class import via use statement (line '59', column '34').
Open

                $translate = new Zend_Translate('csv', BASE_PATH.'/core/translation/fr-main.csv', 'en');
Severity: Minor
Found in core/GlobalController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '65', column '60').
Open

                        $translators[$enabledModule] = new Zend_Translate(
Severity: Minor
Found in core/GlobalController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '71', column '60').
Open

                        $translators[$enabledModule] = new Zend_Translate(
Severity: Minor
Found in core/GlobalController.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

The method getDataDirectory has a boolean flag argument $createDirectory, which is a certain sign of a Single Responsibility Principle violation.
Open

    protected function getDataDirectory($subDirectory = '', $createDirectory = true)
Severity: Minor
Found in core/GlobalController.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

Avoid using static access to class 'Zend_Loader' in method 'loadElements'.
Open

                Zend_Loader::loadClass($nameForm, BASE_PATH.'/core/controllers/forms');
Severity: Minor
Found in core/GlobalController.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'MidasLoader' in method 'loadElements'.
Open

            MidasLoader::loadModels($this->_models);
Severity: Minor
Found in core/GlobalController.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'MidasLoader' in method 'preDispatch'.
Open

            $settingModel = MidasLoader::loadModel('Setting');
Severity: Minor
Found in core/GlobalController.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Zend_Registry' in method 'getLogger'.
Open

        return Zend_Registry::get('logger');
Severity: Minor
Found in core/GlobalController.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Zend_Registry' in method 'loadElements'.
Open

        Zend_Registry::set('components', array());
Severity: Minor
Found in core/GlobalController.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'UtilityComponent' in method 'preDispatch'.
Open

        UtilityComponent::setTimeLimit(0);
Severity: Minor
Found in core/GlobalController.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Zend_Registry' in method 'preDispatch'.
Open

        Zend_Registry::set('configsModules', $configs);
Severity: Minor
Found in core/GlobalController.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

The method preDispatch uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $configs[$enabledModule] = new Zend_Config_Ini(
                    BASE_PATH.'/modules/'.$enabledModule.'/configs/module.ini',
                    'global'
                );
Severity: Minor
Found in core/GlobalController.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Avoid using static access to class 'UtilityComponent' in method 'getTempDirectory'.
Open

        return UtilityComponent::getTempDirectory($subDirectory, $createDirectory);
Severity: Minor
Found in core/GlobalController.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Zend_Registry' in method 'preDispatch'.
Open

                    Zend_Registry::set('translatorsModules', $translators);
Severity: Minor
Found in core/GlobalController.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Zend_Registry' in method 'preDispatch'.
Open

                Zend_Registry::set('translator', $translate);
Severity: Minor
Found in core/GlobalController.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'UtilityComponent' in method 'getDataDirectory'.
Open

        return UtilityComponent::getDataDirectory($subDirectory, $createDirectory);
Severity: Minor
Found in core/GlobalController.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Zend_Loader' in method 'loadElements'.
Open

                Zend_Loader::loadClass($dao.'Dao', BASE_PATH.'/core/models/dao');
Severity: Minor
Found in core/GlobalController.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Zend_Registry' in method 'preDispatch'.
Open

        $enabledModules = Zend_Registry::get('modulesEnable');
Severity: Minor
Found in core/GlobalController.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Zend_Registry' in method 'loadElements'.
Open

        Zend_Registry::set('models', array());
Severity: Minor
Found in core/GlobalController.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Zend_Loader' in method 'loadElements'.
Open

                Zend_Loader::loadClass($nameComponent, BASE_PATH.'/core/controllers/components');
Severity: Minor
Found in core/GlobalController.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Zend_Registry' in method 'loadElements'.
Open

        Zend_Registry::set('forms', array());
Severity: Minor
Found in core/GlobalController.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'Zend_Registry' in method 'loadElements'.
Open

        $modelsArray = Zend_Registry::get('models');
Severity: Minor
Found in core/GlobalController.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid unused local variables such as '$config'.
Open

            foreach ($configs as $key => $config) {
Severity: Minor
Found in core/GlobalController.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                } elseif (file_exists(
                    BASE_PATH.'/privateModules/'.$key.'/controllers/'.ucfirst(
                        $request->getControllerName()
                    ).'CoreController.php'
                )) {
Severity: Major
Found in core/GlobalController.php and 1 other location - About 3 hrs to fix
core/GlobalController.php on lines 107..143

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 150.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                if (file_exists(
                    BASE_PATH.'/modules/'.$key.'/controllers/'.ucfirst(
                        $request->getControllerName()
                    ).'CoreController.php'
                )) {
Severity: Major
Found in core/GlobalController.php and 1 other location - About 3 hrs to fix
core/GlobalController.php on lines 125..143

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 150.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        if (isset($this->_components)) {
            foreach ($this->_components as $component) {
                $nameComponent = $component.'Component';
                Zend_Loader::loadClass($nameComponent, BASE_PATH.'/core/controllers/components');
                if (!isset($this->Component)) {
Severity: Major
Found in core/GlobalController.php and 1 other location - About 1 hr to fix
core/GlobalController.php on lines 206..219

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 116.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        if (isset($this->_forms)) {
            foreach ($this->_forms as $forms) {
                $nameForm = $forms.'Form';

                Zend_Loader::loadClass($nameForm, BASE_PATH.'/core/controllers/forms');
Severity: Major
Found in core/GlobalController.php and 1 other location - About 1 hr to fix
core/GlobalController.php on lines 191..203

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 116.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class MIDAS_GlobalController extends Zend_Controller_Action
Severity: Minor
Found in core/GlobalController.php by phpcodesniffer

A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 24 and the first side effect is on line 21.
Open

<?php
Severity: Minor
Found in core/GlobalController.php by phpcodesniffer

The class MIDAS_GlobalController is not named in CamelCase.
Open

class MIDAS_GlobalController extends Zend_Controller_Action
{
    /** @var array */
    protected $Models = array();

Severity: Minor
Found in core/GlobalController.php by phpmd

CamelCaseClassName

Since: 0.2

It is considered best practice to use the CamelCase notation to name classes.

Example

class class_name {
}

Source

Only one argument is allowed per line in a multi-line function call
Open

                    BASE_PATH.'/privateModules/'.$enabledModule.'/configs/module.ini', 'global'
Severity: Minor
Found in core/GlobalController.php by phpcodesniffer

Line exceeds 120 characters; contains 125 characters
Open

                $configs[$enabledModule] = new Zend_Config_Ini(LOCAL_CONFIGS_PATH.'/'.$enabledModule.'.local.ini', 'global');
Severity: Minor
Found in core/GlobalController.php by phpcodesniffer

Multi-line function call not indented correctly; expected 24 spaces but found 28
Open

                            $request->getControllerName()
Severity: Minor
Found in core/GlobalController.php by phpcodesniffer

Multi-line function call not indented correctly; expected 24 spaces but found 28
Open

                            $request->getControllerName()
Severity: Minor
Found in core/GlobalController.php by phpcodesniffer

Class name "MIDAS_GlobalController" is not in camel caps format
Open

class MIDAS_GlobalController extends Zend_Controller_Action
Severity: Minor
Found in core/GlobalController.php by phpcodesniffer

Multi-line function call not indented correctly; expected 20 spaces but found 24
Open

                        ).'CoreController.php';
Severity: Minor
Found in core/GlobalController.php by phpcodesniffer

Multi-line function call not indented correctly; expected 20 spaces but found 24
Open

                        ).'CoreController.php';
Severity: Minor
Found in core/GlobalController.php by phpcodesniffer

There are no issues that match your filters.

Category
Status