midasplatform/Midas

View on GitHub
core/AppController.php

Summary

Maintainability
F
4 days
Test Coverage

preDispatch accesses the super-global variable $_POST.
Open

    public function preDispatch()
    {
        parent::preDispatch();
        $this->view->setEncoding('UTF-8');

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

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

isStartingGuide accesses the super-global variable $_GET.
Open

    public function isStartingGuide()
    {
        try {
            if ($this->userSession != null && $this->userSession->Dao != null && isset($_GET['first'])) {
                return $this->userSession->Dao->getDynamichelp() == 1;
Severity: Minor
Found in core/AppController.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

preDispatch accesses the super-global variable $_POST.
Open

    public function preDispatch()
    {
        parent::preDispatch();
        $this->view->setEncoding('UTF-8');

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

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

preDispatch accesses the super-global variable $_GET.
Open

    public function preDispatch()
    {
        parent::preDispatch();
        $this->view->setEncoding('UTF-8');

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

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

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

    public function preDispatch()
    {
        parent::preDispatch();
        $this->view->setEncoding('UTF-8');

Severity: Minor
Found in core/AppController.php - About 2 days 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 255 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function preDispatch()
    {
        parent::preDispatch();
        $this->view->setEncoding('UTF-8');

Severity: Major
Found in core/AppController.php - About 1 day to fix

File AppController.php has 401 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*=========================================================================
 Midas Server
 Copyright Kitware SAS, 26 rue Louis Guérin, 69100 Villeurbanne, France.
 All rights reserved.
Severity: Minor
Found in core/AppController.php - About 5 hrs to fix

The class AppController has an overall complexity of 77 which is very high. The configured complexity threshold is 50.
Open

class AppController extends MIDAS_GlobalController
{
    /** @var string */
    protected $coreWebroot;

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

The class AppController has 32 fields. Consider redesigning AppController to keep the number of fields under 15.
Open

class AppController extends MIDAS_GlobalController
{
    /** @var string */
    protected $coreWebroot;

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

TooManyFields

Since: 0.1

Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

Example

class Person {
   protected $one;
   private $two;
   private $three;
   [... many more fields ...]
}

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

Avoid deeply nested control flow statements.
Open

                            if ($userDao != false) {
                                // authenticate valid users in the appropriate method for the
                                // current application version
                                if ($version === false) {
                                    throw new Zend_Exception('Core version is undefined.');
Severity: Major
Found in core/AppController.php - About 45 mins to fix

The method preDispatch() has 310 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function preDispatch()
    {
        parent::preDispatch();
        $this->view->setEncoding('UTF-8');

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

The method preDispatch() has an NPath complexity of 33200640. The configured NPath complexity threshold is 200.
Open

    public function preDispatch()
    {
        parent::preDispatch();
        $this->view->setEncoding('UTF-8');

Severity: Minor
Found in core/AppController.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 preDispatch() has a Cyclomatic Complexity of 46. The configured cyclomatic complexity threshold is 10.
Open

    public function preDispatch()
    {
        parent::preDispatch();
        $this->view->setEncoding('UTF-8');

Severity: Minor
Found in core/AppController.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 class AppController has a coupling between objects value of 39. Consider to reduce the number of dependencies under 13.
Open

class AppController extends MIDAS_GlobalController
{
    /** @var string */
    protected $coreWebroot;

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

CouplingBetweenObjects

Since: 1.1.0

A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

Example

class Foo {
    /**
     * @var \foo\bar\X
     */
    private $x = null;

    /**
     * @var \foo\bar\Y
     */
    private $y = null;

    /**
     * @var \foo\bar\Z
     */
    private $z = null;

    public function setFoo(\Foo $foo) {}
    public function setBar(\Bar $bar) {}
    public function setBaz(\Baz $baz) {}

    /**
     * @return \SplObjectStorage
     * @throws \OutOfRangeException
     * @throws \InvalidArgumentException
     * @throws \ErrorException
     */
    public function process(\Iterator $it) {}

    // ...
}

Source https://phpmd.org/rules/design.html#couplingbetweenobjects

Missing class import via use statement (line '107', column '29').
Open

                $user = new Zend_Session_Namespace('Auth_User');
Severity: Minor
Found in core/AppController.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 '140', column '47').
Open

                                    throw new Zend_Exception('Core version is undefined.');
Severity: Minor
Found in core/AppController.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 '104', column '31').
Open

                    throw new Zend_Exception('Unable to find user');
Severity: Minor
Found in core/AppController.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 '525', column '23').
Open

            throw new Zend_Exception(MIDAS_LOGIN_REQUIRED, 403);
Severity: Minor
Found in core/AppController.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 '121', column '37').
Open

                    $notifier = new MIDAS_Notifier(false, null);
Severity: Minor
Found in core/AppController.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 '513', column '23').
Open

            throw new Zend_Exception(MIDAS_ADMIN_PRIVILEGES_REQUIRED, 403);
Severity: Minor
Found in core/AppController.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 '98', column '29').
Open

                $user = new Zend_Session_Namespace('Auth_User_Testing');
Severity: Minor
Found in core/AppController.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 '205', column '44').
Open

        Zend_Registry::set('notifier', new MIDAS_Notifier($this->logged, $this->userSession));
Severity: Minor
Found in core/AppController.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 '501', column '23').
Open

            throw new Zend_Exception(MIDAS_AJAX_REQUEST_ONLY);
Severity: Minor
Found in core/AppController.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

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

        $version = UtilityComponent::getCurrentModuleVersion('core');
Severity: Minor
Found in core/AppController.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('userSession', $user);
Severity: Minor
Found in core/AppController.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('userSession', null);
Severity: Minor
Found in core/AppController.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 {
                $this->addDynamicHelp(
                    '.HeaderLogo',
                    'The Midas Platform integrates multimedia server technology with open-source data analysis and visualization clients.'
                );
Severity: Minor
Found in core/AppController.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 'Zend_Controller_Front' in method 'preDispatch'.
Open

        $fc = Zend_Controller_Front::getInstance();
Severity: Minor
Found in core/AppController.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/AppController.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 {
            $this->view->googleAnalyticsScript = false;
        }
Severity: Minor
Found in core/AppController.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 'MidasLoader' in method 'preDispatch'.
Open

                $userModel = MidasLoader::loadModel('User');
Severity: Minor
Found in core/AppController.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/AppController.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 'isDynamicHelp'.
Open

            $settingModel = MidasLoader::loadModel('Setting');
Severity: Minor
Found in core/AppController.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('coreWebroot', $this->view->coreWebroot);
Severity: Minor
Found in core/AppController.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 {
                $enabledModules = Zend_Registry::get('modulesEnable');
                foreach ($enabledModules as $enabledModule) {
                    if (file_exists(BASE_PATH.'/modules/'.$enabledModule.'/layouts/layout-core.phtml')) {
                        $this->_helper->layout->setLayoutPath(BASE_PATH.'/modules/'.$enabledModule.'/layouts/');
Severity: Minor
Found in core/AppController.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

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 {
            $this->view->lang = 'en';
        }
Severity: Minor
Found in core/AppController.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 'Zend_Loader' in method 'preDispatch'.
Open

        Zend_Loader::loadClass('JsonComponent', BASE_PATH.'/core/controllers/components');
Severity: Minor
Found in core/AppController.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 'InternationalizationComponent' in method 't'.
Open

        return InternationalizationComponent::translate($text);
Severity: Minor
Found in core/AppController.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('webroot', $this->view->webroot);
Severity: Minor
Found in core/AppController.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 {
                $user = new Zend_Session_Namespace('Auth_User');
                $user->setExpirationSeconds(60 * (int) Zend_Registry::get('configGlobal')->get('session_lifetime', 20));
            }
Severity: Minor
Found in core/AppController.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

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 {
            Zend_Registry::set('userSession', null);
            $user = null;
        }
Severity: Minor
Found in core/AppController.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 'Zend_Registry' in method 'preDispatch'.
Open

        Zend_Registry::set('notifier', new MIDAS_Notifier($this->logged, $this->userSession));
Severity: Minor
Found in core/AppController.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_Session' in method 'preDispatch'.
Open

            Zend_Session::start();
Severity: Minor
Found in core/AppController.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 {
                                    $auth = $userModel->legacyAuthenticate($userDao, '', '', $tmp[1]);
                                }
Severity: Minor
Found in core/AppController.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

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 {
            $this->userSession = null;
            $this->view->logged = false;
            $this->logged = false;
        }
Severity: Minor
Found in core/AppController.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 'MidasLoader' in method 'preDispatch'.
Open

                $userModel = MidasLoader::loadModel('User');
Severity: Minor
Found in core/AppController.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

                    $itemModel = MidasLoader::loadModel('Item');
Severity: Minor
Found in core/AppController.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 {
                $this->view->logged = false;
                $this->logged = false;
            }
Severity: Minor
Found in core/AppController.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 'getServerURL'.
Open

        return UtilityComponent::getServerURL();
Severity: Minor
Found in core/AppController.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

            $progressModel = MidasLoader::loadModel('Progress');
Severity: Minor
Found in core/AppController.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_Session' in method 'preDispatch'.
Open

                Zend_Session::setId($_POST['sid']);
Severity: Minor
Found in core/AppController.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 {
                $this->addDynamicHelp(
                    '.registerLink',
                    'Register to create your personal space.',
                    'bottom left',
Severity: Minor
Found in core/AppController.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 'JsonComponent' in method 'postDispatch'.
Open

        $this->view->json = JsonComponent::encode($this->view->json);
Severity: Minor
Found in core/AppController.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 {
            $this->progressDao = null;
        }
Severity: Minor
Found in core/AppController.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 'MidasLoader' in method 'postDispatch'.
Open

            $progressModel = MidasLoader::loadModel('Progress');
Severity: Minor
Found in core/AppController.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 't'.
Open

        Zend_Loader::loadClass('InternationalizationComponent', BASE_PATH.'/core/controllers/components');
Severity: Minor
Found in core/AppController.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 excessively long variable names like $googleAnalyticsProperty. Keep variable name length under 20.
Open

        $googleAnalyticsProperty = $settingModel->getValueByNameWithDefault('google_analytics_property', false);
Severity: Minor
Found in core/AppController.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid using short method names like AppController::t(). The configured minimum method name length is 3.
Open

    protected function t($text)
    {
        Zend_Loader::loadClass('InternationalizationComponent', BASE_PATH.'/core/controllers/components');

        return InternationalizationComponent::translate($text);
Severity: Minor
Found in core/AppController.php by phpmd

ShortMethodName

Since: 0.2

Detects when very short method names are used.

Example

class ShortMethod {
    public function a( $index ) { // Violation
    }
}

Source https://phpmd.org/rules/naming.html#shortmethodname

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

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

Avoid variables with short names like $fc. Configured minimum length is 3.
Open

        $fc = Zend_Controller_Front::getInstance();
Severity: Minor
Found in core/AppController.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Line exceeds 120 characters; contains 124 characters
Open

        $this->view->title = $settingModel->getValueByNameWithDefault('title', 'Midas Platform - Digital Archiving System');
Severity: Minor
Found in core/AppController.php by phpcodesniffer

Line exceeds 120 characters; contains 123 characters
Open

            if (Zend_Registry::get('configGlobal')->get('environment', 'production') === 'testing' && isset($testingUserId)
Severity: Minor
Found in core/AppController.php by phpcodesniffer

Line exceeds 120 characters; contains 442 characters
Open

                = "(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create','".htmlspecialchars($googleAnalyticsProperty, ENT_QUOTES, 'UTF-8')."','auto');ga('send','pageview');";
Severity: Minor
Found in core/AppController.php by phpcodesniffer

Line exceeds 120 characters; contains 138 characters
Open

                    'The Midas Platform integrates multimedia server technology with open-source data analysis and visualization clients.'
Severity: Minor
Found in core/AppController.php by phpcodesniffer

Multi-line function call not indented correctly; expected 12 spaces but found 16
Open

                )
Severity: Minor
Found in core/AppController.php by phpcodesniffer

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

                    $this->_helper->layout->getLayoutPath().'/'.$layoutParam.'.phtml'
Severity: Minor
Found in core/AppController.php by phpcodesniffer

There are no issues that match your filters.

Category
Status